media: ir-spi: A few cleanups
Subsystems (2)
cover media: ir-spi: A few cleanups
While removing of_gpio.h where it's being unused, this driver seems to deserve more love. Hence this series.
Andy Shevchenko (5):
media: ir-spi: Don't use "proxy" headers
media: ir-spi: Make use of device properties
media: ir-spi: Utilise temporary variable for struct device
media: ir-spi: Remove trailing comma in the terminator entry
media: ir-spi: Unify indentation and comment style
drivers/media/rc/ir-spi.c | 41 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 19 deletions(-)
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
PATCH 1/5 media: ir-spi: Don't use "proxy" headers
Update header inclusions to follow IWYU (Include What You Use) principle.
--- drivers/media/rc/ir-spi.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/media/rc/ir-spi.c +9 -4
@@ -4,13 +4,18 @@// Copyright (c) 2016 Samsung Electronics Co., Ltd. // Copyright (c) Andi Shyti <[email protected]> -#include <linux/delay.h> -#include <linux/fs.h> +#include <linux/bits.h> +#include <linux/device.h> +#include <linux/err.h> +#include <linux/math.h> +#include <linux/mod_devicetable.h> #include <linux/module.h> -#include <linux/mutex.h> -#include <linux/of_gpio.h> +#include <linux/of.h> #include <linux/regulator/consumer.h> #include <linux/spi/spi.h> +#include <linux/string.h> +#include <linux/types.h> +#include <media/rc-core.h> #define IR_SPI_DRIVER_NAME "ir-spi"
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Re: [SPAM] [PATCH v1 1/5] media: ir-spi: Don't use "proxy" headers
Hi Andy,
Quoted 4 lines · Andy Shevchenko
Update header inclusions to follow IWYU (Include What You Use) principle.
Signed-off-by Andy Shevchenko <[email protected]>
Thanks,
Andi
PATCH 2/5 media: ir-spi: Make use of device properties
In reply to Andy ShevchenkoConvert the module to be property provider agnostic and allow it to be used on non-OF platforms.
--- drivers/media/rc/ir-spi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/rc/ir-spi.c +4 -4
@@ -10,7 +10,7 @@#include <linux/math.h> #include <linux/mod_devicetable.h> #include <linux/module.h> -#include <linux/of.h> +#include <linux/property.h> #include <linux/regulator/consumer.h> #include <linux/spi/spi.h> #include <linux/string.h>
@@ -116,6 +116,7 @@ static int ir_spi_set_duty_cycle(struct rc_dev *dev, u32 duty_cycle)static int ir_spi_probe (struct spi_device *spi) { +struct device *dev = &spi->dev;int ret;u8 dc;struct ir_spi_data *idata;
@@ -140,9 +141,8 @@ static int ir_spi_probe(struct spi_device *spi) idata->rc->priv = idata; idata->spi = spi; - idata->negated =of_property_read_bool (spi->dev.of_node, -"led-active-low" ); - ret =of_property_read_u8 (spi->dev.of_node,"duty-cycle" , &dc); + idata->negated =device_property_read_bool (dev,"led-active-low" ); + ret =device_property_read_u8 (dev,"duty-cycle" , &dc);if (ret) dc =50 ;
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Re: [SPAM] [PATCH v1 2/5] media: ir-spi: Make use of device properties
Hi Andy,
Quoted 4 lines · Andy Shevchenko
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms.
Signed-off-by Andy Shevchenko <[email protected]>
Thanks,
Andi
PATCH 3/5 media: ir-spi: Utilise temporary variable for struct device
In reply to Andy ShevchenkoWe have a temporary variable to keep pointer to struct device. Utilise it inside the ->probe() implementation.
--- drivers/media/rc/ir-spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/rc/ir-spi.c +3 -3
@@ -121,11 +121,11 @@ static int ir_spi_probe(struct spi_device *spi)u8 dc;struct ir_spi_data *idata; - idata =devm_kzalloc (&spi->dev,sizeof (*idata),GFP_KERNEL ); + idata =devm_kzalloc (dev,sizeof (*idata),GFP_KERNEL );if (!idata)return -ENOMEM ; - idata->regulator =devm_regulator_get (&spi->dev,"irda_regulator" ); + idata->regulator =devm_regulator_get (dev,"irda_regulator" );if (IS_ERR (idata->regulator))return PTR_ERR (idata->regulator);
@@ -154,7 +154,7 @@ static int ir_spi_probe(struct spi_device *spi) idata->freq =IR_SPI_DEFAULT_FREQUENCY ; -return devm_rc_register_device (&spi->dev, idata->rc); +return devm_rc_register_device (dev, idata->rc); }static const struct of_device_id ir_spi_of_match[] = {
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Re: [SPAM] [PATCH v1 3/5] media: ir-spi: Utilise temporary variable for struct device
Hi Andy,
Quoted 4 lines · Andy Shevchenko
We have a temporary variable to keep pointer to struct device. Utilise it inside the ->probe() implementation.
Signed-off-by Andy Shevchenko <[email protected]>
Thanks,
Andi
PATCH 4/5 media: ir-spi: Remove trailing comma in the terminator entry
In reply to Andy ShevchenkoRemove trailing comma in the terminator entry in ID table(s).
--- drivers/media/rc/ir-spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/rc/ir-spi.c +2 -2
@@ -159,13 +159,13 @@ static int ir_spi_probe(struct spi_device *spi)static const struct of_device_id ir_spi_of_match[] = { { .compatible ="ir-spi-led" }, - {}, + {} };MODULE_DEVICE_TABLE (of, ir_spi_of_match);static const struct spi_device_id ir_spi_ids[] = { {"ir-spi-led" }, - {}, + {} };MODULE_DEVICE_TABLE (spi, ir_spi_ids);
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Re: [PATCH v1 4/5] media: ir-spi: Remove trailing comma in the terminator entry
Hi Andy,
Quoted 3 lines · Andy Shevchenko
Remove trailing comma in the terminator entry in ID table(s).
Signed-off-by Andy Shevchenko <[email protected]>
Thanks,
Andi
PATCH 5/5 media: ir-spi: Unify indentation and comment style
In reply to Andy ShevchenkoUnify the indentation and multi-line comment style.
--- drivers/media/rc/ir-spi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/media/rc/ir-spi.c +5 -7
@@ -36,8 +36,7 @@ struct ir_spi_data {struct regulator *regulator; }; -static int ir_spi_tx (struct rc_dev *dev, -unsigned int *buffer,unsigned int count) +static int ir_spi_tx (struct rc_dev *dev,unsigned int *buffer,unsigned int count) {int i;int ret;
@@ -57,7 +56,7 @@ static int ir_spi_tx(struct rc_dev *dev,return -EINVAL ;/* -* the first value in buffer is a pulse, so that 0, 2, 4, ... +* The first value in buffer is a pulse, so that 0, 2, 4, ... * contain a pulse duration. On the contrary, 1, 3, 5, ... * contain a space duration. */
@@ -146,9 +145,9 @@ static int ir_spi_probe(struct spi_device *spi)if (ret) dc =50 ; -/* ir_spi_set_duty_cycle cannot fail, -* it returns int to be compatible with the -* rc->s_tx_duty_cycle function +/* +* ir_spi_set_duty_cycle() cannot fail, it returns int +* to be compatible with the rc->s_tx_duty_cycle function. */ ir_spi_set_duty_cycle (idata->rc, dc);
@@ -177,7 +176,6 @@ static struct spi_driver ir_spi_driver = { .of_match_table = ir_spi_of_match, }, }; -module_spi_driver (ir_spi_driver);MODULE_AUTHOR ("Andi Shyti <[email protected]>" );
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Re: [SPAM] [PATCH v1 5/5] media: ir-spi: Unify indentation and comment style
Hi Andy,
Quoted 12 lines · Andy Shevchenko
Unify the indentation and multi-line comment style.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/media/rc/ir-spi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)drivers/media/rc/ir-spi.c +0
-0
drivers/media/rc/ir-spi.c struct ir_spi_data { · line 39
Quoted 6 lines
drivers/media/rc/ir-spi.c +1
-2@@ -36,8 +36,7 @@ struct ir_spi_data {struct regulator *regulator; }; -static int ir_spi_tx (struct rc_dev *dev, -unsigned int *buffer,unsigned int count) +static int ir_spi_tx (struct rc_dev *dev,unsigned int *buffer,unsigned int count)
this goes over 80 characters, though. Not an error, but not worth a change either.
I'm not going block the patch as the rest is OK.
Andi
Quoted 36 lines
drivers/media/rc/ir-spi.c +4
-5{int i;int ret;@@ -57,7 +56,7 @@ static int ir_spi_tx(struct rc_dev *dev,return -EINVAL ;/* -* the first value in buffer is a pulse, so that 0, 2, 4, ... +* The first value in buffer is a pulse, so that 0, 2, 4, ... * contain a pulse duration. On the contrary, 1, 3, 5, ... * contain a space duration. */ @@ -146,9 +145,9 @@ static int ir_spi_probe(struct spi_device *spi)if (ret) dc =50 ; -/* ir_spi_set_duty_cycle cannot fail, -* it returns int to be compatible with the -* rc->s_tx_duty_cycle function +/* +* ir_spi_set_duty_cycle() cannot fail, it returns int +* to be compatible with the rc->s_tx_duty_cycle function. */ ir_spi_set_duty_cycle (idata->rc, dc);@@ -177,7 +176,6 @@ static struct spi_driver ir_spi_driver = { .of_match_table = ir_spi_of_match, }, }; -module_spi_driver (ir_spi_driver);MODULE_AUTHOR ("Andi Shyti <[email protected]>" );Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Re: [SPAM] [PATCH v1 5/5] media: ir-spi: Unify indentation and comment style
Quoted 1 line · Andi Shyti
On Tue, Mar 05, 2024 at 07:48:30PM +0200, Andy Shevchenko wrote:
...
Quoted 4 lines
Quoted 1 line
+static int
ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int count)this goes over 80 characters, though. Not an error, but not worth a change either.
It's only 82 characters and I consider this as an improvement in readability. It's quite pity that some of the subsystems are too conservative, hope this one is not an obstacle for them.
Quoted 3 lines
I'm not going block the patch as the rest is OK.
Reviewed-by Andi Shyti <[email protected]>
Thank you!
Btw, don't you want to either add your entry into .mailcap and/or update your email address in this source file (and maybe others)? I Cc'ed you only after I looked closer to the sources...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v1 5/5] media: ir-spi: Unify indentation and comment style
Quoted 16 lines · Andy Shevchenko
Quoted 1 line · Andi Shyti
On Tue, Mar 05, 2024 at 07:48:30PM +0200, Andy Shevchenko wrote:
...
Quoted 4 lines
Quoted 1 line
+static int
ir_spi_tx(struct rc_dev *dev, unsigned int *buffer, unsigned int count)this goes over 80 characters, though. Not an error, but not worth a change either.
It's only 82 characters and I consider this as an improvement in readability. It's quite pity that some of the subsystems are too conservative, hope this one is not an obstacle for them.
Quoted 2 lines
I'm not going block the patch as the rest is OK.
Quoted 7 lines
Quoted 1 line
Reviewed-by Andi Shyti <[email protected]>Thank you!
Btw, don't you want to either add your entry into .mailcap and/or update your email address in this source file (and maybe others)? I Cc'ed you only after I looked closer to the sources...
yes, will do... I also noticed that lots of updates are missing...
I've been far from all this for too long, so that I have still a lot of catch up to do :-)
Thanks, Andy!
Andi
Hi Andy,
Quoted 2 lines · Andy Shevchenko
While removing
of_gpio.hwhere it's being unused, this driver seems to deserve more love. Hence this series.
ehehe... thanks for the cleanup!
Andi
Quoted 2 lines · Andy Shevchenko
While removing
of_gpio.hwhere it's being unused, this driver seems to deserve more love. Hence this series.
Sean, any comments on this series?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Sean Young
maintainerQuoted 5 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
While removing
of_gpio.hwhere it's being unused, this driver seems to deserve more love. Hence this series.Sean, any comments on this series?
Looks great, I've applied it to my branch.
Sean
Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
While removing
of_gpio.hwhere it's being unused, this driver seems to deserve more love. Hence this series.Sean, any comments on this series?
Since previous reply, I found an answer in your repository :-) Thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko