提交 7a5b4e16 编写于 作者: R Russell King

ARM: sa11x0: convert set_xxx_data() to register_xxx()

Only register devices if we have platform data for those which require
platform data.
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 6ec22f9b
......@@ -249,10 +249,10 @@ static void __init assabet_init(void)
#endif
}
sa11x0_set_flash_data(&assabet_flash_data, assabet_flash_resources,
ARRAY_SIZE(assabet_flash_resources));
sa11x0_set_irda_data(&assabet_irda_data);
sa11x0_set_mcp_data(&assabet_mcp_data);
sa11x0_register_mtd(&assabet_flash_data, assabet_flash_resources,
ARRAY_SIZE(assabet_flash_resources));
sa11x0_register_irda(&assabet_irda_data);
sa11x0_register_mcp(&assabet_mcp_data);
}
/*
......
......@@ -212,7 +212,7 @@ static int __init badge4_init(void)
/* maybe turn on 5v0 from the start */
badge4_set_5V(BADGE4_5V_INITIALLY, five_v_on);
sa11x0_set_flash_data(&badge4_flash_data, &badge4_flash_resource, 1);
sa11x0_register_mtd(&badge4_flash_data, &badge4_flash_resource, 1);
return 0;
}
......
......@@ -129,8 +129,8 @@ static struct mcp_plat_data cerf_mcp_data = {
static void __init cerf_init(void)
{
platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
sa11x0_set_flash_data(&cerf_flash_data, &cerf_flash_resource, 1);
sa11x0_set_mcp_data(&cerf_mcp_data);
sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
sa11x0_register_mcp(&cerf_mcp_data);
}
MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
......
......@@ -272,9 +272,9 @@ static void __init collie_init(void)
printk(KERN_WARNING "collie: Unable to register LoCoMo device\n");
}
sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources,
ARRAY_SIZE(collie_flash_resources));
sa11x0_set_mcp_data(&collie_mcp_data);
sa11x0_register_mtd(&collie_flash_data, collie_flash_resources,
ARRAY_SIZE(collie_flash_resources));
sa11x0_register_mcp(&collie_mcp_data);
sharpsl_save_param();
}
......
......@@ -162,6 +162,17 @@ static void sa1100_power_off(void)
PMCR = PMCR_SF;
}
static void sa11x0_register_device(struct platform_device *dev, void *data)
{
int err;
dev->dev.platform_data = data;
err = platform_device_register(dev);
if (err)
printk(KERN_ERR "Unable to register device %s: %d\n",
dev->name, err);
}
static struct resource sa11x0udc_resources[] = {
[0] = {
.start = 0x80000000,
......@@ -234,9 +245,9 @@ static struct platform_device sa11x0mcp_device = {
.resource = sa11x0mcp_resources,
};
void sa11x0_set_mcp_data(struct mcp_plat_data *data)
void sa11x0_register_mcp(struct mcp_plat_data *data)
{
sa11x0mcp_device.dev.platform_data = data;
sa11x0_register_device(&sa11x0mcp_device, data);
}
static struct resource sa11x0ssp_resources[] = {
......@@ -293,13 +304,13 @@ static struct platform_device sa11x0mtd_device = {
.id = -1,
};
void sa11x0_set_flash_data(struct flash_platform_data *flash,
struct resource *res, int nr)
void sa11x0_register_mtd(struct flash_platform_data *flash,
struct resource *res, int nr)
{
flash->name = "sa1100";
sa11x0mtd_device.dev.platform_data = flash;
sa11x0mtd_device.resource = res;
sa11x0mtd_device.num_resources = nr;
sa11x0_register_device(&sa11x0mtd_device, flash);
}
static struct resource sa11x0ir_resources[] = {
......@@ -329,9 +340,9 @@ static struct platform_device sa11x0ir_device = {
.resource = sa11x0ir_resources,
};
void sa11x0_set_irda_data(struct irda_platform_data *irda)
void sa11x0_register_irda(struct irda_platform_data *irda)
{
sa11x0ir_device.dev.platform_data = irda;
sa11x0_register_device(&sa11x0ir_device, irda);
}
static struct platform_device sa11x0rtc_device = {
......@@ -343,21 +354,15 @@ static struct platform_device *sa11x0_devices[] __initdata = {
&sa11x0udc_device,
&sa11x0uart1_device,
&sa11x0uart3_device,
&sa11x0mcp_device,
&sa11x0ssp_device,
&sa11x0pcmcia_device,
&sa11x0fb_device,
&sa11x0mtd_device,
&sa11x0rtc_device,
};
static int __init sa1100_init(void)
{
pm_power_off = sa1100_power_off;
if (sa11x0ir_device.dev.platform_data)
platform_device_register(&sa11x0ir_device);
return platform_add_devices(sa11x0_devices, ARRAY_SIZE(sa11x0_devices));
}
......
......@@ -32,14 +32,11 @@ extern unsigned int sa11x0_ppcr_to_freq(unsigned int idx);
struct flash_platform_data;
struct resource;
extern void sa11x0_set_flash_data(struct flash_platform_data *flash,
struct resource *res, int nr);
struct sa11x0_ssp_plat_ops;
extern void sa11x0_set_ssp_data(struct sa11x0_ssp_plat_ops *ops);
void sa11x0_register_mtd(struct flash_platform_data *flash,
struct resource *res, int nr);
struct irda_platform_data;
void sa11x0_set_irda_data(struct irda_platform_data *irda);
void sa11x0_register_irda(struct irda_platform_data *irda);
struct mcp_plat_data;
void sa11x0_set_mcp_data(struct mcp_plat_data *data);
void sa11x0_register_mcp(struct mcp_plat_data *data);
......@@ -102,8 +102,8 @@ static struct irda_platform_data h3600_irda_data = {
static void h3xxx_mach_init(void)
{
sa11x0_set_flash_data(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
sa11x0_set_irda_data(&h3600_irda_data);
sa11x0_register_mtd(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
sa11x0_register_irda(&h3600_irda_data);
}
/*
......
......@@ -187,7 +187,7 @@ static struct resource hackkit_flash_resource = {
static void __init hackkit_init(void)
{
sa11x0_set_flash_data(&hackkit_flash_data, &hackkit_flash_resource, 1);
sa11x0_register_mtd(&hackkit_flash_data, &hackkit_flash_resource, 1);
}
/**********************************************************************
......
......@@ -354,7 +354,7 @@ static struct resource jornada720_flash_resource = {
static void __init jornada720_mach_init(void)
{
sa11x0_set_flash_data(&jornada720_flash_data, &jornada720_flash_resource, 1);
sa11x0_register_mtd(&jornada720_flash_data, &jornada720_flash_resource, 1);
}
MACHINE_START(JORNADA720, "HP Jornada 720")
......
......@@ -28,7 +28,7 @@ static struct mcp_plat_data lart_mcp_data = {
static void __init lart_init(void)
{
sa11x0_set_mcp_data(&lart_mcp_data);
sa11x0_register_mcp(&lart_mcp_data);
}
static struct map_desc lart_io_desc[] __initdata = {
......
......@@ -109,7 +109,7 @@ static struct flash_platform_data pleb_flash_data = {
static void __init pleb_init(void)
{
sa11x0_set_flash_data(&pleb_flash_data, pleb_flash_resources,
sa11x0_register_mtd(&pleb_flash_data, pleb_flash_resources,
ARRAY_SIZE(pleb_flash_resources));
......
......@@ -59,8 +59,8 @@ static struct mcp_plat_data shannon_mcp_data = {
static void __init shannon_init(void)
{
sa11x0_set_flash_data(&shannon_flash_data, &shannon_flash_resource, 1);
sa11x0_set_mcp_data(&shannon_mcp_data);
sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1);
sa11x0_register_mcp(&shannon_mcp_data);
}
static void __init shannon_map_io(void)
......
......@@ -166,9 +166,9 @@ static void __init simpad_map_io(void)
PCFR = 0;
PSDR = 0;
sa11x0_set_flash_data(&simpad_flash_data, simpad_flash_resources,
sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
ARRAY_SIZE(simpad_flash_resources));
sa11x0_set_mcp_data(&simpad_mcp_data);
sa11x0_register_mcp(&simpad_mcp_data);
}
static void simpad_power_off(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册