* [PATCH] drivers: iio: light: Fix sparse warnings
@ 2016-09-24 12:12 Sandhya Bankar
2016-09-24 15:21 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Sandhya Bankar @ 2016-09-24 12:12 UTC (permalink / raw)
To: jic23, knaack.h, lars, pmeerw, linux-iio
Fixing below warnings:
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
drivers/iio/light/max44000.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c
index 6511b20..1ea9af9 100644
--- a/drivers/iio/light/max44000.c
+++ b/drivers/iio/light/max44000.c
@@ -214,7 +214,7 @@ static int max44000_read_alsval(struct max44000_data *data)
if (ret < 0)
return ret;
- regval = be16_to_cpu(regval);
+ be16_to_cpus(®val);
/*
* Overflow is explained on datasheet page 17.
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers: iio: light: Fix sparse warnings
2016-09-24 12:12 [PATCH] drivers: iio: light: Fix sparse warnings Sandhya Bankar
@ 2016-09-24 15:21 ` Jonathan Cameron
2016-09-24 18:51 ` Alison Schofield
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2016-09-24 15:21 UTC (permalink / raw)
To: Sandhya Bankar, knaack.h, lars, pmeerw, linux-iio
On 24/09/16 13:12, Sandhya Bankar wrote:
> Fixing below warnings:
>
> drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
>
> Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
This is really just papering over the problem.
A better solution would be to introduce a __be16 local variable to do
the initial read into. Then put it in regval via that be16_to_cpu
call.
Jonathan
> ---
> drivers/iio/light/max44000.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c
> index 6511b20..1ea9af9 100644
> --- a/drivers/iio/light/max44000.c
> +++ b/drivers/iio/light/max44000.c
> @@ -214,7 +214,7 @@ static int max44000_read_alsval(struct max44000_data *data)
> if (ret < 0)
> return ret;
>
> - regval = be16_to_cpu(regval);
> + be16_to_cpus(®val);
>
> /*
> * Overflow is explained on datasheet page 17.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers: iio: light: Fix sparse warnings
2016-09-24 15:21 ` Jonathan Cameron
@ 2016-09-24 18:51 ` Alison Schofield
0 siblings, 0 replies; 3+ messages in thread
From: Alison Schofield @ 2016-09-24 18:51 UTC (permalink / raw)
To: jic23, outreachy-kernel; +Cc: Sandhya Bankar, knaack.h, lars, pmeerw, linux-iio
On Sat, Sep 24, 2016 at 04:21:01PM +0100, Jonathan Cameron wrote:
> On 24/09/16 13:12, Sandhya Bankar wrote:
> > Fixing below warnings:
> >
> > drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> > drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> > drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> > drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
> >
> > Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
> This is really just papering over the problem.
> A better solution would be to introduce a __be16 local variable to do
> the initial read into. Then put it in regval via that be16_to_cpu
> call.
>
> Jonathan
CC'ing outreachy-kernel@googlegroups.com since this is an Outreachy
task, and others will benefit from Jonathan's feedback to be sure that
we type the data correctly when it enters the system.
Sandhya, There are a few other patches from you in linux-iio that didn't
go to the Outreachy group. Probably not worth bouncing at this point.
Others can find them in linux-iio. CC group on all future postings.
Outreachy applicant patch creation reminders:
- use git log commands to decide on the commit path
- commit message says what is changing
- changelog says why it is changing
- changelog makes a reference to the tool used to find the
issue and states the warning addresed.
Goal is not to fix checkpatch, sparse, 'insert-your-favorite-tool' warnings.
Goal is to correct the valid coding issues that these tools report.
alisons
> > ---
> > drivers/iio/light/max44000.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c
> > index 6511b20..1ea9af9 100644
> > --- a/drivers/iio/light/max44000.c
> > +++ b/drivers/iio/light/max44000.c
> > @@ -214,7 +214,7 @@ static int max44000_read_alsval(struct max44000_data *data)
> > if (ret < 0)
> > return ret;
> >
> > - regval = be16_to_cpu(regval);
> > + be16_to_cpus(®val);
> >
> > /*
> > * Overflow is explained on datasheet page 17.
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-24 18:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-24 12:12 [PATCH] drivers: iio: light: Fix sparse warnings Sandhya Bankar
2016-09-24 15:21 ` Jonathan Cameron
2016-09-24 18:51 ` Alison Schofield
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).