2014-04-09 19:26:25

by Joel Porquet

[permalink] [raw]
Subject: [PATCH] staging: iio: fix coding style

As suggested by checkpatch.pl, use dev_info() instead of
printk(KERN_INFO ...) to print message.

Signed-off-by: Joel Porquet <[email protected]>
---
Only tested by compilation.
drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
index 48a6afa..38ecb4b 100644
--- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
+++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
@@ -33,7 +33,8 @@ static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state)
struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig);
if (trig_info->frequency == 0)
return -EINVAL;
- printk(KERN_INFO "trigger frequency is %d\n", trig_info->frequency);
+ dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
+ trig_info->frequency);
return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
}

--
1.9.1


2014-04-12 17:26:51

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH] staging: iio: fix coding style

On 09/04/14 19:09, Joel Porquet wrote:
> As suggested by checkpatch.pl, use dev_info() instead of
> printk(KERN_INFO ...) to print message.
>
> Signed-off-by: Joel Porquet <[email protected]>
> ---
> Only tested by compilation.
> drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> index 48a6afa..38ecb4b 100644
> --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> @@ -33,7 +33,8 @@ static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state)
> struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig);
> if (trig_info->frequency == 0)
> return -EINVAL;
> - printk(KERN_INFO "trigger frequency is %d\n", trig_info->frequency);
> + dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
> + trig_info->frequency);
The principle is good, but why make the error message us the underlying rtc device?
Going to lead to a rather unhelpful error message.

Perhaps the iio_trigger structures device element would make more sense?
Might not be terribly informative, but will at least come from the right
subsystem.

Also, I think we will be dropping this driver entirely at some point.
It was a dodgy hack that perhaps made sense at the time, but now a high
resolution timer is going to give better results.
> return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
> }
>
>

2014-04-14 10:10:18

by Dan O'Donovan

[permalink] [raw]
Subject: Re: [PATCH] staging: iio: fix coding style

On Sat, 2014-04-12 at 18:28 +0100, Jonathan Cameron wrote:
> On 09/04/14 19:09, Joel Porquet wrote:
> > As suggested by checkpatch.pl, use dev_info() instead of
> > printk(KERN_INFO ...) to print message.
> >
> > Signed-off-by: Joel Porquet <[email protected]>
> > ---
> > Only tested by compilation.
> > drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > index 48a6afa..38ecb4b 100644
> > --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > @@ -33,7 +33,8 @@ static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state)
> > struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig);
> > if (trig_info->frequency == 0)
> > return -EINVAL;
> > - printk(KERN_INFO "trigger frequency is %d\n", trig_info->frequency);
> > + dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
> > + trig_info->frequency);
> The principle is good, but why make the error message us the underlying rtc device?
> Going to lead to a rather unhelpful error message.
>
> Perhaps the iio_trigger structures device element would make more sense?
> Might not be terribly informative, but will at least come from the right
> subsystem.
>
> Also, I think we will be dropping this driver entirely at some point.
> It was a dodgy hack that perhaps made sense at the time, but now a high
> resolution timer is going to give better results.

I've been using this patch from Denis Ciocca which implements a hr-timer
trigger, and it has worked well for me:
http://comments.gmane.org/gmane.linux.kernel.iio/9698
It would be great to see this added to the kernel.

> > return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
> > }
> >
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2014-04-14 16:10:57

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH] staging: iio: fix coding style



