Skip to content

Commit

Permalink
of/device: Replace struct of_device with struct platform_device
Browse files Browse the repository at this point in the history
of_device is just an alias for platform_device, so remove it entirely.  Also
replace to_of_device() with to_platform_device() and update comment blocks.

This patch was initially generated from the following semantic patch, and then
edited by hand to pick up the bits that coccinelle didn't catch.

@@
@@
-struct of_device
+struct platform_device

Signed-off-by: Grant Likely <[email protected]>
Reviewed-by: David S. Miller <[email protected]>
  • Loading branch information
glikely committed Aug 6, 2010
1 parent fc1caf6 commit 2dc1158
Show file tree
Hide file tree
Showing 158 changed files with 519 additions and 527 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/83xx/mpc837x_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static struct of_device_id mpc837x_ids[] = {

static int __init mpc837x_declare_of_platform_devices(void)
{
/* Publish of_device */
/* Publish platform_device */
of_platform_bus_probe(NULL, mpc837x_ids, NULL);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/83xx/mpc837x_rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static struct of_device_id mpc837x_ids[] = {

static int __init mpc837x_declare_of_platform_devices(void)
{
/* Publish of_device */
/* Publish platform_device */
of_platform_bus_probe(NULL, mpc837x_ids, NULL);

return 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/fsl_rio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ static inline void fsl_rio_info(struct device *dev, u32 ccsr)

/**
* fsl_rio_setup - Setup Freescale PowerPC RapidIO interface
* @dev: of_device pointer
* @dev: platform_device pointer
*
* Initializes MPC85xx RapidIO hardware interface, configures
* master port with system-specific info, and registers the
Expand Down
8 changes: 4 additions & 4 deletions drivers/ata/pata_mpc52xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ mpc52xx_ata_remove_one(struct device *dev)
/* ======================================================================== */

static int __devinit
mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
mpc52xx_ata_probe(struct platform_device *op, const struct of_device_id *match)
{
unsigned int ipb_freq;
struct resource res_mem;
Expand Down Expand Up @@ -821,7 +821,7 @@ mpc52xx_ata_probe(struct of_device *op, const struct of_device_id *match)
}

static int
mpc52xx_ata_remove(struct of_device *op)
mpc52xx_ata_remove(struct platform_device *op)
{
struct mpc52xx_ata_priv *priv;
int task_irq;
Expand All @@ -848,15 +848,15 @@ mpc52xx_ata_remove(struct of_device *op)
#ifdef CONFIG_PM

static int
mpc52xx_ata_suspend(struct of_device *op, pm_message_t state)
mpc52xx_ata_suspend(struct platform_device *op, pm_message_t state)
{
struct ata_host *host = dev_get_drvdata(&op->dev);

return ata_host_suspend(host, state);
}

static int
mpc52xx_ata_resume(struct of_device *op)
mpc52xx_ata_resume(struct platform_device *op)
{
struct ata_host *host = dev_get_drvdata(&op->dev);
struct mpc52xx_ata_priv *priv = host->private_data;
Expand Down
4 changes: 2 additions & 2 deletions drivers/ata/pata_of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <linux/of_platform.h>
#include <linux/ata_platform.h>

static int __devinit pata_of_platform_probe(struct of_device *ofdev,
static int __devinit pata_of_platform_probe(struct platform_device *ofdev,
const struct of_device_id *match)
{
int ret;
Expand Down Expand Up @@ -78,7 +78,7 @@ static int __devinit pata_of_platform_probe(struct of_device *ofdev,
reg_shift, pio_mask);
}

static int __devexit pata_of_platform_remove(struct of_device *ofdev)
static int __devexit pata_of_platform_remove(struct platform_device *ofdev)
{
return __pata_platform_remove(&ofdev->dev);
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/ata/sata_fsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ static const struct ata_port_info sata_fsl_port_info[] = {
},
};

static int sata_fsl_probe(struct of_device *ofdev,
static int sata_fsl_probe(struct platform_device *ofdev,
const struct of_device_id *match)
{
int retval = -ENXIO;
Expand Down Expand Up @@ -1370,7 +1370,7 @@ static int sata_fsl_probe(struct of_device *ofdev,
return retval;
}

static int sata_fsl_remove(struct of_device *ofdev)
static int sata_fsl_remove(struct platform_device *ofdev)
{
struct ata_host *host = dev_get_drvdata(&ofdev->dev);
struct sata_fsl_host_priv *host_priv = host->private_data;
Expand All @@ -1387,13 +1387,13 @@ static int sata_fsl_remove(struct of_device *ofdev)
}

#ifdef CONFIG_PM
static int sata_fsl_suspend(struct of_device *op, pm_message_t state)
static int sata_fsl_suspend(struct platform_device *op, pm_message_t state)
{
struct ata_host *host = dev_get_drvdata(&op->dev);
return ata_host_suspend(host, state);
}

static int sata_fsl_resume(struct of_device *op)
static int sata_fsl_resume(struct platform_device *op)
{
struct ata_host *host = dev_get_drvdata(&op->dev);
struct sata_fsl_host_priv *host_priv = host->private_data;
Expand Down
26 changes: 13 additions & 13 deletions drivers/atm/fore200e.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ static void fore200e_sba_write(u32 val, volatile u32 __iomem *addr)

static u32 fore200e_sba_dma_map(struct fore200e *fore200e, void* virt_addr, int size, int direction)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;
u32 dma_addr;

dma_addr = dma_map_single(&op->dev, virt_addr, size, direction);
Expand All @@ -687,7 +687,7 @@ static u32 fore200e_sba_dma_map(struct fore200e *fore200e, void* virt_addr, int

static void fore200e_sba_dma_unmap(struct fore200e *fore200e, u32 dma_addr, int size, int direction)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;

DPRINTK(3, "SBUS DVMA unmapping: dma_addr = 0x%08x, size = %d, direction = %d,\n",
dma_addr, size, direction);
Expand All @@ -697,7 +697,7 @@ static void fore200e_sba_dma_unmap(struct fore200e *fore200e, u32 dma_addr, int

static void fore200e_sba_dma_sync_for_cpu(struct fore200e *fore200e, u32 dma_addr, int size, int direction)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;

DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction);

Expand All @@ -706,7 +706,7 @@ static void fore200e_sba_dma_sync_for_cpu(struct fore200e *fore200e, u32 dma_add

static void fore200e_sba_dma_sync_for_device(struct fore200e *fore200e, u32 dma_addr, int size, int direction)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;

DPRINTK(3, "SBUS DVMA sync: dma_addr = 0x%08x, size = %d, direction = %d\n", dma_addr, size, direction);

Expand All @@ -719,7 +719,7 @@ static void fore200e_sba_dma_sync_for_device(struct fore200e *fore200e, u32 dma_
static int fore200e_sba_dma_chunk_alloc(struct fore200e *fore200e, struct chunk *chunk,
int size, int nbr, int alignment)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;

chunk->alloc_size = chunk->align_size = size * nbr;

Expand All @@ -738,7 +738,7 @@ static int fore200e_sba_dma_chunk_alloc(struct fore200e *fore200e, struct chunk
/* free a DVMA consistent chunk of memory */
static void fore200e_sba_dma_chunk_free(struct fore200e *fore200e, struct chunk *chunk)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;

dma_free_coherent(&op->dev, chunk->alloc_size,
chunk->alloc_addr, chunk->dma_addr);
Expand Down Expand Up @@ -770,7 +770,7 @@ static void fore200e_sba_reset(struct fore200e *fore200e)

static int __init fore200e_sba_map(struct fore200e *fore200e)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;
unsigned int bursts;

/* gain access to the SBA specific registers */
Expand Down Expand Up @@ -800,7 +800,7 @@ static int __init fore200e_sba_map(struct fore200e *fore200e)

static void fore200e_sba_unmap(struct fore200e *fore200e)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;

of_iounmap(&op->resource[0], fore200e->regs.sba.hcr, SBA200E_HCR_LENGTH);
of_iounmap(&op->resource[1], fore200e->regs.sba.bsr, SBA200E_BSR_LENGTH);
Expand All @@ -816,7 +816,7 @@ static int __init fore200e_sba_configure(struct fore200e *fore200e)

static int __init fore200e_sba_prom_read(struct fore200e *fore200e, struct prom_data *prom)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;
const u8 *prop;
int len;

Expand All @@ -840,7 +840,7 @@ static int __init fore200e_sba_prom_read(struct fore200e *fore200e, struct prom_

static int fore200e_sba_proc_read(struct fore200e *fore200e, char *page)
{
struct of_device *op = fore200e->bus_dev;
struct platform_device *op = fore200e->bus_dev;
const struct linux_prom_registers *regs;

regs = of_get_property(op->dev.of_node, "reg", NULL);
Expand Down Expand Up @@ -2513,7 +2513,7 @@ fore200e_load_and_start_fw(struct fore200e* fore200e)
device = &((struct pci_dev *) fore200e->bus_dev)->dev;
#ifdef CONFIG_SBUS
else if (strcmp(fore200e->bus->model_name, "SBA-200E") == 0)
device = &((struct of_device *) fore200e->bus_dev)->dev;
device = &((struct platform_device *) fore200e->bus_dev)->dev;
#endif
else
return err;
Expand Down Expand Up @@ -2643,7 +2643,7 @@ fore200e_init(struct fore200e* fore200e)
}

#ifdef CONFIG_SBUS
static int __devinit fore200e_sba_probe(struct of_device *op,
static int __devinit fore200e_sba_probe(struct platform_device *op,
const struct of_device_id *match)
{
const struct fore200e_bus *bus = match->data;
Expand Down Expand Up @@ -2675,7 +2675,7 @@ static int __devinit fore200e_sba_probe(struct of_device *op,
return 0;
}

static int __devexit fore200e_sba_remove(struct of_device *op)
static int __devexit fore200e_sba_remove(struct platform_device *op)
{
struct fore200e *fore200e = dev_get_drvdata(&op->dev);

Expand Down
4 changes: 2 additions & 2 deletions drivers/block/xsysace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ static struct platform_driver ace_platform_driver = {

#if defined(CONFIG_OF)
static int __devinit
ace_of_probe(struct of_device *op, const struct of_device_id *match)
ace_of_probe(struct platform_device *op, const struct of_device_id *match)
{
struct resource res;
resource_size_t physaddr;
Expand Down Expand Up @@ -1220,7 +1220,7 @@ ace_of_probe(struct of_device *op, const struct of_device_id *match)
return ace_alloc(&op->dev, id ? *id : 0, physaddr, irq, bus_width);
}

static int __devexit ace_of_remove(struct of_device *op)
static int __devexit ace_of_remove(struct platform_device *op)
{
ace_free(&op->dev);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/hw_random/n2-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ static void __devinit n2rng_driver_version(void)
pr_info("%s", version);
}

static int __devinit n2rng_probe(struct of_device *op,
static int __devinit n2rng_probe(struct platform_device *op,
const struct of_device_id *match)
{
int victoria_falls = (match->data != NULL);
Expand Down Expand Up @@ -714,7 +714,7 @@ static int __devinit n2rng_probe(struct of_device *op,
return err;
}

static int __devexit n2rng_remove(struct of_device *op)
static int __devexit n2rng_remove(struct platform_device *op)
{
struct n2rng *np = dev_get_drvdata(&op->dev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/char/hw_random/n2rng.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct n2rng_unit {
};

struct n2rng {
struct of_device *op;
struct platform_device *op;

unsigned long flags;
#define N2RNG_FLAG_VF 0x00000001 /* Victoria Falls RNG, else N2 */
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/hw_random/pasemi-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static struct hwrng pasemi_rng = {
.data_read = pasemi_rng_data_read,
};

static int __devinit rng_probe(struct of_device *ofdev,
static int __devinit rng_probe(struct platform_device *ofdev,
const struct of_device_id *match)
{
void __iomem *rng_regs;
Expand Down Expand Up @@ -123,7 +123,7 @@ static int __devinit rng_probe(struct of_device *ofdev,
return err;
}

static int __devexit rng_remove(struct of_device *dev)
static int __devexit rng_remove(struct platform_device *dev)
{
void __iomem *rng_regs = (void __iomem *)pasemi_rng.priv;

Expand Down
4 changes: 2 additions & 2 deletions drivers/char/ipmi/ipmi_si_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2502,7 +2502,7 @@ static struct pci_driver ipmi_pci_driver = {


#ifdef CONFIG_PPC_OF
static int __devinit ipmi_of_probe(struct of_device *dev,
static int __devinit ipmi_of_probe(struct platform_device *dev,
const struct of_device_id *match)
{
struct smi_info *info;
Expand Down Expand Up @@ -2576,7 +2576,7 @@ static int __devinit ipmi_of_probe(struct of_device *dev,
return add_smi(info);
}

static int __devexit ipmi_of_remove(struct of_device *dev)
static int __devexit ipmi_of_remove(struct platform_device *dev)
{
cleanup_one_si(dev_get_drvdata(&dev->dev));
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ static int __init rtc_init(void)
#endif
#ifdef CONFIG_SPARC32
struct device_node *ebus_dp;
struct of_device *op;
struct platform_device *op;
#else
void *r;
#ifdef RTC_IRQ
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/xilinx_hwicap/xilinx_hwicap.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ static struct platform_driver hwicap_platform_driver = {

#if defined(CONFIG_OF)
static int __devinit
hwicap_of_probe(struct of_device *op, const struct of_device_id *match)
hwicap_of_probe(struct platform_device *op, const struct of_device_id *match)
{
struct resource res;
const unsigned int *id;
Expand Down Expand Up @@ -798,7 +798,7 @@ hwicap_of_probe(struct of_device *op, const struct of_device_id *match)
regs);
}

static int __devexit hwicap_of_remove(struct of_device *op)
static int __devexit hwicap_of_remove(struct platform_device *op)
{
return hwicap_remove(&op->dev);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/crypto/amcc/crypto4xx_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ struct crypto4xx_alg_common crypto4xx_alg[] = {
/**
* Module Initialization Routine
*/
static int __init crypto4xx_probe(struct of_device *ofdev,
static int __init crypto4xx_probe(struct platform_device *ofdev,
const struct of_device_id *match)
{
int rc;
Expand Down Expand Up @@ -1258,7 +1258,7 @@ static int __init crypto4xx_probe(struct of_device *ofdev,
return rc;
}

static int __exit crypto4xx_remove(struct of_device *ofdev)
static int __exit crypto4xx_remove(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/crypto/amcc/crypto4xx_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct crypto4xx_device {

struct crypto4xx_core_device {
struct device *device;
struct of_device *ofdev;
struct platform_device *ofdev;
struct crypto4xx_device *dev;
u32 int_status;
u32 irq;
Expand Down
Loading

0 comments on commit 2dc1158

Please sign in to comment.