From 41575d8e4c334df148c4cdd7c40cc825dc0fcaa1 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 3 Dec 2020 16:55:17 -0700 Subject: dm: treewide: Rename auto_alloc_size members to be shorter This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass --- drivers/gpio/imx_rgpio2p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpio/imx_rgpio2p.c') diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c index 1e876f69147..2a09975b6e4 100644 --- a/drivers/gpio/imx_rgpio2p.c +++ b/drivers/gpio/imx_rgpio2p.c @@ -200,7 +200,7 @@ U_BOOT_DRIVER(imx_rgpio2p) = { .id = UCLASS_GPIO, .ops = &imx_rgpio2p_ops, .probe = imx_rgpio2p_probe, - .priv_auto_alloc_size = sizeof(struct imx_rgpio2p_plat), + .priv_auto = sizeof(struct imx_rgpio2p_plat), .of_match = imx_rgpio2p_ids, .bind = imx_rgpio2p_bind, }; -- cgit v1.2.3 From caa4daa2ae3dc0a3e516addea5772c9af76abcb0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 3 Dec 2020 16:55:18 -0700 Subject: dm: treewide: Rename 'platdata' variables to just 'plat' We use 'priv' for private data but often use 'platdata' for platform data. We can't really use 'pdata' since that is ambiguous (it could mean private or platform data). Rename some of the latter variables to end with 'plat' for consistency. Signed-off-by: Simon Glass --- drivers/gpio/imx_rgpio2p.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/gpio/imx_rgpio2p.c') diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c index 2a09975b6e4..80e934eb0d2 100644 --- a/drivers/gpio/imx_rgpio2p.c +++ b/drivers/gpio/imx_rgpio2p.c @@ -151,12 +151,12 @@ static int imx_rgpio2p_probe(struct udevice *dev) static int imx_rgpio2p_bind(struct udevice *dev) { - struct imx_rgpio2p_plat *plat = dev->platdata; + struct imx_rgpio2p_plat *plat = dev->plat; fdt_addr_t addr; /* - * If platdata already exsits, directly return. - * Actually only when DT is not supported, platdata + * If plat already exsits, directly return. + * Actually only when DT is not supported, plat * is statically initialized in U_BOOT_DEVICES.Here * will return. */ @@ -171,7 +171,7 @@ static int imx_rgpio2p_bind(struct udevice *dev) * TODO: * When every board is converted to driver model and DT is supported, * this can be done by auto-alloc feature, but not using calloc - * to alloc memory for platdata. + * to alloc memory for plat. * * For example imx_rgpio2p_plat uses platform data rather than device * tree. @@ -184,7 +184,7 @@ static int imx_rgpio2p_bind(struct udevice *dev) plat->regs = (struct gpio_regs *)addr; plat->bank_index = dev->req_seq; - dev->platdata = plat; + dev->plat = plat; return 0; } -- cgit v1.2.3 From c69cda25c9b59e53a6bc8969ada58942549f5b5d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 3 Dec 2020 16:55:20 -0700 Subject: dm: treewide: Rename dev_get_platdata() to dev_get_plat() Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass --- drivers/gpio/imx_rgpio2p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpio/imx_rgpio2p.c') diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c index 80e934eb0d2..70ced75ea72 100644 --- a/drivers/gpio/imx_rgpio2p.c +++ b/drivers/gpio/imx_rgpio2p.c @@ -132,7 +132,7 @@ static const struct dm_gpio_ops imx_rgpio2p_ops = { static int imx_rgpio2p_probe(struct udevice *dev) { struct imx_rgpio2p_data *bank = dev_get_priv(dev); - struct imx_rgpio2p_plat *plat = dev_get_platdata(dev); + struct imx_rgpio2p_plat *plat = dev_get_plat(dev); struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); int banknum; char name[18], *str; -- cgit v1.2.3 From fb0ea6a710308e90d550ce87c1f249732a780e62 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 16 Dec 2020 21:20:24 -0700 Subject: gpio: Update for new sequence numbers Use the dev_seq() sequence number in all cases. Signed-off-by: Simon Glass --- drivers/gpio/imx_rgpio2p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpio/imx_rgpio2p.c') diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c index 70ced75ea72..17edd40c5c5 100644 --- a/drivers/gpio/imx_rgpio2p.c +++ b/drivers/gpio/imx_rgpio2p.c @@ -183,7 +183,7 @@ static int imx_rgpio2p_bind(struct udevice *dev) return -ENOMEM; plat->regs = (struct gpio_regs *)addr; - plat->bank_index = dev->req_seq; + plat->bank_index = dev_seq(dev); dev->plat = plat; return 0; -- cgit v1.2.3 From 0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 22 Dec 2020 19:30:28 -0700 Subject: dm: Use access methods for dev/uclass private data Most drivers use these access methods but a few do not. Update them. In some cases the access is not permitted, so mark those with a FIXME tag for the maintainer to check. Signed-off-by: Simon Glass Acked-by: Andy Shevchenko Acked-by: Pratyush Yadav --- drivers/gpio/imx_rgpio2p.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/gpio/imx_rgpio2p.c') diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c index 17edd40c5c5..a5a290a00ce 100644 --- a/drivers/gpio/imx_rgpio2p.c +++ b/drivers/gpio/imx_rgpio2p.c @@ -11,6 +11,7 @@ #include #include #include +#include #include enum imx_rgpio2p_direction { @@ -151,7 +152,7 @@ static int imx_rgpio2p_probe(struct udevice *dev) static int imx_rgpio2p_bind(struct udevice *dev) { - struct imx_rgpio2p_plat *plat = dev->plat; + struct imx_rgpio2p_plat *plat = dev_get_plat(dev); fdt_addr_t addr; /* @@ -184,7 +185,7 @@ static int imx_rgpio2p_bind(struct udevice *dev) plat->regs = (struct gpio_regs *)addr; plat->bank_index = dev_seq(dev); - dev->plat = plat; + dev_set_plat(dev, plat); return 0; } -- cgit v1.2.3 From 20e442ab2df355450006574fff178c746d254a18 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 28 Dec 2020 20:34:54 -0700 Subject: dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO() The current macro is a misnomer since it does not declare a device directly. Instead, it declares driver_info record which U-Boot uses at runtime to create a device. The distinction seems somewhat minor most of the time, but is becomes quite confusing when we actually want to declare a device, with of-platdata. We are left trying to distinguish between a device which isn't actually device, and a device that is (perhaps an 'instance'?) It seems better to rename this macro to describe what it actually is. The macros is not widely used, since boards should use devicetree to declare devices. Rename it to U_BOOT_DRVINFO(), which indicates clearly that this is declaring a new driver_info record, not a device. Signed-off-by: Simon Glass --- drivers/gpio/imx_rgpio2p.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/gpio/imx_rgpio2p.c') diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c index a5a290a00ce..0e2874ca95c 100644 --- a/drivers/gpio/imx_rgpio2p.c +++ b/drivers/gpio/imx_rgpio2p.c @@ -158,7 +158,7 @@ static int imx_rgpio2p_bind(struct udevice *dev) /* * If plat already exsits, directly return. * Actually only when DT is not supported, plat - * is statically initialized in U_BOOT_DEVICES.Here + * is statically initialized in U_BOOT_DRVINFOS.Here * will return. */ if (plat) @@ -216,7 +216,7 @@ static const struct imx_rgpio2p_plat imx_plat[] = { { 5, (struct gpio_regs *)RGPIO2P_GPIO6_BASE_ADDR }, }; -U_BOOT_DEVICES(imx_rgpio2ps) = { +U_BOOT_DRVINFOS(imx_rgpio2ps) = { { "imx_rgpio2p", &imx_plat[0] }, { "imx_rgpio2p", &imx_plat[1] }, { "imx_rgpio2p", &imx_plat[2] }, -- cgit v1.2.3