Re: [Outreachy kernel] [PATCH] Staging: irda: Use !x instead of NULL comparison

2017-09-16 Thread Julia Lawall


On Sat, 16 Sep 2017, Srishti Sharma wrote:

> Test for NULL as !x where functions that return NULL on failure
> are used. Done using the following semantic patch by coccinelle.
>
> @ is_null @
> expression E;
> statement S;
> @@
>
> E = (\(kmalloc\|devm_kzalloc\|kmalloc_array\|devm_ioremap\|
> usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\)(...));
>
> (
> if(!E)
>S
> |
> -if(E==NULL)
> +if(!E)
> S
> )
>
> Signed-off-by: Srishti Sharma 

Acked-by: Julia Lawall 


> ---
>  drivers/staging/irda/net/discovery.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/irda/net/discovery.c 
> b/drivers/staging/irda/net/discovery.c
> index 364d70a..1e54954 100644
> --- a/drivers/staging/irda/net/discovery.c
> +++ b/drivers/staging/irda/net/discovery.c
> @@ -179,7 +179,7 @@ void irlmp_expire_discoveries(hashbin_t *log, __u32 
> saddr, int force)
>   /* Create the client specific buffer */
>   n = HASHBIN_GET_SIZE(log);
>   buffer = kmalloc(n * sizeof(struct 
> irda_device_info), GFP_ATOMIC);
> - if (buffer == NULL) {
> + if (!buffer) {
>   
> spin_unlock_irqrestore(&log->hb_spinlock, flags);
>   return;
>   }
> @@ -291,7 +291,7 @@ struct irda_device_info *irlmp_copy_discoveries(hashbin_t 
> *log, int *pn,
>   /* Create the client specific buffer */
>   n = HASHBIN_GET_SIZE(log);
>   buffer = kmalloc(n * sizeof(struct 
> irda_device_info), GFP_ATOMIC);
> - if (buffer == NULL) {
> + if (!buffer) {
>   
> spin_unlock_irqrestore(&log->hb_spinlock, flags);
>   return NULL;
>   }
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1505543667-4670-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] staging: lustre: lnet: Replace list_for_each with list_for_each_entry

2017-09-16 Thread Julia Lawall


On Fri, 15 Sep 2017, Haneen Mohammed wrote:

> Replace use of the combination of list_for_each and list_entry
> with list_for_each_entry to simplify the code and remove variables
> that are used only in list_for_each.
> Issue found and corrected using Coccinelle script:
>
> @r@
> expression head, member, e;
> type T1, T2, T3;
> iterator name list_for_each, list_for_each_entry;
> identifier pos, var;
> @@
>
> -T1 *pos;
> ...when!=pos=e;
>
> -list_for_each(pos, head)
> +list_for_each_entry(var, head, member)
> {
> ...when!=pos=e;
>when!=T3 *var;
> -var = list_entry(pos, T2, member);
> ...when!=pos=e;
> }
> ...when!=pos=e;

Actually, one could consider that there should be when != pos, not when !=
pos=e, because you need that there are no references at all to pos to be
able to delete it.  But it's true that if pos is not initialized then
there should be no other kinds of references either.  The other
possibility for initialization would be eg

f(...,&pos,...)

You could be suspicious of &pos in general.  But anyway there is no &pos
in this code.

julia

> Signed-off-by: Haneen Mohammed 

Acked-by: Julia Lawall 

> ---
>  drivers/staging/lustre/lnet/lnet/router.c | 9 ++---
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/lustre/lnet/lnet/router.c 
> b/drivers/staging/lustre/lnet/lnet/router.c
> index 3df101b..b8eba33 100644
> --- a/drivers/staging/lustre/lnet/lnet/router.c
> +++ b/drivers/staging/lustre/lnet/lnet/router.c
> @@ -222,15 +222,12 @@ struct lnet_remotenet *
>  lnet_find_net_locked(__u32 net)
>  {
>   struct lnet_remotenet *rnet;
> - struct list_head *tmp;
>   struct list_head *rn_list;
>
>   LASSERT(!the_lnet.ln_shutdown);
>
>   rn_list = lnet_net2rnethash(net);
> - list_for_each(tmp, rn_list) {
> - rnet = list_entry(tmp, struct lnet_remotenet, lrn_list);
> -
> + list_for_each_entry(rnet, rn_list, lrn_list) {
>   if (rnet->lrn_net == net)
>   return rnet;
>   }
> @@ -243,7 +240,6 @@ static void lnet_shuffle_seed(void)
>   __u32 lnd_type, seed[2];
>   struct timespec64 ts;
>   struct lnet_ni *ni;
> - struct list_head *tmp;
>
>   if (seeded)
>   return;
> @@ -254,8 +250,7 @@ static void lnet_shuffle_seed(void)
>* Nodes with small feet have little entropy
>* the NID for this node gives the most entropy in the low bits
>*/
> - list_for_each(tmp, &the_lnet.ln_nis) {
> - ni = list_entry(tmp, struct lnet_ni, ni_list);
> + list_for_each_entry(ni, &the_lnet.ln_nis, ni_list) {
>   lnd_type = LNET_NETTYP(LNET_NIDNET(ni->ni_nid));
>
>   if (lnd_type != LOLND)
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20170916004148.GA25693%40Haneen.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: iio: tsl2x7x: clean up limit checks

2017-09-16 Thread Dan Carpenter
On Sat, Sep 16, 2017 at 01:11:29PM +0200, Paolo Cretaro wrote:
> Hi Dan,
> just minor nitpicking on the commit message:
> 
> On 08/09/2017 12:53, Dan Carpenter wrote:
> > The background of this code is that we can either use the default
> > tables or load our own table with sysfs.  The default tables are three
> > element arrays of struct tsl2x7x_lux.  If we load the table with sysfs
> > then we can have as many as nine elements.  Which ever way we do it, the
> > last element is always zeroed out.
> > 
> > The most interesting part of this patch is in the
> > in_illuminance0_lux_table_show() function.  We were using the wrong
> > limit, "TSL2X7X_MAX_LUX_TABLE_SIZE * 3", when it should have been just
> > "TSL2X7X_MAX_LUX_TABLE_SIZE".  This creates a static checker warning
> > that we are going of of bounds.  However, since the last element is
> out of bounds
> 
> Regards,
> P.
> 
> > always zeroed out, that means we hit the break statement and the code
> > works correctly despite the wrong limit check.

What?  No no.  I meant it how I wrote it.  The last element is
always zeroed out meaning it's just a series of zeroes.

regards,
dan carpenter

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


[PATCH] Staging: dgnc: Remove unused variables from structure definition

2017-09-16 Thread Srishti Sharma
Some variables in the structure were unused and hence them and
the comments associated with them can be removed.

Signed-off-by: Srishti Sharma 
---
 drivers/staging/dgnc/dgnc_driver.h | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 764d6fe..2b625cc 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -103,8 +103,6 @@ struct board_ops {
 /**
  * struct dgnc_board - Per board information.
  * @boardnum: Board number (0 - 32).
- *
- * @type: Type of board.
  * @name: Product name.
  * @pdev: Pointer to the pci_dev structure.
  * @bd_flags: Board flags.
@@ -140,13 +138,9 @@ struct board_ops {
  * @dpastatus: Board status as defined by DPA.
  * @bd_dividend: Board/UART's specific dividend.
  * @bd_ops: Pointer to board operations structure.
- * @proc_entry_pointer: Proc/ entry
- * @dgnc_board_table: Proc/ entry
  */
 struct dgnc_board {
int boardnum;
-
-   int type;
char*name;
struct pci_dev  *pdev;
unsigned long   bd_flags;
@@ -200,10 +194,6 @@ struct dgnc_board {
uintbd_dividend;
 
struct board_ops *bd_ops;
-
-   struct proc_dir_entry *proc_entry_pointer;
-   struct dgnc_proc_entry *dgnc_board_table;
-
 };
 
 /* Unit flag definitions for un_flags. */
-- 
2.7.4

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


Re: [Outreachy kernel] [PATCH] Staging: dgnc: Remove unused variables from structure definition

2017-09-16 Thread Julia Lawall


On Sat, 16 Sep 2017, Srishti Sharma wrote:

> Some variables in the structure were unused and hence them and
> the comments associated with them can be removed.

How did you find these?  The last two can easily be checked with grep, but
that is ont the case for type.

Actually there are two structures in the file with useless
proc_entry_pointer fields.  The other one has a useless
dgnc_channel_table.  It could be reasonable to make a series to do both
structures.

julia

>
> Signed-off-by: Srishti Sharma 
> ---
>  drivers/staging/dgnc/dgnc_driver.h | 10 --
>  1 file changed, 10 deletions(-)
>
> diff --git a/drivers/staging/dgnc/dgnc_driver.h 
> b/drivers/staging/dgnc/dgnc_driver.h
> index 764d6fe..2b625cc 100644
> --- a/drivers/staging/dgnc/dgnc_driver.h
> +++ b/drivers/staging/dgnc/dgnc_driver.h
> @@ -103,8 +103,6 @@ struct board_ops {
>  /**
>   * struct dgnc_board - Per board information.
>   * @boardnum: Board number (0 - 32).
> - *
> - * @type: Type of board.
>   * @name: Product name.
>   * @pdev: Pointer to the pci_dev structure.
>   * @bd_flags: Board flags.
> @@ -140,13 +138,9 @@ struct board_ops {
>   * @dpastatus: Board status as defined by DPA.
>   * @bd_dividend: Board/UART's specific dividend.
>   * @bd_ops: Pointer to board operations structure.
> - * @proc_entry_pointer: Proc/ entry
> - * @dgnc_board_table: Proc/ entry
>   */
>  struct dgnc_board {
>   int boardnum;
> -
> - int type;
>   char*name;
>   struct pci_dev  *pdev;
>   unsigned long   bd_flags;
> @@ -200,10 +194,6 @@ struct dgnc_board {
>   uintbd_dividend;
>
>   struct board_ops *bd_ops;
> -
> - struct proc_dir_entry *proc_entry_pointer;
> - struct dgnc_proc_entry *dgnc_board_table;
> -
>  };
>
>  /* Unit flag definitions for un_flags. */
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/1505562186-11813-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: iio: tsl2x7x: clean up limit checks

2017-09-16 Thread Paolo Cretaro
Hi Dan,
just minor nitpicking on the commit message:

On 08/09/2017 12:53, Dan Carpenter wrote:
> The background of this code is that we can either use the default
> tables or load our own table with sysfs.  The default tables are three
> element arrays of struct tsl2x7x_lux.  If we load the table with sysfs
> then we can have as many as nine elements.  Which ever way we do it, the
> last element is always zeroed out.
> 
> The most interesting part of this patch is in the
> in_illuminance0_lux_table_show() function.  We were using the wrong
> limit, "TSL2X7X_MAX_LUX_TABLE_SIZE * 3", when it should have been just
> "TSL2X7X_MAX_LUX_TABLE_SIZE".  This creates a static checker warning
> that we are going of of bounds.  However, since the last element is
out of bounds

Regards,
P.

> always zeroed out, that means we hit the break statement and the code
> works correctly despite the wrong limit check.
> 
> I made several related readability changes.  The most notable that I
> changed the MAX_DEFAULT_TABLE_BYTES define which was:
> 
> #define MAX_DEFAULT_TABLE_BYTES (sizeof(int) * TSL2X7X_MAX_LUX_TABLE_SIZE)
> 
> I renamed the define to TSL2X7X_DEFAULT_TABLE_BYTES because it's not the
> max size, it's the only size.  Also the size should really be expressed
> as sizeof(struct tsl2x7x_lux) * 3.  In other words, 12 * 3 instead of
> 4 * 9.  It's 36 bytes either way, so this doesn't change the behavior.
> 
> Finally, I created the TSL2X7X_DEF_LUX_TABLE_SZ define instead of using
> the magic number 3.  I declared the default tables using that define
> to hopefully signal to future programmers that if they want to use a
> different size they have to update all the related code.
> 
> Signed-off-by: Dan Carpenter 
> 
> diff --git a/drivers/staging/iio/light/tsl2x7x.h 
> b/drivers/staging/iio/light/tsl2x7x.h
> index ecae92211216..a216c6943a84 100644
> --- a/drivers/staging/iio/light/tsl2x7x.h
> +++ b/drivers/staging/iio/light/tsl2x7x.h
> @@ -23,10 +23,6 @@
>  #define __TSL2X7X_H
>  #include 
>  
> -/* Max number of segments allowable in LUX table */
> -#define TSL2X7X_MAX_LUX_TABLE_SIZE   9
> -#define MAX_DEFAULT_TABLE_BYTES (sizeof(int) * TSL2X7X_MAX_LUX_TABLE_SIZE)
> -
>  struct iio_dev;
>  
>  struct tsl2x7x_lux {
> @@ -35,6 +31,13 @@ struct tsl2x7x_lux {
>   unsigned int ch1;
>  };
>  
> +/* Max number of segments allowable in LUX table */
> +#define TSL2X7X_MAX_LUX_TABLE_SIZE   9
> +/* The default LUX tables all have 3 elements.  */
> +#define TSL2X7X_DEF_LUX_TABLE_SZ 3
> +#define TSL2X7X_DEFAULT_TABLE_BYTES (sizeof(struct tsl2x7x_lux) * \
> +  TSL2X7X_DEF_LUX_TABLE_SZ)
> +
>  /**
>   * struct tsl2x7x_default_settings - power on defaults unless
>   *   overridden by platform data.
> diff --git a/drivers/staging/iio/light/tsl2x7x.c 
> b/drivers/staging/iio/light/tsl2x7x.c
> index 786e93f16ce9..b3a9efecf536 100644
> --- a/drivers/staging/iio/light/tsl2x7x.c
> +++ b/drivers/staging/iio/light/tsl2x7x.c
> @@ -192,25 +192,25 @@ struct tsl2X7X_chip {
>  };
>  
>  /* Different devices require different coefficents */
> -static const struct tsl2x7x_lux tsl2x71_lux_table[] = {
> +static const struct tsl2x7x_lux tsl2x71_lux_table[TSL2X7X_DEF_LUX_TABLE_SZ] 
> = {
>   { 14461,   611,   1211 },
>   { 18540,   352,623 },
>   { 0, 0,  0 },
>  };
>  
> -static const struct tsl2x7x_lux tmd2x71_lux_table[] = {
> +static const struct tsl2x7x_lux tmd2x71_lux_table[TSL2X7X_DEF_LUX_TABLE_SZ] 
> = {
>   { 11635,   115,256 },
>   { 15536,87,179 },
>   { 0, 0,  0 },
>  };
>  
> -static const struct tsl2x7x_lux tsl2x72_lux_table[] = {
> +static const struct tsl2x7x_lux tsl2x72_lux_table[TSL2X7X_DEF_LUX_TABLE_SZ] 
> = {
>   { 14013,   466,   917 },
>   { 18222,   310,   552 },
>   { 0, 0, 0 },
>  };
>  
> -static const struct tsl2x7x_lux tmd2x72_lux_table[] = {
> +static const struct tsl2x7x_lux tmd2x72_lux_table[TSL2X7X_DEF_LUX_TABLE_SZ] 
> = {
>   { 13218,   130,   262 },
>   { 17592,   92,169 },
>   { 0, 0, 0 },
> @@ -530,7 +530,7 @@ static void tsl2x7x_defaults(struct tsl2X7X_chip *chip)
>   else
>   memcpy(chip->tsl2x7x_device_lux,
>   (struct tsl2x7x_lux *)tsl2x7x_default_lux_table_group[chip->id],
> - MAX_DEFAULT_TABLE_BYTES);
> + TSL2X7X_DEFAULT_TABLE_BYTES);
>  }
>  
>  /**
> @@ -1113,7 +1113,7 @@ static ssize_t in_illuminance0_lux_table_show(struct 
> device *dev,
>   int i = 0;
>   int offset = 0;
>  
> - while (i < (TSL2X7X_MAX_LUX_TABLE_SIZE * 3)) {
> + while (i < TSL2X7X_MAX_LUX_TABLE_SIZE) {
>   offset += snprintf(buf + offset, PAGE_SIZE, "%u,%u,%u,",
>   chip->tsl2x7x_device_lux[i].ratio,
>   chip->tsl2x7x_device_lux[i].ch0,
> 
___

Re: [Outreachy kernel] [PATCH] Staging: dgnc: Remove unused variables from structure definition

2017-09-16 Thread Srishti Sharma
On Sat, Sep 16, 2017 at 5:20 PM, Julia Lawall  wrote:
>
>
> On Sat, 16 Sep 2017, Srishti Sharma wrote:
>
>> Some variables in the structure were unused and hence them and
>> the comments associated with them can be removed.
>
> How did you find these?  The last two can easily be checked with grep, but
> that is ont the case for type.

I removed them and then compiled the code to see if it still compiles.
I was using grep earlier to see if the fields in the structure are
ever accessed by the variables of that structure type, as the TODO of
the driver says that there is a lot of unneeded code.
>
> Actually there are two structures in the file with useless
> proc_entry_pointer fields.  The other one has a useless
> dgnc_channel_table.  It could be reasonable to make a series to do both
> structures.

Okay, I'll send them as a series. Thanks

Regards,
Srishti

> julia
>
>>
>> Signed-off-by: Srishti Sharma 
>> ---
>>  drivers/staging/dgnc/dgnc_driver.h | 10 --
>>  1 file changed, 10 deletions(-)
>>
>> diff --git a/drivers/staging/dgnc/dgnc_driver.h 
>> b/drivers/staging/dgnc/dgnc_driver.h
>> index 764d6fe..2b625cc 100644
>> --- a/drivers/staging/dgnc/dgnc_driver.h
>> +++ b/drivers/staging/dgnc/dgnc_driver.h
>> @@ -103,8 +103,6 @@ struct board_ops {
>>  /**
>>   * struct dgnc_board - Per board information.
>>   * @boardnum: Board number (0 - 32).
>> - *
>> - * @type: Type of board.
>>   * @name: Product name.
>>   * @pdev: Pointer to the pci_dev structure.
>>   * @bd_flags: Board flags.
>> @@ -140,13 +138,9 @@ struct board_ops {
>>   * @dpastatus: Board status as defined by DPA.
>>   * @bd_dividend: Board/UART's specific dividend.
>>   * @bd_ops: Pointer to board operations structure.
>> - * @proc_entry_pointer: Proc/ entry
>> - * @dgnc_board_table: Proc/ entry
>>   */
>>  struct dgnc_board {
>>   int boardnum;
>> -
>> - int type;
>>   char*name;
>>   struct pci_dev  *pdev;
>>   unsigned long   bd_flags;
>> @@ -200,10 +194,6 @@ struct dgnc_board {
>>   uintbd_dividend;
>>
>>   struct board_ops *bd_ops;
>> -
>> - struct proc_dir_entry *proc_entry_pointer;
>> - struct dgnc_proc_entry *dgnc_board_table;
>> -
>>  };
>>
>>  /* Unit flag definitions for un_flags. */
>> --
>> 2.7.4
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to outreachy-kernel+unsubscr...@googlegroups.com.
>> To post to this group, send email to outreachy-ker...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/outreachy-kernel/1505562186-11813-1-git-send-email-srishtishar%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] Staging: dgnc: Remove unused variables from structure definition

2017-09-16 Thread Julia Lawall


On Sat, 16 Sep 2017, Srishti Sharma wrote:

> On Sat, Sep 16, 2017 at 5:20 PM, Julia Lawall  wrote:
> >
> >
> > On Sat, 16 Sep 2017, Srishti Sharma wrote:
> >
> >> Some variables in the structure were unused and hence them and
> >> the comments associated with them can be removed.
> >
> > How did you find these?  The last two can easily be checked with grep, but
> > that is ont the case for type.
>
> I removed them and then compiled the code to see if it still compiles.

This is not 100% reliable because of the possibility of uses inside
ifdefs.  So you need to double check that you have found every occurrence
of the structure type for the type field.  The others seem not dangerous.

julia

> I was using grep earlier to see if the fields in the structure are
> ever accessed by the variables of that structure type, as the TODO of
> the driver says that there is a lot of unneeded code.
> >
> > Actually there are two structures in the file with useless
> > proc_entry_pointer fields.  The other one has a useless
> > dgnc_channel_table.  It could be reasonable to make a series to do both
> > structures.
>
> Okay, I'll send them as a series. Thanks
>
> Regards,
> Srishti
>
> > julia
> >
> >>
> >> Signed-off-by: Srishti Sharma 
> >> ---
> >>  drivers/staging/dgnc/dgnc_driver.h | 10 --
> >>  1 file changed, 10 deletions(-)
> >>
> >> diff --git a/drivers/staging/dgnc/dgnc_driver.h 
> >> b/drivers/staging/dgnc/dgnc_driver.h
> >> index 764d6fe..2b625cc 100644
> >> --- a/drivers/staging/dgnc/dgnc_driver.h
> >> +++ b/drivers/staging/dgnc/dgnc_driver.h
> >> @@ -103,8 +103,6 @@ struct board_ops {
> >>  /**
> >>   * struct dgnc_board - Per board information.
> >>   * @boardnum: Board number (0 - 32).
> >> - *
> >> - * @type: Type of board.
> >>   * @name: Product name.
> >>   * @pdev: Pointer to the pci_dev structure.
> >>   * @bd_flags: Board flags.
> >> @@ -140,13 +138,9 @@ struct board_ops {
> >>   * @dpastatus: Board status as defined by DPA.
> >>   * @bd_dividend: Board/UART's specific dividend.
> >>   * @bd_ops: Pointer to board operations structure.
> >> - * @proc_entry_pointer: Proc/ entry
> >> - * @dgnc_board_table: Proc/ entry
> >>   */
> >>  struct dgnc_board {
> >>   int boardnum;
> >> -
> >> - int type;
> >>   char*name;
> >>   struct pci_dev  *pdev;
> >>   unsigned long   bd_flags;
> >> @@ -200,10 +194,6 @@ struct dgnc_board {
> >>   uintbd_dividend;
> >>
> >>   struct board_ops *bd_ops;
> >> -
> >> - struct proc_dir_entry *proc_entry_pointer;
> >> - struct dgnc_proc_entry *dgnc_board_table;
> >> -
> >>  };
> >>
> >>  /* Unit flag definitions for un_flags. */
> >> --
> >> 2.7.4
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups 
> >> "outreachy-kernel" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an 
> >> email to outreachy-kernel+unsubscr...@googlegroups.com.
> >> To post to this group, send email to outreachy-ker...@googlegroups.com.
> >> To view this discussion on the web visit 
> >> https://groups.google.com/d/msgid/outreachy-kernel/1505562186-11813-1-git-send-email-srishtishar%40gmail.com.
> >> For more options, visit https://groups.google.com/d/optout.
> >>
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: iio: tsl2x7x: clean up limit checks

2017-09-16 Thread Paolo Cretaro
On 16/09/2017 13:37, Dan Carpenter wrote:
> On Sat, Sep 16, 2017 at 01:11:29PM +0200, Paolo Cretaro wrote:
>> Hi Dan,
>> just minor nitpicking on the commit message:
>>
>> On 08/09/2017 12:53, Dan Carpenter wrote:
>>> The background of this code is that we can either use the default
>>> tables or load our own table with sysfs.  The default tables are three
>>> element arrays of struct tsl2x7x_lux.  If we load the table with sysfs
>>> then we can have as many as nine elements.  Which ever way we do it, the
>>> last element is always zeroed out.
>>>
>>> The most interesting part of this patch is in the
>>> in_illuminance0_lux_table_show() function.  We were using the wrong
>>> limit, "TSL2X7X_MAX_LUX_TABLE_SIZE * 3", when it should have been just
>>> "TSL2X7X_MAX_LUX_TABLE_SIZE".  This creates a static checker warning
>>> that we are going of of bounds.  However, since the last element is
>> out of bounds
>>
>> Regards,
>> P.
>>
>>> always zeroed out, that means we hit the break statement and the code
>>> works correctly despite the wrong limit check.
> 
> What?  No no.  I meant it how I wrote it.  The last element is
> always zeroed out meaning it's just a series of zeroes.

Sorry, I meant the previous sentence "This creates a static checker warning
that we are going of of bounds".

Regards,
P.

> 
> regards,
> dan carpenter
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] Staging: dgnc: Remove unused variables from structure definition

2017-09-16 Thread Srishti Sharma
On Sat, Sep 16, 2017 at 5:45 PM, Julia Lawall  wrote:
>
>
> On Sat, 16 Sep 2017, Srishti Sharma wrote:
>
>> On Sat, Sep 16, 2017 at 5:20 PM, Julia Lawall  wrote:
>> >
>> >
>> > On Sat, 16 Sep 2017, Srishti Sharma wrote:
>> >
>> >> Some variables in the structure were unused and hence them and
>> >> the comments associated with them can be removed.
>> >
>> > How did you find these?  The last two can easily be checked with grep, but
>> > that is ont the case for type.
>>
>> I removed them and then compiled the code to see if it still compiles.
>
> This is not 100% reliable because of the possibility of uses inside
> ifdefs.  So you need to double check that you have found every occurrence
> of the structure type for the type field.  The others seem not dangerous.

Okay, I'll do that . Thanks

Srishti
>
> julia
>
>> I was using grep earlier to see if the fields in the structure are
>> ever accessed by the variables of that structure type, as the TODO of
>> the driver says that there is a lot of unneeded code.
>> >
>> > Actually there are two structures in the file with useless
>> > proc_entry_pointer fields.  The other one has a useless
>> > dgnc_channel_table.  It could be reasonable to make a series to do both
>> > structures.
>>
>> Okay, I'll send them as a series. Thanks
>>
>> Regards,
>> Srishti
>>
>> > julia
>> >
>> >>
>> >> Signed-off-by: Srishti Sharma 
>> >> ---
>> >>  drivers/staging/dgnc/dgnc_driver.h | 10 --
>> >>  1 file changed, 10 deletions(-)
>> >>
>> >> diff --git a/drivers/staging/dgnc/dgnc_driver.h 
>> >> b/drivers/staging/dgnc/dgnc_driver.h
>> >> index 764d6fe..2b625cc 100644
>> >> --- a/drivers/staging/dgnc/dgnc_driver.h
>> >> +++ b/drivers/staging/dgnc/dgnc_driver.h
>> >> @@ -103,8 +103,6 @@ struct board_ops {
>> >>  /**
>> >>   * struct dgnc_board - Per board information.
>> >>   * @boardnum: Board number (0 - 32).
>> >> - *
>> >> - * @type: Type of board.
>> >>   * @name: Product name.
>> >>   * @pdev: Pointer to the pci_dev structure.
>> >>   * @bd_flags: Board flags.
>> >> @@ -140,13 +138,9 @@ struct board_ops {
>> >>   * @dpastatus: Board status as defined by DPA.
>> >>   * @bd_dividend: Board/UART's specific dividend.
>> >>   * @bd_ops: Pointer to board operations structure.
>> >> - * @proc_entry_pointer: Proc/ entry
>> >> - * @dgnc_board_table: Proc/ entry
>> >>   */
>> >>  struct dgnc_board {
>> >>   int boardnum;
>> >> -
>> >> - int type;
>> >>   char*name;
>> >>   struct pci_dev  *pdev;
>> >>   unsigned long   bd_flags;
>> >> @@ -200,10 +194,6 @@ struct dgnc_board {
>> >>   uintbd_dividend;
>> >>
>> >>   struct board_ops *bd_ops;
>> >> -
>> >> - struct proc_dir_entry *proc_entry_pointer;
>> >> - struct dgnc_proc_entry *dgnc_board_table;
>> >> -
>> >>  };
>> >>
>> >>  /* Unit flag definitions for un_flags. */
>> >> --
>> >> 2.7.4
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google Groups 
>> >> "outreachy-kernel" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send an 
>> >> email to outreachy-kernel+unsubscr...@googlegroups.com.
>> >> To post to this group, send email to outreachy-ker...@googlegroups.com.
>> >> To view this discussion on the web visit 
>> >> https://groups.google.com/d/msgid/outreachy-kernel/1505562186-11813-1-git-send-email-srishtishar%40gmail.com.
>> >> For more options, visit https://groups.google.com/d/optout.
>> >>
>>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] Remove unused variables in structure definition

2017-09-16 Thread Srishti Sharma
This patch series attempts to remove unused variables in structure
variables and the comments associated with them.

Srishti Sharma (2):
  Staging: dgnc: Remove unused variables in structure definition
  Staging: dgnc: Remove unused variable in structure

 drivers/staging/dgnc/dgnc_driver.h | 15 ---
 1 file changed, 15 deletions(-)

-- 
2.7.4

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


[PATCH 1/2] Staging: dgnc: Remove unused variables in struct dgnc_board

2017-09-16 Thread Srishti Sharma
Remove unused variables and comments associated with them in
the structure definition.

Signed-off-by: Srishti Sharma 
---
 drivers/staging/dgnc/dgnc_driver.h | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 764d6fe..5d2566e 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -104,7 +104,6 @@ struct board_ops {
  * struct dgnc_board - Per board information.
  * @boardnum: Board number (0 - 32).
  *
- * @type: Type of board.
  * @name: Product name.
  * @pdev: Pointer to the pci_dev structure.
  * @bd_flags: Board flags.
@@ -140,13 +139,9 @@ struct board_ops {
  * @dpastatus: Board status as defined by DPA.
  * @bd_dividend: Board/UART's specific dividend.
  * @bd_ops: Pointer to board operations structure.
- * @proc_entry_pointer: Proc/ entry
- * @dgnc_board_table: Proc/ entry
  */
 struct dgnc_board {
int boardnum;
-
-   int type;
char*name;
struct pci_dev  *pdev;
unsigned long   bd_flags;
@@ -200,10 +195,6 @@ struct dgnc_board {
uintbd_dividend;
 
struct board_ops *bd_ops;
-
-   struct proc_dir_entry *proc_entry_pointer;
-   struct dgnc_proc_entry *dgnc_board_table;
-
 };
 
 /* Unit flag definitions for un_flags. */
-- 
2.7.4

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


[PATCH 2/2] Staging: dgnc: Remove unused variable in struct channel_t

2017-09-16 Thread Srishti Sharma
Eliminate the variables that are not used and the comments
associated with them.

Signed-off-by: Srishti Sharma 
---
 drivers/staging/dgnc/dgnc_driver.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 5d2566e..082d659 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -312,8 +312,6 @@ struct un_t {
  * @ch_err_overrun: Count of overruns on channel.
  * @ch_xon_sends: Count of xons transmitted.
  * @ch_xoff_sends: Count of xoffs transmitted.
- * @proc_entry_pointer: Proc// entry.
- * @dgnc_channel_table: Proc// entry.
  */
 struct channel_t {
struct dgnc_board *ch_bd;
@@ -382,10 +380,6 @@ struct channel_t {
 
ulong   ch_xon_sends;
ulong   ch_xoff_sends;
-
-   struct proc_dir_entry *proc_entry_pointer;
-   struct dgnc_proc_entry *dgnc_channel_table;
-
 };
 
 extern uintdgnc_major; /* Our driver/mgmt major */
-- 
2.7.4

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


Re: [Outreachy kernel] [PATCH 0/2] Remove unused variables in structure definition

2017-09-16 Thread Julia Lawall


On Sat, 16 Sep 2017, Srishti Sharma wrote:

> This patch series attempts to remove unused variables in structure
> variables and the comments associated with them.

Actually, I would say that a structure has fields, not variables.

julia

>
> Srishti Sharma (2):
>   Staging: dgnc: Remove unused variables in structure definition
>   Staging: dgnc: Remove unused variable in structure
>
>  drivers/staging/dgnc/dgnc_driver.h | 15 ---
>  1 file changed, 15 deletions(-)
>
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/cover.1505572018.git.srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: ccree: remove unused and redundant variable idx

2017-09-16 Thread Colin King
From: Colin Ian King 

Variable idx is being set but never read and thus it can be
removed because it is redundant. Cleans up clang build warnings:

warning: Value stored to 'idx' during its initialization is never read
warning: Value stored to 'idx' is never read
warning: Value stored to 'idx' is never read

Signed-off-by: Colin Ian King 
---
 drivers/staging/ccree/ssi_aead.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 5abe6b24ff8c..8d6b95efce86 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -1812,7 +1812,6 @@ static inline int ssi_aead_gcm(
unsigned int *seq_size)
 {
struct aead_req_ctx *req_ctx = aead_request_ctx(req);
-   unsigned int idx = *seq_size;
unsigned int cipher_flow_mode;
 
if (req_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
@@ -1829,7 +1828,6 @@ static inline int ssi_aead_gcm(
ssi_aead_create_assoc_desc(req, DIN_HASH, desc, seq_size);
ssi_aead_gcm_setup_gctr_desc(req, desc, seq_size);
ssi_aead_process_gcm_result_desc(req, desc, seq_size);
-   idx = *seq_size;
return 0;
}
 
@@ -1844,7 +1842,6 @@ static inline int ssi_aead_gcm(
ssi_aead_process_cipher_data_desc(req, cipher_flow_mode, desc, 
seq_size);
ssi_aead_process_gcm_result_desc(req, desc, seq_size);
 
-   idx = *seq_size;
return 0;
 }
 
-- 
2.14.1

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


[PATCH v2 0/2] Remove unused fields in structure definition

2017-09-16 Thread Srishti Sharma
Remove fields that are not used, from structure definitions , and 
eliminate the comments associated with them.

Srishti Sharma (2):
  Staging: dgnc: Remove unused variables in structure definition
  Staging: dgnc: Remove unused variable in structure

 drivers/staging/dgnc/dgnc_driver.h | 15 ---
 1 file changed, 15 deletions(-)

-- 
2.7.4

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


[PATCH v2 2/2] Staging: dgnc: Remove unused fields in struct channel_t

2017-09-16 Thread Srishti Sharma
Eliminate the fields that are not used and the comments
associated with them.

Signed-off-by: Srishti Sharma 
---
Changes in v2:
 - Use the word field instead of variable.

 drivers/staging/dgnc/dgnc_driver.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 5d2566e..082d659 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -312,8 +312,6 @@ struct un_t {
  * @ch_err_overrun: Count of overruns on channel.
  * @ch_xon_sends: Count of xons transmitted.
  * @ch_xoff_sends: Count of xoffs transmitted.
- * @proc_entry_pointer: Proc// entry.
- * @dgnc_channel_table: Proc// entry.
  */
 struct channel_t {
struct dgnc_board *ch_bd;
@@ -382,10 +380,6 @@ struct channel_t {
 
ulong   ch_xon_sends;
ulong   ch_xoff_sends;
-
-   struct proc_dir_entry *proc_entry_pointer;
-   struct dgnc_proc_entry *dgnc_channel_table;
-
 };
 
 extern uintdgnc_major; /* Our driver/mgmt major */
-- 
2.7.4

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


[PATCH v2 1/2] Staging: dgnc: Remove unused fields in struct dgnc_board

2017-09-16 Thread Srishti Sharma
Remove unused fields and comments associated with them in
the structure definition.

Signed-off-by: Srishti Sharma 
---
Changes in v2:
 - Use the word field instead of variable.

 drivers/staging/dgnc/dgnc_driver.h | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 764d6fe..5d2566e 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -104,7 +104,6 @@ struct board_ops {
  * struct dgnc_board - Per board information.
  * @boardnum: Board number (0 - 32).
  *
- * @type: Type of board.
  * @name: Product name.
  * @pdev: Pointer to the pci_dev structure.
  * @bd_flags: Board flags.
@@ -140,13 +139,9 @@ struct board_ops {
  * @dpastatus: Board status as defined by DPA.
  * @bd_dividend: Board/UART's specific dividend.
  * @bd_ops: Pointer to board operations structure.
- * @proc_entry_pointer: Proc/ entry
- * @dgnc_board_table: Proc/ entry
  */
 struct dgnc_board {
int boardnum;
-
-   int type;
char*name;
struct pci_dev  *pdev;
unsigned long   bd_flags;
@@ -200,10 +195,6 @@ struct dgnc_board {
uintbd_dividend;
 
struct board_ops *bd_ops;
-
-   struct proc_dir_entry *proc_entry_pointer;
-   struct dgnc_proc_entry *dgnc_board_table;
-
 };
 
 /* Unit flag definitions for un_flags. */
-- 
2.7.4

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


[PATCH] staging: fbtft: remove redundant initialization of txbuf16

2017-09-16 Thread Colin King
From: Colin Ian King 

txbuf16 is being initialized at declaration time and then later
set to another value without it being read inbetween, hence making
the initialization redundant.  Fix this by setting txbuf16 just
the once. Also clean up some incorrect indentations. Cleans up
clang build warning:

warning: Value stored to 'txbuf16' during its initialization is never read

Signed-off-by: Colin Ian King 
---
 drivers/staging/fbtft/fb_ra8875.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ra8875.c 
b/drivers/staging/fbtft/fb_ra8875.c
index a899614ce829..6d1cad85957b 100644
--- a/drivers/staging/fbtft/fb_ra8875.c
+++ b/drivers/staging/fbtft/fb_ra8875.c
@@ -253,7 +253,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, 
...)
 static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
 {
u16 *vmem16;
-   __be16 *txbuf16 = par->txbuf.buf;
+   __be16 *txbuf16;
size_t remain;
size_t to_copy;
size_t tx_array_size;
@@ -267,10 +267,10 @@ static int write_vmem16_bus8(struct fbtft_par *par, 
size_t offset, size_t len)
remain = len / 2;
vmem16 = (u16 *)(par->info->screen_buffer + offset);
tx_array_size = par->txbuf.len / 2;
-   txbuf16 = par->txbuf.buf + 1;
-   tx_array_size -= 2;
-   *(u8 *)(par->txbuf.buf) = 0x00;
-   startbyte_size = 1;
+   txbuf16 = par->txbuf.buf + 1;
+   tx_array_size -= 2;
+   *(u8 *)(par->txbuf.buf) = 0x00;
+   startbyte_size = 1;
 
while (remain) {
to_copy = min(tx_array_size, remain);
-- 
2.14.1

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


Re: [Outreachy kernel] [PATCH v2 1/2] Staging: dgnc: Remove unused fields in struct dgnc_board

2017-09-16 Thread Julia Lawall


On Sat, 16 Sep 2017, Srishti Sharma wrote:

> Remove unused fields and comments associated with them in
> the structure definition.
>
> Signed-off-by: Srishti Sharma 

Acked-by: Julia Lawall 

> ---
> Changes in v2:
>  - Use the word field instead of variable.
>
>  drivers/staging/dgnc/dgnc_driver.h | 9 -
>  1 file changed, 9 deletions(-)
>
> diff --git a/drivers/staging/dgnc/dgnc_driver.h 
> b/drivers/staging/dgnc/dgnc_driver.h
> index 764d6fe..5d2566e 100644
> --- a/drivers/staging/dgnc/dgnc_driver.h
> +++ b/drivers/staging/dgnc/dgnc_driver.h
> @@ -104,7 +104,6 @@ struct board_ops {
>   * struct dgnc_board - Per board information.
>   * @boardnum: Board number (0 - 32).
>   *
> - * @type: Type of board.
>   * @name: Product name.
>   * @pdev: Pointer to the pci_dev structure.
>   * @bd_flags: Board flags.
> @@ -140,13 +139,9 @@ struct board_ops {
>   * @dpastatus: Board status as defined by DPA.
>   * @bd_dividend: Board/UART's specific dividend.
>   * @bd_ops: Pointer to board operations structure.
> - * @proc_entry_pointer: Proc/ entry
> - * @dgnc_board_table: Proc/ entry
>   */
>  struct dgnc_board {
>   int boardnum;
> -
> - int type;
>   char*name;
>   struct pci_dev  *pdev;
>   unsigned long   bd_flags;
> @@ -200,10 +195,6 @@ struct dgnc_board {
>   uintbd_dividend;
>
>   struct board_ops *bd_ops;
> -
> - struct proc_dir_entry *proc_entry_pointer;
> - struct dgnc_proc_entry *dgnc_board_table;
> -
>  };
>
>  /* Unit flag definitions for un_flags. */
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/dd9a08aabab9cfc60a5c7c7c0d5191d72e68c2d2.1505579408.git.srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH v2 2/2] Staging: dgnc: Remove unused fields in struct channel_t

2017-09-16 Thread Julia Lawall


On Sat, 16 Sep 2017, Srishti Sharma wrote:

> Eliminate the fields that are not used and the comments
> associated with them.
>
> Signed-off-by: Srishti Sharma 

Acked-by: Julia Lawall 

> ---
> Changes in v2:
>  - Use the word field instead of variable.
>
>  drivers/staging/dgnc/dgnc_driver.h | 6 --
>  1 file changed, 6 deletions(-)
>
> diff --git a/drivers/staging/dgnc/dgnc_driver.h 
> b/drivers/staging/dgnc/dgnc_driver.h
> index 5d2566e..082d659 100644
> --- a/drivers/staging/dgnc/dgnc_driver.h
> +++ b/drivers/staging/dgnc/dgnc_driver.h
> @@ -312,8 +312,6 @@ struct un_t {
>   * @ch_err_overrun: Count of overruns on channel.
>   * @ch_xon_sends: Count of xons transmitted.
>   * @ch_xoff_sends: Count of xoffs transmitted.
> - * @proc_entry_pointer: Proc// entry.
> - * @dgnc_channel_table: Proc// entry.
>   */
>  struct channel_t {
>   struct dgnc_board *ch_bd;
> @@ -382,10 +380,6 @@ struct channel_t {
>
>   ulong   ch_xon_sends;
>   ulong   ch_xoff_sends;
> -
> - struct proc_dir_entry *proc_entry_pointer;
> - struct dgnc_proc_entry *dgnc_channel_table;
> -
>  };
>
>  extern uint  dgnc_major; /* Our driver/mgmt major */
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/a57f835fc443d51ae9eadd1b995435c215f14974.1505579409.git.srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: iio: tsl2x7x: clean up limit checks

2017-09-16 Thread Jonathan Cameron
On Sat, 16 Sep 2017 14:18:52 +0200
Paolo Cretaro  wrote:

> On 16/09/2017 13:37, Dan Carpenter wrote:
> > On Sat, Sep 16, 2017 at 01:11:29PM +0200, Paolo Cretaro wrote:  
> >> Hi Dan,
> >> just minor nitpicking on the commit message:
> >>
> >> On 08/09/2017 12:53, Dan Carpenter wrote:  
> >>> The background of this code is that we can either use the default
> >>> tables or load our own table with sysfs.  The default tables are three
> >>> element arrays of struct tsl2x7x_lux.  If we load the table with sysfs
> >>> then we can have as many as nine elements.  Which ever way we do it, the
> >>> last element is always zeroed out.
> >>>
> >>> The most interesting part of this patch is in the
> >>> in_illuminance0_lux_table_show() function.  We were using the wrong
> >>> limit, "TSL2X7X_MAX_LUX_TABLE_SIZE * 3", when it should have been just
> >>> "TSL2X7X_MAX_LUX_TABLE_SIZE".  This creates a static checker warning
> >>> that we are going of of bounds.  However, since the last element is  
> >> out of bounds
> >>
> >> Regards,
> >> P.
> >>  
> >>> always zeroed out, that means we hit the break statement and the code
> >>> works correctly despite the wrong limit check.  
> > 
> > What?  No no.  I meant it how I wrote it.  The last element is
> > always zeroed out meaning it's just a series of zeroes.  
> 
> Sorry, I meant the previous sentence "This creates a static checker warning
> that we are going of of bounds".

Double of fixed and patch applied to the togreg branch of iio.git.

Thanks,

Jonathan
> 
> Regards,
> P.
> 
> > 
> > regards,
> > dan carpenter
> >   
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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


Re: [PATCH] staging: iio: ad7192: Use the dedicated reset function

2017-09-16 Thread Jonathan Cameron
On Thu, 14 Sep 2017 16:31:06 +0200
Michael Hennerich  wrote:

> On 14.09.2017 15:50, Stefan Popa wrote:
> > SPI host drivers can use DMA to transfer data, so the buffer should be 
> > properly allocated.
> > Keeping it on the stack could cause an undefined behavior.
> > 
> > The dedicated reset function solves this issue.
> > 
> > Signed-off-by: Stefan Popa   
> 
> Acked-by: Michael Hennerich 

Applied to the togreg branch of iio.git rather than staging
branch as the reset functionality is reasonably recent and
not going to be available in stable kernels etc..

Good work. I was reading this on a plane the other day and
noticed the same issue - always nice when someone else
fixes something on your todo list ;)

Jonathan

> 
> Well done!
> 
> 
> > ---
> >   drivers/staging/iio/adc/ad7192.c | 4 +---
> >   1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/iio/adc/ad7192.c 
> > b/drivers/staging/iio/adc/ad7192.c
> > index d11c6de..6150d27 100644
> > --- a/drivers/staging/iio/adc/ad7192.c
> > +++ b/drivers/staging/iio/adc/ad7192.c
> > @@ -223,11 +223,9 @@ static int ad7192_setup(struct ad7192_state *st,
> > struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
> > unsigned long long scale_uv;
> > int i, ret, id;
> > -   u8 ones[6];
> >   
> > /* reset the serial interface */
> > -   memset(&ones, 0xFF, 6);
> > -   ret = spi_write(st->sd.spi, &ones, 6);
> > +   ret = ad_sd_reset(&st->sd, 48);
> > if (ret < 0)
> > goto out;
> > usleep_range(500, 1000); /* Wait for at least 500us */
> >   
> 
> 

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


Re: [PATCH] staging: iio: ad7192: Use the dedicated reset function

2017-09-16 Thread Jonathan Cameron
On Sat, 16 Sep 2017 15:22:23 -0700
Jonathan Cameron  wrote:

> On Thu, 14 Sep 2017 16:31:06 +0200
> Michael Hennerich  wrote:
> 
> > On 14.09.2017 15:50, Stefan Popa wrote:  
> > > SPI host drivers can use DMA to transfer data, so the buffer should be 
> > > properly allocated.
> > > Keeping it on the stack could cause an undefined behavior.
> > > 
> > > The dedicated reset function solves this issue.
> > > 
> > > Signed-off-by: Stefan Popa 
> > 
> > Acked-by: Michael Hennerich   
> 
> Applied to the togreg branch of iio.git rather than staging
> branch as the reset functionality is reasonably recent and
> not going to be available in stable kernels etc..
> 
> Good work. I was reading this on a plane the other day and
> noticed the same issue - always nice when someone else
> fixes something on your todo list ;)
> 
> Jonathan

Doh, I had forgotten the support was part of a fix for a different
driver so is only in the fixes-togreg branch of iio.git.

I'll take this one the same way with a bit of a tweak to the patch
title to make it clear it is fixing something.

Jonathan
> 
> > 
> > Well done!
> > 
> >   
> > > ---
> > >   drivers/staging/iio/adc/ad7192.c | 4 +---
> > >   1 file changed, 1 insertion(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/staging/iio/adc/ad7192.c 
> > > b/drivers/staging/iio/adc/ad7192.c
> > > index d11c6de..6150d27 100644
> > > --- a/drivers/staging/iio/adc/ad7192.c
> > > +++ b/drivers/staging/iio/adc/ad7192.c
> > > @@ -223,11 +223,9 @@ static int ad7192_setup(struct ad7192_state *st,
> > >   struct iio_dev *indio_dev = spi_get_drvdata(st->sd.spi);
> > >   unsigned long long scale_uv;
> > >   int i, ret, id;
> > > - u8 ones[6];
> > >   
> > >   /* reset the serial interface */
> > > - memset(&ones, 0xFF, 6);
> > > - ret = spi_write(st->sd.spi, &ones, 6);
> > > + ret = ad_sd_reset(&st->sd, 48);
> > >   if (ret < 0)
> > >   goto out;
> > >   usleep_range(500, 1000); /* Wait for at least 500us */
> > > 
> > 
> >   
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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