* [PATCH 1/3] i2c: davinci: Use platform table macro over module_alias
@ 2023-03-07 17:30 Andrew Davis
2023-03-07 17:30 ` [PATCH 2/3] i2c: davinci: Use struct name not type with devm_kzalloc() Andrew Davis
2023-03-07 17:30 ` [PATCH 3/3] i2c: davinci: Do not check for IRQ number 0 Andrew Davis
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Davis @ 2023-03-07 17:30 UTC (permalink / raw)
To: Wolfram Sang, Bartosz Golaszewski
Cc: linux-arm-kernel, linux-i2c, linux-kernel, Andrew Davis
Generates the same platform module alias. More standard usage.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/i2c/busses/i2c-davinci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index c836cf884185..abea1d86035c 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -943,12 +943,16 @@ static const struct dev_pm_ops davinci_i2c_pm = {
#define davinci_i2c_pm_ops NULL
#endif
-/* work with hotplug and coldplug */
-MODULE_ALIAS("platform:i2c_davinci");
+static const struct platform_device_id davinci_i2c_driver_ids[] = {
+ { .name = "i2c_davinci", },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, davinci_i2c_driver_ids);
static struct platform_driver davinci_i2c_driver = {
.probe = davinci_i2c_probe,
.remove = davinci_i2c_remove,
+ .id_table = davinci_i2c_driver_ids,
.driver = {
.name = "i2c_davinci",
.pm = davinci_i2c_pm_ops,
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] i2c: davinci: Use struct name not type with devm_kzalloc()
2023-03-07 17:30 [PATCH 1/3] i2c: davinci: Use platform table macro over module_alias Andrew Davis
@ 2023-03-07 17:30 ` Andrew Davis
2023-03-07 17:30 ` [PATCH 3/3] i2c: davinci: Do not check for IRQ number 0 Andrew Davis
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Davis @ 2023-03-07 17:30 UTC (permalink / raw)
To: Wolfram Sang, Bartosz Golaszewski
Cc: linux-arm-kernel, linux-i2c, linux-kernel, Andrew Davis
This reduces chance of error if the type of "dev" changes. While here
remove extra error print out, this is not usually done for memory
allocation failures.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/i2c/busses/i2c-davinci.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index abea1d86035c..4a8e7728ee29 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -770,12 +770,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n");
}
- dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev),
- GFP_KERNEL);
- if (!dev) {
- dev_err(&pdev->dev, "Memory allocation failed\n");
+ dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
+ if (!dev)
return -ENOMEM;
- }
init_completion(&dev->cmd_complete);
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] i2c: davinci: Do not check for IRQ number 0
2023-03-07 17:30 [PATCH 1/3] i2c: davinci: Use platform table macro over module_alias Andrew Davis
2023-03-07 17:30 ` [PATCH 2/3] i2c: davinci: Use struct name not type with devm_kzalloc() Andrew Davis
@ 2023-03-07 17:30 ` Andrew Davis
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Davis @ 2023-03-07 17:30 UTC (permalink / raw)
To: Wolfram Sang, Bartosz Golaszewski
Cc: linux-arm-kernel, linux-i2c, linux-kernel, Andrew Davis
This is not a valid IRQ number and will not be returned, no need
to check for this.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/i2c/busses/i2c-davinci.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 4a8e7728ee29..135f76593e6f 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -764,11 +764,8 @@ static int davinci_i2c_probe(struct platform_device *pdev)
int r, irq;
irq = platform_get_irq(pdev, 0);
- if (irq <= 0) {
- if (!irq)
- irq = -ENXIO;
+ if (irq < 0)
return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n");
- }
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev)
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-07 17:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-07 17:30 [PATCH 1/3] i2c: davinci: Use platform table macro over module_alias Andrew Davis
2023-03-07 17:30 ` [PATCH 2/3] i2c: davinci: Use struct name not type with devm_kzalloc() Andrew Davis
2023-03-07 17:30 ` [PATCH 3/3] i2c: davinci: Do not check for IRQ number 0 Andrew Davis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).