Re: [PATCH 1/1] iio: fixed symbolic permission references 'S_IRUGO | S_IWUSR'

2017-01-30 Thread Hartmut Knaack
Artur Lorincz schrieb am 30.01.2017 um 11:10:
> Replaced the symbolic permission references S_IRUGO and S_IWUSR with their
> octal counterparts.

Hi Artur,
patches concerning IIO should be sent to the linux-iio mailing list, and
former maintainers of the file should be CC'ed.
Now, regarding your patch, I am not convinced that this is an improvement.
Those symbols are usually used to improve readability, which is not given
with more or less magical numbers.
Thanks,

Hartmut

> 
> Signed-off-by: Artur Lorincz 
> ---
>  drivers/staging/iio/adc/ad7192.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7192.c 
> b/drivers/staging/iio/adc/ad7192.c
> index 1fb68c0..4fc8588 100644
> --- a/drivers/staging/iio/adc/ad7192.c
> +++ b/drivers/staging/iio/adc/ad7192.c
> @@ -342,9 +342,9 @@ static int ad7192_setup(struct ad7192_state *st,
> 
>  static IIO_DEVICE_ATTR_NAMED(in_v_m_v_scale_available,
>in_voltage-voltage_scale_available,
> -  S_IRUGO, ad7192_show_scale_available, NULL, 0);
> +  0444, ad7192_show_scale_available, NULL, 0);
> 
> -static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
> +static IIO_DEVICE_ATTR(in_voltage_scale_available, 0444,
>  ad7192_show_scale_available, NULL, 0);
> 
>  static ssize_t ad7192_show_ac_excitation(struct device *dev,
> @@ -412,11 +412,11 @@ static ssize_t ad7192_set(struct device *dev,
>   return ret ? ret : len;
>  }
> 
> -static IIO_DEVICE_ATTR(bridge_switch_en, S_IRUGO | S_IWUSR,
> +static IIO_DEVICE_ATTR(bridge_switch_en, 0644,
>  ad7192_show_bridge_switch, ad7192_set,
>  AD7192_REG_GPOCON);
> 
> -static IIO_DEVICE_ATTR(ac_excitation_en, S_IRUGO | S_IWUSR,
> +static IIO_DEVICE_ATTR(ac_excitation_en, 0644,
>  ad7192_show_ac_excitation, ad7192_set,
>  AD7192_REG_MODE);
> 
> --
> 1.9.1
> 
> 



0xFAC89148.asc
Description: application/pgp-keys


signature.asc
Description: OpenPGP digital signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] iio:trigger: Introduce the use of devm_kzalloc

2014-07-01 Thread Hartmut Knaack
Himangi Saraogi schrieb:
> This patch introduces the use of the managed version of kzalloc and
> removes the kfrees in the probe and remove functions. Also, the labels
> are renamed to order them.
Since you are already on it, better drop label "out" and return the errorcode 
immediately after checking for errors.
>
> Signed-off-by: Himangi Saraogi 
> Acked-by: Julia Lawall 
> ---
>  drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 19 ---
>  1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c 
> b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
> index 16f1a06..cc858aa 100644
> --- a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
> +++ b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
> @@ -182,7 +182,7 @@ static int iio_bfin_tmr_trigger_probe(struct 
> platform_device *pdev)
>   unsigned int config;
>   int ret;
>  
> - st = kzalloc(sizeof(*st), GFP_KERNEL);
> + st = devm_kzalloc(&pdev->dev, sizeof(*st), GFP_KERNEL);
>   if (st == NULL) {
>   ret = -ENOMEM;
>   goto out;
> @@ -192,12 +192,12 @@ static int iio_bfin_tmr_trigger_probe(struct 
> platform_device *pdev)
>   if (!st->irq) {
>   dev_err(&pdev->dev, "No IRQs specified");
>   ret = -ENODEV;
> - goto out1;
> + goto out;
>   }
>  
>   ret = iio_bfin_tmr_get_number(st->irq);
>   if (ret < 0)
> - goto out1;
> + goto out;
>  
>   st->timer_num = ret;
>   st->t = &iio_bfin_timer_code[st->timer_num];
> @@ -205,7 +205,7 @@ static int iio_bfin_tmr_trigger_probe(struct 
> platform_device *pdev)
>   st->trig = iio_trigger_alloc("bfintmr%d", st->timer_num);
>   if (!st->trig) {
>   ret = -ENOMEM;
> - goto out1;
> + goto out;
>   }
>  
>   st->trig->ops = &iio_bfin_tmr_trigger_ops;
> @@ -213,14 +213,14 @@ static int iio_bfin_tmr_trigger_probe(struct 
> platform_device *pdev)
>   iio_trigger_set_drvdata(st->trig, st);
>   ret = iio_trigger_register(st->trig);
>   if (ret)
> - goto out2;
> + goto out1;
>  
>   ret = request_irq(st->irq, iio_bfin_tmr_trigger_isr,
> 0, st->trig->name, st);
>   if (ret) {
>   dev_err(&pdev->dev,
>   "request IRQ-%d failed", st->irq);
> - goto out4;
> + goto out2;
>   }
>  
>   config = PWM_OUT | PERIOD_CNT | IRQ_ENA;
> @@ -260,12 +260,10 @@ static int iio_bfin_tmr_trigger_probe(struct 
> platform_device *pdev)
>   return 0;
>  out_free_irq:
>   free_irq(st->irq, st);
> -out4:
> - iio_trigger_unregister(st->trig);
>  out2:
> - iio_trigger_put(st->trig);
> + iio_trigger_unregister(st->trig);
>  out1:
> - kfree(st);
> + iio_trigger_put(st->trig);
>  out:
>   return ret;
>  }
> @@ -280,7 +278,6 @@ static int iio_bfin_tmr_trigger_remove(struct 
> platform_device *pdev)
>   free_irq(st->irq, st);
>   iio_trigger_unregister(st->trig);
>   iio_trigger_put(st->trig);
> - kfree(st);
>  
>   return 0;
>  }

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel