Skip to content

Commit 7ab388e

Browse files
Peter UjfalusiVinod Koul
authored andcommitted
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 <[email protected]> Acked-by: Sekhar Nori <[email protected]> Signed-off-by: Vinod Koul <[email protected]>
1 parent b2c843a commit 7ab388e

File tree

4 files changed

+57
-39
lines changed

4 files changed

+57
-39
lines changed

arch/arm/mach-davinci/devices-da8xx.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,48 +213,50 @@ static struct resource da850_edma1_resources[] = {
213213
},
214214
};
215215

216-
static struct platform_device da8xx_edma0_device = {
216+
static const struct platform_device_info da8xx_edma0_device __initconst = {
217217
.name = "edma",
218218
.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),
224223
};
225224

226-
static struct platform_device da850_edma1_device = {
225+
static const struct platform_device_info da850_edma1_device __initconst = {
227226
.name = "edma",
228227
.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),
234232
};
235233

236234
int __init da830_register_edma(struct edma_rsv_info *rsv)
237235
{
236+
struct platform_device *edma_pdev;
237+
238238
da8xx_edma0_pdata.rsv = rsv;
239239

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;
241242
}
242243

243244
int __init da850_register_edma(struct edma_rsv_info *rsv[2])
244245
{
245-
int ret;
246+
struct platform_device *edma_pdev;
246247

247248
if (rsv) {
248249
da8xx_edma0_pdata.rsv = rsv[0];
249250
da850_edma1_pdata.rsv = rsv[1];
250251
}
251252

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)) {
254255
pr_warn("%s: Failed to register eDMA0\n", __func__);
255-
return ret;
256+
return PTR_ERR(edma_pdev);
256257
}
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;
258260
}
259261

260262
static struct resource da8xx_i2c_resources0[] = {

arch/arm/mach-davinci/dm355.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -613,12 +613,13 @@ static struct resource edma_resources[] = {
613613
/* not using (or muxing) TC*_ERR */
614614
};
615615

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),
622623
};
623624

624625
static struct resource dm355_asp1_resources[] = {
@@ -1057,13 +1058,18 @@ int __init dm355_init_video(struct vpfe_config *vpfe_cfg,
10571058

10581059
static int __init dm355_init_devices(void)
10591060
{
1061+
struct platform_device *edma_pdev;
10601062
int ret = 0;
10611063

10621064
if (!cpu_is_davinci_dm355())
10631065
return 0;
10641066

10651067
davinci_cfg_reg(DM355_INT_EDMA_CC);
1066-
platform_device_register(&dm355_edma_device);
1068+
edma_pdev = platform_device_register_full(&dm355_edma_device);
1069+
if (IS_ERR(edma_pdev)) {
1070+
pr_warn("%s: Failed to register eDMA\n", __func__);
1071+
return PTR_ERR(edma_pdev);
1072+
}
10671073

10681074
ret = davinci_init_wdt();
10691075
if (ret)

arch/arm/mach-davinci/dm644x.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,13 @@ static struct resource edma_resources[] = {
542542
/* not using TC*_ERR */
543543
};
544544

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),
551552
};
552553

553554
/* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */
@@ -945,12 +946,17 @@ int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
945946

946947
static int __init dm644x_init_devices(void)
947948
{
949+
struct platform_device *edma_pdev;
948950
int ret = 0;
949951

950952
if (!cpu_is_davinci_dm644x())
951953
return 0;
952954

953-
platform_device_register(&dm644x_edma_device);
955+
edma_pdev = platform_device_register_full(&dm644x_edma_device);
956+
if (IS_ERR(edma_pdev)) {
957+
pr_warn("%s: Failed to register eDMA\n", __func__);
958+
return PTR_ERR(edma_pdev);
959+
}
954960

955961
platform_device_register(&dm644x_mdio_device);
956962
platform_device_register(&dm644x_emac_device);

arch/arm/mach-davinci/dm646x.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -589,12 +589,13 @@ static struct resource edma_resources[] = {
589589
/* not using TC*_ERR */
590590
};
591591

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),
598599
};
599600

600601
static struct resource dm646x_mcasp0_resources[] = {
@@ -931,9 +932,12 @@ void dm646x_setup_vpif(struct vpif_display_config *display_config,
931932

932933
int __init dm646x_init_edma(struct edma_rsv_info *rsv)
933934
{
935+
struct platform_device *edma_pdev;
936+
934937
dm646x_edma_pdata.rsv = rsv;
935938

936-
return platform_device_register(&dm646x_edma_device);
939+
edma_pdev = platform_device_register_full(&dm646x_edma_device);
940+
return IS_ERR(edma_pdev) ? PTR_ERR(edma_pdev) : 0;
937941
}
938942

939943
void __init dm646x_init(void)

0 commit comments

Comments
 (0)