On April 14, 2014 2:59:32 PM GMT+01:00, "Joël Porquet" <[email protected]> wrote:
>
>
>On Saturday, April 12, 2014 06:28:07 PM Jonathan Cameron wrote:
>>
>> On 09/04/14 19:09, Joel Porquet wrote:
>> > As suggested by checkpatch.pl, use dev_info() instead of
>> > printk(KERN_INFO ...) to print message.
>> >
>> > Signed-off-by: Joel Porquet <[email protected]>
>> > ---
>> > Only tested by compilation.
>> > drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 3 ++-
>> > 1 file changed, 2 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
>b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
>> > index 48a6afa..38ecb4b 100644
>> > --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
>> > +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
>> > @@ -33,7 +33,8 @@ static int iio_trig_periodic_rtc_set_state(struct
>iio_trigger *trig, bool state)
>> > struct iio_prtc_trigger_info *trig_info =
>iio_trigger_get_drvdata(trig);
>> > if (trig_info->frequency == 0)
>> > return -EINVAL;
>> > - printk(KERN_INFO "trigger frequency is %d\n",
>trig_info->frequency);
>> > + dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
>> > + trig_info->frequency);
>> The principle is good, but why make the error message us the
>underlying rtc device?
>> Going to lead to a rather unhelpful error message.
>>
>> Perhaps the iio_trigger structures device element would make more
>sense?
>> Might not be terribly informative, but will at least come from the
>right
>> subsystem.
>>
>> Also, I think we will be dropping this driver entirely at some point.
>> It was a dodgy hack that perhaps made sense at the time, but now a
>high
>> resolution timer is going to give better results.
>
>OK, thanks for the feedback!
>
>Does that still make sense that I resubmit another patch (using
>iio_trigger-dev instead)?
>Or should I just drop this patch altogether since you seem to say that
>patching this driver is not really worth it anyway?
Up to you. Nothing wrong with setting a good example even in code we aim ultimately
drop the code! I doubt we will do it for a cycle or two yet
>
>> > return rtc_irq_set_state(trig_info->rtc, &trig_info->task,
>state);
>> > }
>> >
>> >
>>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>the body of a message to [email protected]
>More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

2014-04-14 19:15:37

by Joel Porquet

[permalink] [raw]
Subject: Re: [PATCH] staging: iio: fix coding style



On Saturday, April 12, 2014 06:28:07 PM Jonathan Cameron wrote:
>
> On 09/04/14 19:09, Joel Porquet wrote:
> > As suggested by checkpatch.pl, use dev_info() instead of
> > printk(KERN_INFO ...) to print message.
> >
> > Signed-off-by: Joel Porquet <[email protected]>
> > ---
> > Only tested by compilation.
> > drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > index 48a6afa..38ecb4b 100644
> > --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> > @@ -33,7 +33,8 @@ static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state)
> > struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig);
> > if (trig_info->frequency == 0)
> > return -EINVAL;
> > - printk(KERN_INFO "trigger frequency is %d\n", trig_info->frequency);
> > + dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
> > + trig_info->frequency);
> The principle is good, but why make the error message us the underlying rtc device?
> Going to lead to a rather unhelpful error message.
>
> Perhaps the iio_trigger structures device element would make more sense?
> Might not be terribly informative, but will at least come from the right
> subsystem.
>
> Also, I think we will be dropping this driver entirely at some point.
> It was a dodgy hack that perhaps made sense at the time, but now a high
> resolution timer is going to give better results.

OK, thanks for the feedback!

Does that still make sense that I resubmit another patch (using iio_trigger-dev instead)?
Or should I just drop this patch altogether since you seem to say that patching this driver is not really worth it anyway?

> > return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
> > }
> >
> >
>

2014-06-14 15:19:16

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH] staging: iio: fix coding style

On 09/04/14 19:09, Joel Porquet wrote:
> As suggested by checkpatch.pl, use dev_info() instead of
> printk(KERN_INFO ...) to print message.
>
> Signed-off-by: Joel Porquet <[email protected]>
This line has been removed by another patch in the meantime.
> ---
> Only tested by compilation.
> drivers/staging/iio/trigger/iio-trig-periodic-rtc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> index 48a6afa..38ecb4b 100644
> --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c
> @@ -33,7 +33,8 @@ static int iio_trig_periodic_rtc_set_state(struct iio_trigger *trig, bool state)
> struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig);
> if (trig_info->frequency == 0)
> return -EINVAL;
> - printk(KERN_INFO "trigger frequency is %d\n", trig_info->frequency);
> + dev_info(&trig_info->rtc->dev, "trigger frequency is %d\n",
> + trig_info->frequency);
> return rtc_irq_set_state(trig_info->rtc, &trig_info->task, state);
> }
>
>