On Mon, Nov 28, 2005 at 08:00:11PM +0300, Vitaly Bordug wrote: > Added proper ppc_sys identification and fs_platform_info's for MPC 885ADS, > 866ADS and 8272ADS. Assuming setbitsXX/clrbitsXX patch is applied. > > > Signed-off-by: Vitaly Bordug <vbordug at ru.mvista.com>
diff --git a/arch/ppc/platforms/mpc8272ads_setup.c b/arch/ppc/platforms/mpc8272ads_setup.c new file mode 100644 index 0000000..4f76b1b --- /dev/null +++ b/arch/ppc/platforms/mpc8272ads_setup.c @@ -0,0 +1,253 @@ +/* + * arch/ppc/platforms/82xx/pq2ads_pd.c + * + * MPC82xx Board-specific PlatformDevice descriptions + * + * 2005 (c) MontaVista Software, Inc. + * Vitaly Bordug <vbordug at ru.mvista.com> + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ <snip> +static int __init mpc8272ads_platform_notify(struct device *dev) +{ + static struct { + const char *bus_id; + void (*rtn) (struct platform_device * pdev, int idx); + } dev_map[] = { + {"fsl-cpm-fcc", mpc8272ads_fixup_enet_pdata}, + }; + struct platform_device *pdev; + int i, j, idx; + const char *s; + if (dev && dev->bus_id) + for (i = 0; i < ARRAY_SIZE(dev_map); i++) { + idx = -1; + + if ((s = strrchr(dev->bus_id, '.')) != NULL) + idx = (int)simple_strtol(s + 1, NULL, 10); + else + s = dev->bus_id; + j = s - dev->bus_id; + if (!strncmp(dev->bus_id, dev_map[i].bus_id, j)) { + pdev = + container_of(dev, struct platform_device, + dev); + dev_map[i].rtn(pdev, idx); + } + } + return 0; +} Seems this loop is common to all boards and should be moved to a helper function?