i2c: davinci: Use platform table macro over module_alias
PATCH v2 1/2 i2c: davinci: Use platform table macro over module_alias
Generates the same platform module alias. More standard usage.
--- drivers/i2c/busses/i2c-davinci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-davinci.c +6 -2
@@ -940,12 +940,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,
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 2/2 i2c: davinci: Use struct name not type with devm_kzalloc()
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.
--- drivers/i2c/busses/i2c-davinci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-davinci.c +2 -5
@@ -767,12 +767,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)if (irq <0 )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);
Signature · 7 lines
2.39.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
Quoted 30 lines · 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 <[email protected]>--- drivers/i2c/busses/i2c-davinci.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/i2c/busses/i2c-davinci.c +2
-6@@ -767,12 +767,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)if (irq <0 )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); --
Quoted 2 lines
2.39.2
Wolfram Sang
AppliedRe: [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
In reply to Andrew DavisQuoted 5 lines · 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 <[email protected]>
Applied to for-next, thanks!
Re: [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
In reply to Andrew DavisQuoted 3 lines
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.
https://lore.kernel.org/linux-i2c/[email protected]/
http://patchwork.ozlabs.org/project/linux-i2c/patch/[email protected]/
I find that this change approach does not fit to the known requirement “Solve only one problem per patch.”.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4-rc5#n81
Should desirable changes be split into better update steps?
See also:
[PATCH 0/2] I2C-DaVinci: Adjustments for davinci_i2c_probe()
https://lore.kernel.org/linux-i2c/[email protected]/
https://lkml.org/lkml/2018/2/2/541
* [1/2] i2c-davinci: Delete an error message for a failed memory allocation in davinci_i2c_probe()
https://patchwork.ozlabs.org/project/linux-i2c/patch/[email protected]/
* [2/2] i2c-davinci: Improve a size determination in davinci_i2c_probe()
https://patchwork.ozlabs.org/project/linux-i2c/patch/[email protected]/
Regards,
Markus
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
Quoted 2 lines
Should desirable changes be split into better update steps?
It is done. It has already been applied.
Re: [v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
Quoted 3 lines
Quoted 1 line
Should desirable changes be split into better update steps?
It is done. It has already been applied.
Will the patch review attention grow anyhow for affected aspects?
Regards,
Markus
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
Quoted 2 lines
Will the patch review attention grow anyhow for affected aspects?
What are "affected aspects" in this case?
Re: [v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
Quoted 3 lines
Quoted 1 line
Will the patch review attention grow anyhow for affected aspects?
What are "affected aspects" in this case?
Example:
Linux patch requirements and corresponding coding style variations
Regards,
Markus
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 32 lines · Andrew Davis
Generates the same platform module alias. More standard usage.
Signed-off-by Andrew Davis <[email protected]>--- drivers/i2c/busses/i2c-davinci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-davinci.c +6
-3@@ -940,12 +940,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, --
Quoted 2 lines
2.39.2
Hi Andrew,
Quoted 3 lines · Andrew Davis
Generates the same platform module alias. More standard usage.
Signed-off-by Andrew Davis <[email protected]>
Could you kindly rebase this to my i2c/for-mergewindow branch? It seems it conflicts with the "callback returning void" conversion.
Thanks,
Wolfram
Quoted 9 lines · Wolfram Sang
Hi Andrew,
Quoted 3 lines · Andrew Davis
Generates the same platform module alias. More standard usage.
Signed-off-by Andrew Davis <[email protected]>Could you kindly rebase this to my i2c/for-mergewindow branch? It seems it conflicts with the "callback returning void" conversion.
I did this now and applied to for-next, thanks!