Skip to content

Commit

Permalink
of: Remove duplicate fields from of_platform_driver
Browse files Browse the repository at this point in the history
.name, .match_table and .owner are duplicated in both of_platform_driver
and device_driver.  This patch is a removes the extra copies from struct
of_platform_driver and converts all users to the device_driver members.

This patch is a pretty mechanical change.  The usage model doesn't change
and if any drivers have been missed, or if anything has been fixed up
incorrectly, then it will fail with a compile time error, and the fixup
will be trivial.  This patch looks big and scary because it touches so
many files, but it should be pretty safe.

Signed-off-by: Grant Likely <[email protected]>
Acked-by: Sean MacLennan <[email protected]>
  • Loading branch information
glikely committed May 22, 2010
1 parent 597b9d1 commit 4018294
Show file tree
Hide file tree
Showing 146 changed files with 671 additions and 387 deletions.
3 changes: 0 additions & 3 deletions arch/powerpc/kernel/ibmebus.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ static int ibmebus_create_devices(const struct of_device_id *matches)

int ibmebus_register_driver(struct of_platform_driver *drv)
{
if (!drv->driver.of_match_table)
drv->driver.of_match_table = drv->match_table;

/* If the driver uses devices that ibmebus doesn't know, add them */
ibmebus_create_devices(drv->driver.of_match_table);

Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/kernel/of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,11 @@ static struct of_device_id of_pci_phb_ids[] = {
};

static struct of_platform_driver of_pci_phb_driver = {
.match_table = of_pci_phb_ids,
.probe = of_pci_phb_probe,
.driver = {
.name = "of-pci",
.owner = THIS_MODULE,
.of_match_table = of_pci_phb_ids,
},
};

Expand Down
14 changes: 10 additions & 4 deletions arch/powerpc/platforms/52xx/mpc52xx_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,11 @@ static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {
};

static struct of_platform_driver mpc52xx_wkup_gpiochip_driver = {
.name = "gpio_wkup",
.match_table = mpc52xx_wkup_gpiochip_match,
.driver = {
.name = "gpio_wkup",
.owner = THIS_MODULE,
.of_match_table = mpc52xx_wkup_gpiochip_match,
},
.probe = mpc52xx_wkup_gpiochip_probe,
.remove = mpc52xx_gpiochip_remove,
};
Expand Down Expand Up @@ -349,8 +352,11 @@ static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {
};

static struct of_platform_driver mpc52xx_simple_gpiochip_driver = {
.name = "gpio",
.match_table = mpc52xx_simple_gpiochip_match,
.driver = {
.name = "gpio",
.owner = THIS_MODULE,
.of_match_table = mpc52xx_simple_gpiochip_match,
},
.probe = mpc52xx_simple_gpiochip_probe,
.remove = mpc52xx_gpiochip_remove,
};
Expand Down
7 changes: 5 additions & 2 deletions arch/powerpc/platforms/52xx/mpc52xx_gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,11 @@ static const struct of_device_id mpc52xx_gpt_match[] = {
};

static struct of_platform_driver mpc52xx_gpt_driver = {
.name = "mpc52xx-gpt",
.match_table = mpc52xx_gpt_match,
.driver = {
.name = "mpc52xx-gpt",
.owner = THIS_MODULE,
.of_match_table = mpc52xx_gpt_match,
},
.probe = mpc52xx_gpt_probe,
.remove = mpc52xx_gpt_remove,
};
Expand Down
8 changes: 5 additions & 3 deletions arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,11 @@ static struct of_device_id mpc52xx_lpbfifo_match[] __devinitconst = {
};

static struct of_platform_driver mpc52xx_lpbfifo_driver = {
.owner = THIS_MODULE,
.name = "mpc52xx-lpbfifo",
.match_table = mpc52xx_lpbfifo_match,
.driver = {
.name = "mpc52xx-lpbfifo",
.owner = THIS_MODULE,
.of_match_table = mpc52xx_lpbfifo_match,
},
.probe = mpc52xx_lpbfifo_probe,
.remove = __devexit_p(mpc52xx_lpbfifo_remove),
};
Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/platforms/82xx/ep8248e.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ static const struct of_device_id ep8248e_mdio_match[] = {
static struct of_platform_driver ep8248e_mdio_driver = {
.driver = {
.name = "ep8248e-mdio-bitbang",
.owner = THIS_MODULE,
.of_match_table = ep8248e_mdio_match,
},
.match_table = ep8248e_mdio_match,
.probe = ep8248e_mdio_probe,
.remove = ep8248e_mdio_remove,
};
Expand Down
7 changes: 5 additions & 2 deletions arch/powerpc/platforms/83xx/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,11 @@ static struct of_device_id pmc_match[] = {
};

static struct of_platform_driver pmc_driver = {
.name = "mpc83xx-pmc",
.match_table = pmc_match,
.driver = {
.name = "mpc83xx-pmc",
.owner = THIS_MODULE,
.of_match_table = pmc_match,
},
.probe = pmc_probe,
.remove = pmc_remove
};
Expand Down
7 changes: 4 additions & 3 deletions arch/powerpc/platforms/cell/axon_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,12 @@ static const struct of_device_id axon_msi_device_id[] = {
};

static struct of_platform_driver axon_msi_driver = {
.match_table = axon_msi_device_id,
.probe = axon_msi_probe,
.shutdown = axon_msi_shutdown,
.driver = {
.name = "axon-msi"
.driver = {
.name = "axon-msi",
.owner = THIS_MODULE,
.of_match_table = axon_msi_device_id,
},
};

Expand Down
7 changes: 4 additions & 3 deletions arch/powerpc/platforms/pasemi/gpio_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,12 @@ MODULE_DEVICE_TABLE(of, gpio_mdio_match);

static struct of_platform_driver gpio_mdio_driver =
{
.match_table = gpio_mdio_match,
.probe = gpio_mdio_probe,
.remove = gpio_mdio_remove,
.driver = {
.name = "gpio-mdio-bitbang",
.driver = {
.name = "gpio-mdio-bitbang",
.owner = THIS_MODULE,
.of_match_table = gpio_mdio_match,
},
};

Expand Down
8 changes: 4 additions & 4 deletions arch/powerpc/sysdev/axonram.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,12 @@ static struct of_device_id axon_ram_device_id[] = {
};

static struct of_platform_driver axon_ram_driver = {
.match_table = axon_ram_device_id,
.probe = axon_ram_probe,
.remove = axon_ram_remove,
.driver = {
.owner = THIS_MODULE,
.name = AXON_RAM_MODULE_NAME,
.driver = {
.name = AXON_RAM_MODULE_NAME,
.owner = THIS_MODULE,
.of_match_table = axon_ram_device_id,
},
};

Expand Down
10 changes: 4 additions & 6 deletions arch/powerpc/sysdev/bestcomm/bestcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,14 +494,12 @@ MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match);


static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
.owner = THIS_MODULE,
.name = DRIVER_NAME,
.match_table = mpc52xx_bcom_of_match,
.probe = mpc52xx_bcom_probe,
.remove = mpc52xx_bcom_remove,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = mpc52xx_bcom_of_match,
},
};

Expand Down
7 changes: 5 additions & 2 deletions arch/powerpc/sysdev/fsl_msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,11 @@ static const struct of_device_id fsl_of_msi_ids[] = {
};

static struct of_platform_driver fsl_of_msi_driver = {
.name = "fsl-msi",
.match_table = fsl_of_msi_ids,
.driver = {
.name = "fsl-msi",
.owner = THIS_MODULE,
.of_match_table = fsl_of_msi_ids,
},
.probe = fsl_of_msi_probe,
};

Expand Down
7 changes: 5 additions & 2 deletions arch/powerpc/sysdev/fsl_pmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ static const struct of_device_id pmc_ids[] = {
};

static struct of_platform_driver pmc_driver = {
.driver.name = "fsl-pmc",
.match_table = pmc_ids,
.driver = {
.name = "fsl-pmc",
.owner = THIS_MODULE,
.of_match_table = pmc_ids,
},
.probe = pmc_probe,
};

Expand Down
7 changes: 5 additions & 2 deletions arch/powerpc/sysdev/fsl_rio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,8 +1215,11 @@ static const struct of_device_id fsl_of_rio_rpn_ids[] = {
};

static struct of_platform_driver fsl_of_rio_rpn_driver = {
.name = "fsl-of-rio",
.match_table = fsl_of_rio_rpn_ids,
.driver = {
.name = "fsl-of-rio",
.owner = THIS_MODULE,
.of_match_table = fsl_of_rio_rpn_ids,
},
.probe = fsl_of_rio_rpn_probe,
};

Expand Down
7 changes: 4 additions & 3 deletions arch/powerpc/sysdev/pmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,12 @@ static int pmi_of_remove(struct of_device *dev)
}

static struct of_platform_driver pmi_of_platform_driver = {
.match_table = pmi_match,
.probe = pmi_of_probe,
.remove = pmi_of_remove,
.driver = {
.name = "pmi",
.driver = {
.name = "pmi",
.owner = THIS_MODULE,
.of_match_table = pmi_match,
},
};

Expand Down
7 changes: 5 additions & 2 deletions arch/powerpc/sysdev/qe_lib/qe.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,11 @@ static const struct of_device_id qe_ids[] = {
};

static struct of_platform_driver qe_driver = {
.driver.name = "fsl-qe",
.match_table = qe_ids,
.driver = {
.name = "fsl-qe",
.owner = THIS_MODULE,
.of_match_table = qe_ids,
},
.probe = qe_probe,
.resume = qe_resume,
};
Expand Down
7 changes: 5 additions & 2 deletions arch/sparc/include/asm/parport.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,11 @@ static const struct of_device_id ecpp_match[] = {
};

static struct of_platform_driver ecpp_driver = {
.name = "ecpp",
.match_table = ecpp_match,
.driver = {
.name = "ecpp",
.owner = THIS_MODULE,
.of_match_table = ecpp_match,
},
.probe = ecpp_probe,
.remove = __devexit_p(ecpp_remove),
};
Expand Down
7 changes: 5 additions & 2 deletions arch/sparc/kernel/apc.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ static struct of_device_id __initdata apc_match[] = {
MODULE_DEVICE_TABLE(of, apc_match);

static struct of_platform_driver apc_driver = {
.name = "apc",
.match_table = apc_match,
.driver = {
.name = "apc",
.owner = THIS_MODULE,
.of_match_table = apc_match,
},
.probe = apc_probe,
};

Expand Down
7 changes: 4 additions & 3 deletions arch/sparc/kernel/auxio_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ static int __devinit auxio_probe(struct of_device *dev, const struct of_device_i
}

static struct of_platform_driver auxio_driver = {
.match_table = auxio_match,
.probe = auxio_probe,
.driver = {
.name = "auxio",
.driver = {
.name = "auxio",
.owner = THIS_MODULE,
.of_match_table = auxio_match,
},
};

Expand Down
14 changes: 8 additions & 6 deletions arch/sparc/kernel/central.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,11 @@ static struct of_device_id __initdata clock_board_match[] = {
};

static struct of_platform_driver clock_board_driver = {
.match_table = clock_board_match,
.probe = clock_board_probe,
.driver = {
.name = "clock_board",
.driver = {
.name = "clock_board",
.owner = THIS_MODULE,
.of_match_table = clock_board_match,
},
};

Expand Down Expand Up @@ -254,10 +255,11 @@ static struct of_device_id __initdata fhc_match[] = {
};

static struct of_platform_driver fhc_driver = {
.match_table = fhc_match,
.probe = fhc_probe,
.driver = {
.name = "fhc",
.driver = {
.name = "fhc",
.owner = THIS_MODULE,
.of_match_table = fhc_match,
},
};

Expand Down
7 changes: 5 additions & 2 deletions arch/sparc/kernel/chmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,11 @@ static const struct of_device_id us3mc_match[] = {
MODULE_DEVICE_TABLE(of, us3mc_match);

static struct of_platform_driver us3mc_driver = {
.name = "us3mc",
.match_table = us3mc_match,
.driver = {
.name = "us3mc",
.owner = THIS_MODULE,
.of_match_table = us3mc_match,
},
.probe = us3mc_probe,
.remove = __devexit_p(us3mc_remove),
};
Expand Down
7 changes: 5 additions & 2 deletions arch/sparc/kernel/pci_fire.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,11 @@ static struct of_device_id __initdata fire_match[] = {
};

static struct of_platform_driver fire_driver = {
.name = DRIVER_NAME,
.match_table = fire_match,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = fire_match,
},
.probe = fire_probe,
};

Expand Down
7 changes: 5 additions & 2 deletions arch/sparc/kernel/pci_psycho.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,11 @@ static struct of_device_id __initdata psycho_match[] = {
};

static struct of_platform_driver psycho_driver = {
.name = DRIVER_NAME,
.match_table = psycho_match,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = psycho_match,
},
.probe = psycho_probe,
};

Expand Down
7 changes: 5 additions & 2 deletions arch/sparc/kernel/pci_sabre.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,11 @@ static struct of_device_id __initdata sabre_match[] = {
};

static struct of_platform_driver sabre_driver = {
.name = DRIVER_NAME,
.match_table = sabre_match,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = sabre_match,
},
.probe = sabre_probe,
};

Expand Down
7 changes: 5 additions & 2 deletions arch/sparc/kernel/pci_schizo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1491,8 +1491,11 @@ static struct of_device_id __initdata schizo_match[] = {
};

static struct of_platform_driver schizo_driver = {
.name = DRIVER_NAME,
.match_table = schizo_match,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = schizo_match,
},
.probe = schizo_probe,
};

Expand Down
Loading

0 comments on commit 4018294

Please sign in to comment.