Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a5b4e16 authored by Russell King's avatar Russell King
Browse files

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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 6ec22f9b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -249,10 +249,10 @@ static void __init assabet_init(void)
#endif
	}

	sa11x0_set_flash_data(&assabet_flash_data, assabet_flash_resources,
	sa11x0_register_mtd(&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_irda(&assabet_irda_data);
	sa11x0_register_mcp(&assabet_mcp_data);
}

/*
+1 −1
Original line number Diff line number Diff line
@@ -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;
}
+2 −2
Original line number Diff line number Diff line
@@ -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")
+3 −3
Original line number Diff line number Diff line
@@ -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,
	sa11x0_register_mtd(&collie_flash_data, collie_flash_resources,
			    ARRAY_SIZE(collie_flash_resources));
	sa11x0_set_mcp_data(&collie_mcp_data);
	sa11x0_register_mcp(&collie_mcp_data);

	sharpsl_save_param();
}
+18 −13
Original line number Diff line number Diff line
@@ -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,
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));
}

Loading