Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: davinci: Use platform_device_register_full() to create pdev for eDMA

Convert the eDMA platform device creation to use
struct platform_device_info XXXXXX __initconst and
platform_device_register_full()
This will allow us to cleanly specify the dma_mask for the devices in an
upcoming patch.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

authored by

Peter Ujfalusi and committed by
Vinod Koul
7ab388e8 b2c843a1

+57 -39
+20 -18
arch/arm/mach-davinci/devices-da8xx.c
··· 213 213 }, 214 214 }; 215 215 216 - static struct platform_device da8xx_edma0_device = { 216 + static const struct platform_device_info da8xx_edma0_device __initconst = { 217 217 .name = "edma", 218 218 .id = 0, 219 - .dev = { 220 - .platform_data = &da8xx_edma0_pdata, 221 - }, 222 - .num_resources = ARRAY_SIZE(da8xx_edma0_resources), 223 - .resource = da8xx_edma0_resources, 219 + .res = da8xx_edma0_resources, 220 + .num_res = ARRAY_SIZE(da8xx_edma0_resources), 221 + .data = &da8xx_edma0_pdata, 222 + .size_data = sizeof(da8xx_edma0_pdata), 224 223 }; 225 224 226 - static struct platform_device da850_edma1_device = { 225 + static const struct platform_device_info da850_edma1_device __initconst = { 227 226 .name = "edma", 228 227 .id = 1, 229 - .dev = { 230 - .platform_data = &da850_edma1_pdata, 231 - }, 232 - .num_resources = ARRAY_SIZE(da850_edma1_resources), 233 - .resource = da850_edma1_resources, 228 + .res = da850_edma1_resources, 229 + .num_res = ARRAY_SIZE(da850_edma1_resources), 230 + .data = &da850_edma1_pdata, 231 + .size_data = sizeof(da850_edma1_pdata), 234 232 }; 235 233 236 234 int __init da830_register_edma(struct edma_rsv_info *rsv) 237 235 { 236 + struct platform_device *edma_pdev; 237 + 238 238 da8xx_edma0_pdata.rsv = rsv; 239 239 240 - return platform_device_register(&da8xx_edma0_device); 240 + edma_pdev = platform_device_register_full(&da8xx_edma0_device); 241 + return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0; 241 242 } 242 243 243 244 int __init da850_register_edma(struct edma_rsv_info *rsv[2]) 244 245 { 245 - int ret; 246 + struct platform_device *edma_pdev; 246 247 247 248 if (rsv) { 248 249 da8xx_edma0_pdata.rsv = rsv[0]; 249 250 da850_edma1_pdata.rsv = rsv[1]; 250 251 } 251 252 252 - ret = platform_device_register(&da8xx_edma0_device); 253 - if (ret) { 253 + edma_pdev = platform_device_register_full(&da8xx_edma0_device); 254 + if (IS_ERR(edma_pdev)) { 254 255 pr_warn("%s: Failed to register eDMA0\n", __func__); 255 - return ret; 256 + return PTR_ERR(edma_pdev); 256 257 } 257 - return platform_device_register(&da850_edma1_device); 258 + edma_pdev = platform_device_register_full(&da850_edma1_device); 259 + return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0; 258 260 } 259 261 260 262 static struct resource da8xx_i2c_resources0[] = {
+13 -7
arch/arm/mach-davinci/dm355.c
··· 613 613 /* not using (or muxing) TC*_ERR */ 614 614 }; 615 615 616 - static struct platform_device dm355_edma_device = { 617 - .name = "edma", 618 - .id = 0, 619 - .dev.platform_data = &dm355_edma_pdata, 620 - .num_resources = ARRAY_SIZE(edma_resources), 621 - .resource = edma_resources, 616 + static const struct platform_device_info dm355_edma_device __initconst = { 617 + .name = "edma", 618 + .id = 0, 619 + .res = edma_resources, 620 + .num_res = ARRAY_SIZE(edma_resources), 621 + .data = &dm355_edma_pdata, 622 + .size_data = sizeof(dm355_edma_pdata), 622 623 }; 623 624 624 625 static struct resource dm355_asp1_resources[] = { ··· 1058 1057 1059 1058 static int __init dm355_init_devices(void) 1060 1059 { 1060 + struct platform_device *edma_pdev; 1061 1061 int ret = 0; 1062 1062 1063 1063 if (!cpu_is_davinci_dm355()) 1064 1064 return 0; 1065 1065 1066 1066 davinci_cfg_reg(DM355_INT_EDMA_CC); 1067 - platform_device_register(&dm355_edma_device); 1067 + edma_pdev = platform_device_register_full(&dm355_edma_device); 1068 + if (IS_ERR(edma_pdev)) { 1069 + pr_warn("%s: Failed to register eDMA\n", __func__); 1070 + return PTR_ERR(edma_pdev); 1071 + } 1068 1072 1069 1073 ret = davinci_init_wdt(); 1070 1074 if (ret)
+13 -7
arch/arm/mach-davinci/dm644x.c
··· 542 542 /* not using TC*_ERR */ 543 543 }; 544 544 545 - static struct platform_device dm644x_edma_device = { 546 - .name = "edma", 547 - .id = 0, 548 - .dev.platform_data = &dm644x_edma_pdata, 549 - .num_resources = ARRAY_SIZE(edma_resources), 550 - .resource = edma_resources, 545 + static const struct platform_device_info dm644x_edma_device __initconst = { 546 + .name = "edma", 547 + .id = 0, 548 + .res = edma_resources, 549 + .num_res = ARRAY_SIZE(edma_resources), 550 + .data = &dm644x_edma_pdata, 551 + .size_data = sizeof(dm644x_edma_pdata), 551 552 }; 552 553 553 554 /* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */ ··· 946 945 947 946 static int __init dm644x_init_devices(void) 948 947 { 948 + struct platform_device *edma_pdev; 949 949 int ret = 0; 950 950 951 951 if (!cpu_is_davinci_dm644x()) 952 952 return 0; 953 953 954 - platform_device_register(&dm644x_edma_device); 954 + edma_pdev = platform_device_register_full(&dm644x_edma_device); 955 + if (IS_ERR(edma_pdev)) { 956 + pr_warn("%s: Failed to register eDMA\n", __func__); 957 + return PTR_ERR(edma_pdev); 958 + } 955 959 956 960 platform_device_register(&dm644x_mdio_device); 957 961 platform_device_register(&dm644x_emac_device);
+11 -7
arch/arm/mach-davinci/dm646x.c
··· 589 589 /* not using TC*_ERR */ 590 590 }; 591 591 592 - static struct platform_device dm646x_edma_device = { 593 - .name = "edma", 594 - .id = 0, 595 - .dev.platform_data = &dm646x_edma_pdata, 596 - .num_resources = ARRAY_SIZE(edma_resources), 597 - .resource = edma_resources, 592 + static const struct platform_device_info dm646x_edma_device __initconst = { 593 + .name = "edma", 594 + .id = 0, 595 + .res = edma_resources, 596 + .num_res = ARRAY_SIZE(edma_resources), 597 + .data = &dm646x_edma_pdata, 598 + .size_data = sizeof(dm646x_edma_pdata), 598 599 }; 599 600 600 601 static struct resource dm646x_mcasp0_resources[] = { ··· 932 931 933 932 int __init dm646x_init_edma(struct edma_rsv_info *rsv) 934 933 { 934 + struct platform_device *edma_pdev; 935 + 935 936 dm646x_edma_pdata.rsv = rsv; 936 937 937 - return platform_device_register(&dm646x_edma_device); 938 + edma_pdev = platform_device_register_full(&dm646x_edma_device); 939 + return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0; 938 940 } 939 941 940 942 void __init dm646x_init(void)