[PATCH 0/1] Coding style fix

2021-02-10 Thread Fatih YILDIRIM
Hi,
I have a coding style fix in greybus subsystem.

By the way, I'm following the Eudyptula Challenge Linux kernel tasks and
this patch is related to my task no 10. I hope I'm doing it the right way.
Thanks for your understanding and kind comments.

Fatih YILDIRIM (1):
  Macros with multiple statements should be enclosed in a do - while
loop.

 drivers/staging/greybus/loopback.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

-- 
2.20.1

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


[PATCH 1/1] Macros with multiple statements should be enclosed in a do - while loop.

2021-02-10 Thread Fatih YILDIRIM
Signed-off-by: Fatih YILDIRIM 
---
 drivers/staging/greybus/loopback.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/greybus/loopback.c 
b/drivers/staging/greybus/loopback.c
index 2471448ba42a..c88ef3e894fa 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -162,10 +162,12 @@ static ssize_t name##_avg_show(struct device *dev,
\
 }  \
 static DEVICE_ATTR_RO(name##_avg)
 
-#define gb_loopback_stats_attrs(field) \
-   gb_loopback_ro_stats_attr(field, min, u);   \
-   gb_loopback_ro_stats_attr(field, max, u);   \
-   gb_loopback_ro_avg_attr(field)
+#define gb_loopback_stats_attrs(field) \
+   do {\
+   gb_loopback_ro_stats_attr(field, min, u);   \
+   gb_loopback_ro_stats_attr(field, max, u);   \
+   gb_loopback_ro_avg_attr(field); \
+   } while (0)
 
 #define gb_loopback_attr(field, type)  \
 static ssize_t field##_show(struct device *dev,
\
-- 
2.20.1

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


[PATCH] Macros with complex values should be enclosed in parentheses.

2021-02-10 Thread Fatih YILDIRIM
Signed-off-by: Fatih YILDIRIM 
---
Hi,
I have a coding style fix.
By the way, I'm following the Eudyptula Challenge Linux kernel tasks
and this is my first patch related to my task no 10.
I hope I'm doing it the right way.
Thanks for your understanding and kind comments.

 drivers/staging/ks7010/ks_hostif.h | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.h 
b/drivers/staging/ks7010/ks_hostif.h
index 39138191a556..c62a494ed6bb 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -498,20 +498,20 @@ struct hostif_mic_failure_request {
 #define TX_RATE_FIXED  5
 
 /* 11b rate */
-#define TX_RATE_1M (u8)(10 / 5)/* 11b 11g basic rate */
-#define TX_RATE_2M (u8)(20 / 5)/* 11b 11g basic rate */
-#define TX_RATE_5M (u8)(55 / 5)/* 11g basic rate */
-#define TX_RATE_11M(u8)(110 / 5)   /* 11g basic rate */
+#define TX_RATE_1M ((u8)(10 / 5))  /* 11b 11g basic rate */
+#define TX_RATE_2M ((u8)(20 / 5))  /* 11b 11g basic rate */
+#define TX_RATE_5M ((u8)(55 / 5))  /* 11g basic rate */
+#define TX_RATE_11M((u8)(110 / 5)) /* 11g basic rate */
 
 /* 11g rate */
-#define TX_RATE_6M (u8)(60 / 5)/* 11g basic rate */
-#define TX_RATE_12M(u8)(120 / 5)   /* 11g basic rate */
-#define TX_RATE_24M(u8)(240 / 5)   /* 11g basic rate */
-#define TX_RATE_9M (u8)(90 / 5)
-#define TX_RATE_18M(u8)(180 / 5)
-#define TX_RATE_36M(u8)(360 / 5)
-#define TX_RATE_48M(u8)(480 / 5)
-#define TX_RATE_54M(u8)(540 / 5)
+#define TX_RATE_6M ((u8)(60 / 5))  /* 11g basic rate */
+#define TX_RATE_12M((u8)(120 / 5)) /* 11g basic rate */
+#define TX_RATE_24M((u8)(240 / 5)) /* 11g basic rate */
+#define TX_RATE_9M ((u8)(90 / 5))
+#define TX_RATE_18M((u8)(180 / 5))
+#define TX_RATE_36M((u8)(360 / 5))
+#define TX_RATE_48M((u8)(480 / 5))
+#define TX_RATE_54M((u8)(540 / 5))
 
 static inline bool is_11b_rate(u8 rate)
 {
-- 
2.20.1

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


[PATCH -next] staging: ks7010: Macros with complex values

2021-02-11 Thread Fatih Yildirim
Fix for checkpatch.pl warning:
Macros with complex values should be enclosed in parentheses.

Signed-off-by: Fatih Yildirim 
---
 drivers/staging/ks7010/ks_hostif.h | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.h 
b/drivers/staging/ks7010/ks_hostif.h
index 39138191a556..c62a494ed6bb 100644
--- a/drivers/staging/ks7010/ks_hostif.h
+++ b/drivers/staging/ks7010/ks_hostif.h
@@ -498,20 +498,20 @@ struct hostif_mic_failure_request {
 #define TX_RATE_FIXED  5
 
 /* 11b rate */
-#define TX_RATE_1M (u8)(10 / 5)/* 11b 11g basic rate */
-#define TX_RATE_2M (u8)(20 / 5)/* 11b 11g basic rate */
-#define TX_RATE_5M (u8)(55 / 5)/* 11g basic rate */
-#define TX_RATE_11M(u8)(110 / 5)   /* 11g basic rate */
+#define TX_RATE_1M ((u8)(10 / 5))  /* 11b 11g basic rate */
+#define TX_RATE_2M ((u8)(20 / 5))  /* 11b 11g basic rate */
+#define TX_RATE_5M ((u8)(55 / 5))  /* 11g basic rate */
+#define TX_RATE_11M((u8)(110 / 5)) /* 11g basic rate */
 
 /* 11g rate */
-#define TX_RATE_6M (u8)(60 / 5)/* 11g basic rate */
-#define TX_RATE_12M(u8)(120 / 5)   /* 11g basic rate */
-#define TX_RATE_24M(u8)(240 / 5)   /* 11g basic rate */
-#define TX_RATE_9M (u8)(90 / 5)
-#define TX_RATE_18M(u8)(180 / 5)
-#define TX_RATE_36M(u8)(360 / 5)
-#define TX_RATE_48M(u8)(480 / 5)
-#define TX_RATE_54M(u8)(540 / 5)
+#define TX_RATE_6M ((u8)(60 / 5))  /* 11g basic rate */
+#define TX_RATE_12M((u8)(120 / 5)) /* 11g basic rate */
+#define TX_RATE_24M((u8)(240 / 5)) /* 11g basic rate */
+#define TX_RATE_9M ((u8)(90 / 5))
+#define TX_RATE_18M((u8)(180 / 5))
+#define TX_RATE_36M((u8)(360 / 5))
+#define TX_RATE_48M((u8)(480 / 5))
+#define TX_RATE_54M((u8)(540 / 5))
 
 static inline bool is_11b_rate(u8 rate)
 {
-- 
2.20.1

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


Re: [PATCH -next] staging: ks7010: Macros with complex values

2021-02-11 Thread Fatih YILDIRIM
On Thu, Feb 11, 2021 at 11:02:51AM +0100, Greg KH wrote:
> On Thu, Feb 11, 2021 at 12:22:39PM +0300, Fatih Yildirim wrote:
> > Fix for checkpatch.pl warning:
> > Macros with complex values should be enclosed in parentheses.
> > 
> > Signed-off-by: Fatih Yildirim 
> > ---
> >  drivers/staging/ks7010/ks_hostif.h | 24 
> >  1 file changed, 12 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/staging/ks7010/ks_hostif.h 
> > b/drivers/staging/ks7010/ks_hostif.h
> > index 39138191a556..c62a494ed6bb 100644
> > --- a/drivers/staging/ks7010/ks_hostif.h
> > +++ b/drivers/staging/ks7010/ks_hostif.h
> > @@ -498,20 +498,20 @@ struct hostif_mic_failure_request {
> >  #define TX_RATE_FIXED  5
> >  
> >  /* 11b rate */
> > -#define TX_RATE_1M (u8)(10 / 5)/* 11b 11g basic rate */
> > -#define TX_RATE_2M (u8)(20 / 5)/* 11b 11g basic rate */
> > -#define TX_RATE_5M (u8)(55 / 5)/* 11g basic rate */
> > -#define TX_RATE_11M(u8)(110 / 5)   /* 11g basic rate */
> > +#define TX_RATE_1M ((u8)(10 / 5))  /* 11b 11g basic rate */
> > +#define TX_RATE_2M ((u8)(20 / 5))  /* 11b 11g basic rate */
> > +#define TX_RATE_5M ((u8)(55 / 5))  /* 11g basic rate */
> > +#define TX_RATE_11M((u8)(110 / 5)) /* 11g basic rate */
> 
> But these are not "complex macros" that need an extra () added to them,
> right?
> 
> Checkpatch is a hint, it's not a code parser and can not always know
> what is happening.  With your knowledge of C, does this look like
> something that needs to be "fixed"?
> 
> thanks,
> 
> greg k-h

Hi Greg,

Thanks for your reply.
Actually, I'm following the Eudyptula Challenge and I'm at task 10.
Task is to find and fix a coding style in linux-next/drivers/staging.
I've checked many files with checkpatch.pl but they are almost fine :)
I found this one and prepared a patch for it.
Thanks in advance for your comments and advice.

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


Re: [PATCH -next] staging: ks7010: Macros with complex values

2021-02-11 Thread Fatih Yildirim
On Thu, Feb 11, 2021 at 12:10:44PM +0100, Greg KH wrote:
> On Thu, Feb 11, 2021 at 01:57:04PM +0300, Fatih YILDIRIM wrote:
> > On Thu, Feb 11, 2021 at 11:02:51AM +0100, Greg KH wrote:
> > > On Thu, Feb 11, 2021 at 12:22:39PM +0300, Fatih Yildirim wrote:
> > > > Fix for checkpatch.pl warning:
> > > > Macros with complex values should be enclosed in parentheses.
> > > > 
> > > > Signed-off-by: Fatih Yildirim 
> > > > ---
> > > >  drivers/staging/ks7010/ks_hostif.h | 24 
> > > >  1 file changed, 12 insertions(+), 12 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/ks7010/ks_hostif.h 
> > > > b/drivers/staging/ks7010/ks_hostif.h
> > > > index 39138191a556..c62a494ed6bb 100644
> > > > --- a/drivers/staging/ks7010/ks_hostif.h
> > > > +++ b/drivers/staging/ks7010/ks_hostif.h
> > > > @@ -498,20 +498,20 @@ struct hostif_mic_failure_request {
> > > >  #define TX_RATE_FIXED  5
> > > >  
> > > >  /* 11b rate */
> > > > -#define TX_RATE_1M (u8)(10 / 5)/* 11b 11g basic rate */
> > > > -#define TX_RATE_2M (u8)(20 / 5)/* 11b 11g basic rate */
> > > > -#define TX_RATE_5M (u8)(55 / 5)/* 11g basic rate */
> > > > -#define TX_RATE_11M(u8)(110 / 5)   /* 11g basic rate */
> > > > +#define TX_RATE_1M ((u8)(10 / 5))  /* 11b 11g basic rate */
> > > > +#define TX_RATE_2M ((u8)(20 / 5))  /* 11b 11g basic rate */
> > > > +#define TX_RATE_5M ((u8)(55 / 5))  /* 11g basic rate */
> > > > +#define TX_RATE_11M((u8)(110 / 5)) /* 11g basic rate */
> > > 
> > > But these are not "complex macros" that need an extra () added to them,
> > > right?
> > > 
> > > Checkpatch is a hint, it's not a code parser and can not always know
> > > what is happening.  With your knowledge of C, does this look like
> > > something that needs to be "fixed"?
> > > 
> > > thanks,
> > > 
> > > greg k-h
> > 
> > Hi Greg,
> > 
> > Thanks for your reply.
> > Actually, I'm following the Eudyptula Challenge and I'm at task 10.
> 
> First rule of that challenge is that you are not allowed to talk about
> it in public :)
> 
> That being said, you didn't answer any of my questions above :(
> 
> greg k-h

Ohh no, missed the rule. Sorry for that, I feel rookie :)
You are right, they are not complex macros.
Besides that, type cast operator doesn't have the highest precedence.
So, I think we can use enclosing paranthesis.

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


Re: [PATCH -next] staging: ks7010: Macros with complex values

2021-02-11 Thread Fatih YILDIRIM
Ok, thanks!

On Thu, Feb 11, 2021 at 3:52 PM Greg KH  wrote:
>
> On Thu, Feb 11, 2021 at 03:23:24PM +0300, Fatih Yildirim wrote:
> > On Thu, Feb 11, 2021 at 12:10:44PM +0100, Greg KH wrote:
> > > On Thu, Feb 11, 2021 at 01:57:04PM +0300, Fatih YILDIRIM wrote:
> > > > On Thu, Feb 11, 2021 at 11:02:51AM +0100, Greg KH wrote:
> > > > > On Thu, Feb 11, 2021 at 12:22:39PM +0300, Fatih Yildirim wrote:
> > > > > > Fix for checkpatch.pl warning:
> > > > > > Macros with complex values should be enclosed in parentheses.
> > > > > >
> > > > > > Signed-off-by: Fatih Yildirim 
> > > > > > ---
> > > > > >  drivers/staging/ks7010/ks_hostif.h | 24 
> > > > > >  1 file changed, 12 insertions(+), 12 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/staging/ks7010/ks_hostif.h 
> > > > > > b/drivers/staging/ks7010/ks_hostif.h
> > > > > > index 39138191a556..c62a494ed6bb 100644
> > > > > > --- a/drivers/staging/ks7010/ks_hostif.h
> > > > > > +++ b/drivers/staging/ks7010/ks_hostif.h
> > > > > > @@ -498,20 +498,20 @@ struct hostif_mic_failure_request {
> > > > > >  #define TX_RATE_FIXED5
> > > > > >
> > > > > >  /* 11b rate */
> > > > > > -#define TX_RATE_1M   (u8)(10 / 5)/* 11b 11g basic rate */
> > > > > > -#define TX_RATE_2M   (u8)(20 / 5)/* 11b 11g basic rate */
> > > > > > -#define TX_RATE_5M   (u8)(55 / 5)/* 11g basic rate */
> > > > > > -#define TX_RATE_11M  (u8)(110 / 5)   /* 11g basic rate */
> > > > > > +#define TX_RATE_1M   ((u8)(10 / 5))  /* 11b 11g basic rate */
> > > > > > +#define TX_RATE_2M   ((u8)(20 / 5))  /* 11b 11g basic rate */
> > > > > > +#define TX_RATE_5M   ((u8)(55 / 5))  /* 11g basic rate */
> > > > > > +#define TX_RATE_11M  ((u8)(110 / 5)) /* 11g basic rate */
> > > > >
> > > > > But these are not "complex macros" that need an extra () added to 
> > > > > them,
> > > > > right?
> > > > >
> > > > > Checkpatch is a hint, it's not a code parser and can not always know
> > > > > what is happening.  With your knowledge of C, does this look like
> > > > > something that needs to be "fixed"?
> > > > >
> > > > > thanks,
> > > > >
> > > > > greg k-h
> > > >
> > > > Hi Greg,
> > > >
> > > > Thanks for your reply.
> > > > Actually, I'm following the Eudyptula Challenge and I'm at task 10.
> > >
> > > First rule of that challenge is that you are not allowed to talk about
> > > it in public :)
> > >
> > > That being said, you didn't answer any of my questions above :(
> > >
> > > greg k-h
> >
> > Ohh no, missed the rule. Sorry for that, I feel rookie :)
> > You are right, they are not complex macros.
> > Besides that, type cast operator doesn't have the highest precedence.
> > So, I think we can use enclosing paranthesis.
>
> I don't think they are needed, see how these are used please.
>
> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next] staging: nvec: minor coding style fix

2021-02-11 Thread Fatih Yildirim
Fix for the below coding style warning.
Warning: Move const after static - use 'static const int'

Signed-off-by: Fatih Yildirim 
---
 drivers/staging/nvec/nvec_power.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/nvec/nvec_power.c 
b/drivers/staging/nvec/nvec_power.c
index 0e861c4bfcbf..b1ef196e1cfe 100644
--- a/drivers/staging/nvec/nvec_power.c
+++ b/drivers/staging/nvec/nvec_power.c
@@ -338,7 +338,7 @@ static const struct power_supply_desc nvec_psy_desc = {
 };
 
 static int counter;
-static int const bat_iter[] = {
+static const int bat_iter[] = {
SLOT_STATUS, VOLTAGE, CURRENT, CAPACITY_REMAINING,
 #ifdef EC_FULL_DIAG
AVERAGE_CURRENT, TEMPERATURE, TIME_REMAINING,
-- 
2.20.1

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


[PATCH -next] staging: comedi dt2814: Removed unused variables

2021-02-21 Thread Fatih Yildirim
Removed unused variables.

Signed-off-by: Fatih Yildirim 
---
 drivers/staging/comedi/drivers/dt2814.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2814.c 
b/drivers/staging/comedi/drivers/dt2814.c
index bcf4d5444faf..bd329d7b4893 100644
--- a/drivers/staging/comedi/drivers/dt2814.c
+++ b/drivers/staging/comedi/drivers/dt2814.c
@@ -186,21 +186,17 @@ static int dt2814_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
 
 static irqreturn_t dt2814_interrupt(int irq, void *d)
 {
-   int lo, hi;
struct comedi_device *dev = d;
struct dt2814_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
-   int data;
 
if (!dev->attached) {
dev_err(dev->class_dev, "spurious interrupt\n");
return IRQ_HANDLED;
}
 
-   hi = inb(dev->iobase + DT2814_DATA);
-   lo = inb(dev->iobase + DT2814_DATA);
-
-   data = (hi << 4) | (lo >> 4);
+   inb(dev->iobase + DT2814_DATA);
+   inb(dev->iobase + DT2814_DATA);
 
if (!(--devpriv->ntrig)) {
int i;
@@ -229,7 +225,6 @@ static int dt2814_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
struct dt2814_private *devpriv;
struct comedi_subdevice *s;
int ret;
-   int i;
 
ret = comedi_request_region(dev, it->options[0], 0x2);
if (ret)
@@ -241,8 +236,8 @@ static int dt2814_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
dev_err(dev->class_dev, "reset error (fatal)\n");
return -EIO;
}
-   i = inb(dev->iobase + DT2814_DATA);
-   i = inb(dev->iobase + DT2814_DATA);
+   inb(dev->iobase + DT2814_DATA);
+   inb(dev->iobase + DT2814_DATA);
 
if (it->options[1]) {
ret = request_irq(it->options[1], dt2814_interrupt, 0,
-- 
2.20.1

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