[PATCH] staging: Replace kzalloc and memcpy by kmemdup

2015-05-20 Thread Dumbre, Nitesh Dilip (N.)
This patch was generated by coccicheck and replaces kzalloc followed
by memcpy with kmemdup

Signed-off-by: Nitesh Dumbre 

diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 57c6ddd..c988be4 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1711,13 +1711,12 @@ int lprocfs_exp_setup(struct obd_export *exp, 
lnet_nid_t *nid, int *newnid)
goto destroy_new;
}
/* not found - create */
-   buffer = kzalloc(LNET_NIDSTR_SIZE, GFP_NOFS);
+   buffer = kmemdup(libcfs_nid2str(*nid), LNET_NIDSTR_SIZE, GFP_NOFS);
if (buffer == NULL) {
rc = -ENOMEM;
goto destroy_new;
}
 
-   memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE);
new_stat->nid_proc = lprocfs_register(buffer,
  obd->obd_proc_exports_entry,
  NULL, NULL);
-- 
1.7.9.5
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 1/2] Staging: comedi: fix line longer than 80 chars in cb_pcidas64.c

2015-05-20 Thread Amaury Denoyelle
Sudip Mukherjee  wrote:

> On Tue, May 19, 2015 at 07:57:49PM +0200, Amaury Denoyelle wrote:
> 
> > @@ -1381,7 +1382,9 @@ static int set_ai_fifo_segment_length(struct 
> > comedi_device *dev,
> > return devpriv->ai_fifo_segment_length;
> >  }
> >  
> > -/* adjusts the size of hardware fifo (which determines block size for dma 
> > xfers) */
> > +/*
> > + * adjusts the size of hardware fifo (which determines block size for dma 
> > xfers)
> > + */
> I did not understand this one. You are not breaking the comment into
> two lines, then why multiline style?
> 
> > const struct pcidas64_board *thisboard = dev->board_ptr;
> > @@ -1588,7 +1591,9 @@ static inline void warn_external_queue(struct 
> > comedi_device *dev)
> > "Use internal AI channel queue (channels must be consecutive 
> > and use same range/aref)\n");
> >  }
> >  
> > -/* Their i2c requires a huge delay on setting clock or data high for some 
> > reason */
> > +/*
> > + * their i2c requires a huge delay on setting clock or data high for some 
> > reason
> > + */
> same here.
> 

The single-line version of these comments are over 80 characters (just
because of the "*/" characters), so I had to split them over several
lines.

What is the proper formatting to use for this case ?

regards,

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


Re: [PATCH] staging: Replace kzalloc and memcpy by kmemdup

2015-05-20 Thread Drokin, Oleg
Thanks!
But rather than that, this whole function (lprocfs_exp_setup) needs to go, 
since it's not used by anything on the client.
The removal is sitting in my queue of "stop using procfs in lustre" patches 
that I am going to submit real soon now and this patch would just create
an unnecessary conflict.

On May 20, 2015, at 3:04 AM, Dumbre, Nitesh Dilip (N.) wrote:

> This patch was generated by coccicheck and replaces kzalloc followed
> by memcpy with kmemdup
> 
> Signed-off-by: Nitesh Dumbre 
> 
> diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
> b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
> index 57c6ddd..c988be4 100644
> --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
> +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
> @@ -1711,13 +1711,12 @@ int lprocfs_exp_setup(struct obd_export *exp, 
> lnet_nid_t *nid, int *newnid)
>   goto destroy_new;
>   }
>   /* not found - create */
> - buffer = kzalloc(LNET_NIDSTR_SIZE, GFP_NOFS);
> + buffer = kmemdup(libcfs_nid2str(*nid), LNET_NIDSTR_SIZE, GFP_NOFS);
>   if (buffer == NULL) {
>   rc = -ENOMEM;
>   goto destroy_new;
>   }
> 
> - memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE);
>   new_stat->nid_proc = lprocfs_register(buffer,
> obd->obd_proc_exports_entry,
> NULL, NULL);
> -- 
> 1.7.9.5

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


Re: [PATCH v3 1/2] Staging: comedi: fix line longer than 80 chars in cb_pcidas64.c

2015-05-20 Thread Sudip Mukherjee
On Wed, May 20, 2015 at 09:24:18AM +0200, Amaury Denoyelle wrote:
> Sudip Mukherjee  wrote:
> 
> > On Tue, May 19, 2015 at 07:57:49PM +0200, Amaury Denoyelle wrote:
> > 
> > > @@ -1381,7 +1382,9 @@ static int set_ai_fifo_segment_length(struct 
> > > comedi_device *dev,
> > >   return devpriv->ai_fifo_segment_length;
> > >  }
> > >  
> > > -/* adjusts the size of hardware fifo (which determines block size for 
> > > dma xfers) */
> > > +/*
> > > + * adjusts the size of hardware fifo (which determines block size for 
> > > dma xfers)
> > > + */
> > I did not understand this one. You are not breaking the comment into
> > two lines, then why multiline style?
> > 
> > >   const struct pcidas64_board *thisboard = dev->board_ptr;
> > > @@ -1588,7 +1591,9 @@ static inline void warn_external_queue(struct 
> > > comedi_device *dev)
> > >   "Use internal AI channel queue (channels must be consecutive 
> > > and use same range/aref)\n");
> > >  }
> > >  
> > > -/* Their i2c requires a huge delay on setting clock or data high for 
> > > some reason */
> > > +/*
> > > + * their i2c requires a huge delay on setting clock or data high for 
> > > some reason
> > > + */
> > same here.
> > 
> 
> The single-line version of these comments are over 80 characters (just
> because of the "*/" characters), so I had to split them over several
> lines.
yes, i noticed. its almost 84 char. but after applying your patch also
it comes to 81.

what about:

/*
 * Their i2c requires a huge delay on setting clock or data high
 * for some reason
 */ 

regards
sudip

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


Re: [PATCH 1/3 v3] Staging: rtl8192u: Simplify error check code at prism2_wep_init

2015-05-20 Thread pmarzo
On mié, 2015-05-20 at 00:46 +0300, Dan Carpenter wrote:
> I was planning to leave this one for Greg but since you asked me to
> comment...
> 
> This patch is ok as one patch.  The subject is "clean up
> prism2_wep_init()" and that's one thing.  Breaking it up into tiny
> patches would probably make it harder to review.
> 
> On Tue, May 19, 2015 at 01:32:22AM +0200, Pedro Marzo Perez wrote:
> > Merge two pr_debug lines with literal strings splitted across several lines
> > into one single line, simplifying prism2_wep_init error check code.
> > 
> > Signed-off-by: Pedro Marzo Perez 
> > ---
> >  .../rtl8192u/ieee80211/ieee80211_crypt_wep.c   | 22 
> > +-
> >  1 file changed, 9 insertions(+), 13 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c 
> > b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> > index 0a17f84..388ed3c 100644
> > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> > @@ -9,6 +9,8 @@
> >   * more details.
> >   */
> >  
> > +#define pr_fmt(fmt) "ieee80211_crypt_wep: " fmt
> 
> Greg doesn't like pr_fmt() in driver code, use dev_dbg() and friends
> instead.  I don't like debug output generally so I say just delete it.
> Especially in this case the debug output is pretty useless.
dev_dbg needs the device parameter, I don't see a way to get the device
pointer within this function. Anyway I think you are right, this debug
output is not very useful, if Greg agrees I will delete the line.
I am curious, why you dont like debug output? I usually have to adapt
the kernel to run in ARM based boards and I find debug output really
useful.

> > +
> >  #include 
> >  #include 
> >  #include 
> > @@ -43,20 +45,16 @@ static void *prism2_wep_init(int keyidx)
> >  
> > priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
> > if (priv == NULL)
> > -   goto fail;
> > +   return NULL;
> > priv->key_idx = keyidx;
> >  
> > priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
> > if (IS_ERR(priv->tx_tfm)) {
> > -   pr_debug("ieee80211_crypt_wep: could not allocate "
> > -  "crypto API arc4\n");
> > priv->tx_tfm = NULL;
> > goto fail;
> 
> This error handling is overly complicated.  It's supposed to be you
> climb up a mountain to go hang gliding (return zero), but if you hit an
> error on the way to the talk you walk backwards the way you came to the
> bottom of the mountain.  You see all the landmarks in reverse order and
> it makes you have a sad face.
Agree, it is still too complicated. The patch simplifies the original
code but it is still not completely right, and it does not follow kernel
error check style if error => goto

> 
> allocate priv
> allocate tx
> allocate rx
> 
> return success;  <-- made it to the top
> 
> free tx <- walking back down.  :(
> free priv
> 
> It should be:
> 
>   if (IS_ERR(priv->tx_tfm))
>   goto free_priv;
> 
> > }
> > priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
> > if (IS_ERR(priv->rx_tfm)) {
> > -   pr_debug("ieee80211_crypt_wep: could not allocate "
> > -  "crypto API arc4\n");
> > priv->rx_tfm = NULL;
> > goto fail;
> > }
> 
>   if (IS_ERR(priv->rx_tfm))
>   goto free_tx;
> 
> If this allocation succeeds then we've made it to the top.  No need to
> call crypto_free_blkcipher(priv->rx_tfm) in this function.
Agree, this check is useless, will never be called

> 
> > @@ -67,14 +65,12 @@ static void *prism2_wep_init(int keyidx)
> > return priv;
> >  
> >  fail:
> > -   if (priv) {
> > -   if (priv->tx_tfm)
> > -   crypto_free_blkcipher(priv->tx_tfm);
> > -   if (priv->rx_tfm)
> > -   crypto_free_blkcipher(priv->rx_tfm);
> > -   kfree(priv);
> > -   }
> 
> In the original code there isn't a nice error path down the mountain,
> it's all mixed together and not in any particular order.
> 
> > -
> > +   pr_debug("could not allocate crypto API arc4\n");
> > +   if (priv->tx_tfm)
> > +   crypto_free_blkcipher(priv->tx_tfm);
> > +   if (priv->rx_tfm)
> > +   crypto_free_blkcipher(priv->rx_tfm);
> > +   kfree(priv);
> > return NULL;
> 
> 
> free_tx:
>   crypto_free_blkcipher(priv->tx_tfm);
> free_priv:
>   kfree(priv);
> 
>   return NULL;
> 

I will send an V4 patch, I am glad you don't charge a fee per patch
submitted and reviewed :-)
Anyway I will wait a couple of days to Greg's comments, so hopefully V4
will be the last.


> regards,
> dan carpenter


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


Re: [PATCH v3 1/2] Staging: comedi: fix line longer than 80 chars in cb_pcidas64.c

2015-05-20 Thread Ian Abbott

On 19/05/15 18:57, Amaury Denoyelle wrote:

This patch fixes coding style errors reported by checkpatch.pl for
cb_pcidas64.c, about too long source code lines.

Signed-off-by: Amaury Denoyelle 
---
  drivers/staging/comedi/drivers/cb_pcidas64.c | 14 ++
  1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index a94c33c..f1bba2b 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -243,7 +243,8 @@ enum adc_control0_contents {
ADC_SOFT_GATE_BITS = 0x1,   /*  software gate */
ADC_EXT_GATE_BITS = 0x2,/*  external digital gate */
ADC_ANALOG_GATE_BITS = 0x3, /*  analog level gate */
-   ADC_GATE_LEVEL_BIT = 0x4,   /*  level-sensitive gate (for digital) 
*/
+   /*  level-sensitive gate (for digital) */
+   ADC_GATE_LEVEL_BIT = 0x4,
ADC_GATE_POLARITY_BIT = 0x8,/*  gate active low */
ADC_START_TRIG_SOFT_BITS = 0x10,
ADC_START_TRIG_EXT_BITS = 0x20,
@@ -1381,7 +1382,9 @@ static int set_ai_fifo_segment_length(struct 
comedi_device *dev,
return devpriv->ai_fifo_segment_length;
  }

-/* adjusts the size of hardware fifo (which determines block size for dma 
xfers) */
+/*
+ * adjusts the size of hardware fifo (which determines block size for dma 
xfers)
+ */
  static int set_ai_fifo_size(struct comedi_device *dev, unsigned int 
num_samples)
  {
const struct pcidas64_board *thisboard = dev->board_ptr;
@@ -1588,7 +1591,9 @@ static inline void warn_external_queue(struct 
comedi_device *dev)
"Use internal AI channel queue (channels must be consecutive and use 
same range/aref)\n");
  }

-/* Their i2c requires a huge delay on setting clock or data high for some 
reason */
+/*
+ * their i2c requires a huge delay on setting clock or data high for some 
reason
+ */
  static const int i2c_high_udelay = 1000;
  static const int i2c_low_udelay = 10;

@@ -1987,7 +1992,8 @@ static unsigned int get_divisor(unsigned int ns, unsigned 
int flags)

  /* utility function that rounds desired timing to an achievable time, and
   * sets cmd members appropriately.
- * adc paces conversions from master clock by dividing by (x + 3) where x is 
24 bit number
+ * adc paces conversions from master clock by dividing by (x + 3) where x is
+ * 24 bit number
   */
  static void check_adc_timing(struct comedi_device *dev, struct comedi_cmd 
*cmd)
  {



Looks good.

Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 2/2] Staging: comedi: fix style for multi-line comments in cb_pcidas64.c

2015-05-20 Thread Ian Abbott

On 19/05/15 18:57, Amaury Denoyelle wrote:

This patch reformat multi-line comments which are not properly written
according to the kernel coding style in cb_pcidas64.c

Signed-off-by: Amaury Denoyelle 
---
  drivers/staging/comedi/drivers/cb_pcidas64.c | 140 ++-
  1 file changed, 93 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index f1bba2b..3d646c1 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -155,8 +155,10 @@ static inline unsigned int dac_msb_4020_reg(unsigned int 
channel)
  }

  enum read_only_registers {
-   /*  hardware status register,
-*  reading this apparently clears pending interrupts as well */
+   /*
+* hardware status register,
+* reading this apparently clears pending interrupts as well
+*/
HW_STATUS_REG = 0x0,
PIPE1_READ_REG = 0x4,
ADC_READ_PNTR_REG = 0x8,
@@ -301,7 +303,8 @@ enum calibration_contents {
CAL_GAIN_BIT = 0x800,
  };

-/* calibration sources for 6025 are:
+/*
+ * calibration sources for 6025 are:
   *  0 : ground
   *  1 : 10V
   *  2 : 5V
@@ -661,8 +664,10 @@ static const struct hw_fifo_info ai_fifo_60xx = {
.fifo_size_reg_mask = 0x7f,
  };

-/* maximum number of dma transfers we will chain together into a ring
- * (and the maximum number of dma buffers we maintain) */
+/*
+ * maximum number of dma transfers we will chain together into a ring
+ * (and the maximum number of dma buffers we maintain)
+ */
  #define MAX_AI_DMA_RING_COUNT (0x8 / DMA_BUFFER_SIZE)
  #define MIN_AI_DMA_RING_COUNT (0x1 / DMA_BUFFER_SIZE)
  #define AO_DMA_RING_COUNT (0x1 / DMA_BUFFER_SIZE)
@@ -1261,8 +1266,10 @@ static void enable_ai_interrupts(struct comedi_device 
*dev,

bits = EN_ADC_OVERRUN_BIT | EN_ADC_DONE_INTR_BIT |
   EN_ADC_ACTIVE_INTR_BIT | EN_ADC_STOP_INTR_BIT;
-   /*  Use pio transfer and interrupt on end of conversion
-*  if CMDF_WAKE_EOS flag is set. */
+   /*
+* Use pio transfer and interrupt on end of conversion
+* if CMDF_WAKE_EOS flag is set.
+*/
if (cmd->flags & CMDF_WAKE_EOS) {
/*  4020 doesn't support pio transfers except for fifo dregs */
if (thisboard->layout != LAYOUT_4020)
@@ -1425,8 +1432,10 @@ static void init_stc_registers(struct comedi_device *dev)

spin_lock_irqsave(&dev->spinlock, flags);

-   /*  bit should be set for 6025,
-*  although docs say boards with <= 16 chans should be cleared XXX */
+   /*
+* bit should be set for 6025,
+* although docs say boards with <= 16 chans should be cleared XXX
+*/
if (1)
devpriv->adc_control1_bits |= ADC_QUEUE_CONFIG_BIT;
writew(devpriv->adc_control1_bits,
@@ -1689,8 +1698,10 @@ static void i2c_write(struct comedi_device *dev, 
unsigned int address,
uint8_t bitstream;
static const int read_bit = 0x1;

-   /* XXX need mutex to prevent simultaneous attempts to access
-* eeprom and i2c bus */
+   /*
+* XXX need mutex to prevent simultaneous attempts to access
+* eeprom and i2c bus
+*/

/*  make sure we dont send anything to eeprom */
devpriv->plx_control_bits &= ~CTL_EE_CS;
@@ -1782,14 +1793,18 @@ static int ai_rinsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
cal_en_bit = CAL_EN_60XX_BIT;
else
cal_en_bit = CAL_EN_64XX_BIT;
-   /*  select internal reference source to connect
-*  to channel 0 */
+   /*
+* select internal reference source to connect
+* to channel 0
+*/
writew(cal_en_bit |
   adc_src_bits(devpriv->calibration_source),
   devpriv->main_iobase + CALIBRATION_REG);
} else {
-   /*  make sure internal calibration source
-*  is turned off */
+   /*
+* make sure internal calibration source
+* is turned off
+*/
writew(0, devpriv->main_iobase + CALIBRATION_REG);
}
/*  load internal queue */
@@ -1821,8 +1836,10 @@ static int ai_rinsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
devpriv->i2c_cal_range_bits |= attenuate_bit(channel);
else
devpriv->i2c_cal_range_bits &= ~attenuate_bit(channel);
-   /*  update calibration/range i2c register only if necessary,
-*  as it is very slow */
+   /*

Re: [PATCH v3 1/2] Staging: comedi: fix line longer than 80 chars in cb_pcidas64.c

2015-05-20 Thread Ian Abbott

On 20/05/15 09:22, Sudip Mukherjee wrote:

On Wed, May 20, 2015 at 09:24:18AM +0200, Amaury Denoyelle wrote:

Sudip Mukherjee  wrote:


On Tue, May 19, 2015 at 07:57:49PM +0200, Amaury Denoyelle wrote:


@@ -1381,7 +1382,9 @@ static int set_ai_fifo_segment_length(struct 
comedi_device *dev,
return devpriv->ai_fifo_segment_length;
  }

-/* adjusts the size of hardware fifo (which determines block size for dma 
xfers) */
+/*
+ * adjusts the size of hardware fifo (which determines block size for dma 
xfers)
+ */

I did not understand this one. You are not breaking the comment into
two lines, then why multiline style?


const struct pcidas64_board *thisboard = dev->board_ptr;
@@ -1588,7 +1591,9 @@ static inline void warn_external_queue(struct 
comedi_device *dev)
"Use internal AI channel queue (channels must be consecutive and use 
same range/aref)\n");
  }

-/* Their i2c requires a huge delay on setting clock or data high for some 
reason */
+/*
+ * their i2c requires a huge delay on setting clock or data high for some 
reason
+ */

same here.



The single-line version of these comments are over 80 characters (just
because of the "*/" characters), so I had to split them over several
lines.

yes, i noticed. its almost 84 char. but after applying your patch also
it comes to 81.


Really?  I only see 80 characters.

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3 v3] Staging: rtl8192u: Simplify error check code at prism2_wep_init

2015-05-20 Thread Dan Carpenter
On Wed, May 20, 2015 at 10:26:30AM +0200, pmarzo wrote:
> On mié, 2015-05-20 at 00:46 +0300, Dan Carpenter wrote:
> > I was planning to leave this one for Greg but since you asked me to
> > comment...
> > 
> > This patch is ok as one patch.  The subject is "clean up
> > prism2_wep_init()" and that's one thing.  Breaking it up into tiny
> > patches would probably make it harder to review.
> > 
> > On Tue, May 19, 2015 at 01:32:22AM +0200, Pedro Marzo Perez wrote:
> > > Merge two pr_debug lines with literal strings splitted across several 
> > > lines
> > > into one single line, simplifying prism2_wep_init error check code.
> > > 
> > > Signed-off-by: Pedro Marzo Perez 
> > > ---
> > >  .../rtl8192u/ieee80211/ieee80211_crypt_wep.c   | 22 
> > > +-
> > >  1 file changed, 9 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c 
> > > b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> > > index 0a17f84..388ed3c 100644
> > > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> > > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
> > > @@ -9,6 +9,8 @@
> > >   * more details.
> > >   */
> > >  
> > > +#define pr_fmt(fmt) "ieee80211_crypt_wep: " fmt
> > 
> > Greg doesn't like pr_fmt() in driver code, use dev_dbg() and friends
> > instead.  I don't like debug output generally so I say just delete it.
> > Especially in this case the debug output is pretty useless.
> dev_dbg needs the device parameter, I don't see a way to get the device
> pointer within this function. Anyway I think you are right, this debug
> output is not very useful, if Greg agrees I will delete the line.

Greg doesn't care.  Don't wait for Greg.  He is a busy guy.

Greg is very predictable so I can normally tell you which patches will
be merged and which will not.

> I am curious, why you dont like debug output? I usually have to adapt
> the kernel to run in ARM based boards and I find debug output really
> useful.

These debug statements are never going to be printed in real life.  They
are a waste of RAM for no reason.  They make the code more complicated
which is why we are debating "how should we handle this thing?"  They
make the code slightly messier.  They can introduce NULL deref bugs in
code which never gets tested.

It's not that all debug code is bad, but so often people do it without
thinking because they think it's something they must do for every
function.  They think they are doing the right thing without realizing
that sometimes they are making the code worse.

Low level functions like crypto_alloc_blkcipher() should have debug code
and stack dumps on error.  It mostly does I think.  I think it assumes
that /lib/modules/ is not corrupt...

regards,
dan carpenter

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


Re: [PATCH v3 1/2] Staging: comedi: fix line longer than 80 chars in cb_pcidas64.c

2015-05-20 Thread Sudip Mukherjee
On Wed, May 20, 2015 at 10:00:45AM +0100, Ian Abbott wrote:
> On 20/05/15 09:22, Sudip Mukherjee wrote:
> >On Wed, May 20, 2015 at 09:24:18AM +0200, Amaury Denoyelle wrote:
> >>Sudip Mukherjee  wrote:
> >>
> >>>On Tue, May 19, 2015 at 07:57:49PM +0200, Amaury Denoyelle wrote:
> >>>
> >yes, i noticed. its almost 84 char. but after applying your patch also
> >it comes to 81.
> 
> Really?  I only see 80 characters.
yeah, i am also seeing 80 now. sorry for the noise.

regards
sudip
> 
> -- 
> -=( Ian Abbott @ MEV Ltd.E-mail:  )=-
> -=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: dgnc: fix line length over 80 chars in dgnc_sysfs.c

2015-05-20 Thread Wim de With
This patch fixes most of the lines over 80 characters long in
dgnc_sysfs.c. I couldn't find a way to break line 202-207 in a sensible
way. If there is a way, let me know.

Signed-off-by: Wim de With 
---
 drivers/staging/dgnc/dgnc_sysfs.c | 110 +-
 1 file changed, 74 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 65551d1..44db870 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -53,7 +53,8 @@ static ssize_t dgnc_driver_pollrate_show(struct device_driver 
*ddp, char *buf)
return snprintf(buf, PAGE_SIZE, "%dms\n", dgnc_poll_tick);
 }
 
-static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp, const 
char *buf, size_t count)
+static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp,
+ const char *buf, size_t count)
 {
int ret;
 
@@ -62,7 +63,8 @@ static ssize_t dgnc_driver_pollrate_store(struct 
device_driver *ddp, const char
return -EINVAL;
return count;
 }
-static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show, 
dgnc_driver_pollrate_store);
+static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show,
+  dgnc_driver_pollrate_store);
 
 
 void dgnc_create_driver_sysfiles(struct pci_driver *dgnc_driver)
@@ -104,7 +106,8 @@ void dgnc_remove_driver_sysfiles(struct pci_driver 
*dgnc_driver)
 
 
 
-static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr, 
char *buf)
+static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
+char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -112,7 +115,8 @@ static ssize_t dgnc_vpd_show(struct device *p, struct 
device_attribute *attr, ch
 
DGNC_VERIFY_BOARD(p, bd);
 
-   count += sprintf(buf + count, "\n  0  1  2  3  4  5  6  7  8  9  A  
B  C  D  E  F");
+   count += sprintf(buf + count,
+   "\n  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F");
for (i = 0; i < 0x40 * 2; i++) {
if (!(i % 16))
count += sprintf(buf + count, "\n%04X ", i * 2);
@@ -124,7 +128,8 @@ static ssize_t dgnc_vpd_show(struct device *p, struct 
device_attribute *attr, ch
 }
 static DEVICE_ATTR(vpd, S_IRUSR, dgnc_vpd_show, NULL);
 
-static ssize_t dgnc_serial_number_show(struct device *p, struct 
device_attribute *attr, char *buf)
+static ssize_t dgnc_serial_number_show(struct device *p,
+  struct device_attribute *attr, char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -141,7 +146,8 @@ static ssize_t dgnc_serial_number_show(struct device *p, 
struct device_attribute
 static DEVICE_ATTR(serial_number, S_IRUSR, dgnc_serial_number_show, NULL);
 
 
-static ssize_t dgnc_ports_state_show(struct device *p, struct device_attribute 
*attr, char *buf)
+static ssize_t dgnc_ports_state_show(struct device *p,
+struct device_attribute *attr, char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -159,7 +165,8 @@ static ssize_t dgnc_ports_state_show(struct device *p, 
struct device_attribute *
 static DEVICE_ATTR(ports_state, S_IRUSR, dgnc_ports_state_show, NULL);
 
 
-static ssize_t dgnc_ports_baud_show(struct device *p, struct device_attribute 
*attr, char *buf)
+static ssize_t dgnc_ports_baud_show(struct device *p,
+   struct device_attribute *attr, char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -169,14 +176,17 @@ static ssize_t dgnc_ports_baud_show(struct device *p, 
struct device_attribute *a
 
for (i = 0; i < bd->nasync; i++) {
count +=  snprintf(buf + count, PAGE_SIZE - count,
-   "%d %d\n", bd->channels[i]->ch_portnum, 
bd->channels[i]->ch_old_baud);
+   "%d %d\n", bd->channels[i]->ch_portnum,
+   bd->channels[i]->ch_old_baud);
}
return count;
 }
 static DEVICE_ATTR(ports_baud, S_IRUSR, dgnc_ports_baud_show, NULL);
 
 
-static ssize_t dgnc_ports_msignals_show(struct device *p, struct 
device_attribute *attr, char *buf)
+static ssize_t dgnc_ports_msignals_show(struct device *p,
+   struct device_attribute *attr,
+   char *buf)
 {
struct dgnc_board *bd;
int count = 0;
@@ -187,7 +197,8 @@ static ssize_t dgnc_ports_msignals_show(struct device *p, 
struct device_attribut
for (i = 0; i < bd->nasync; i++) {
if (bd->channels[i]->ch_open_count) {
count += snprintf(buf + count, PAGE_SIZE - count,
-   "%d %s %s %s %s %s %s\n", 
bd->channels[i]->ch_portnum,
+   "%d %s %s %s %s %s %s\n",
+  

[PATCH v2] staging: comedi: fix coding style issues

2015-05-20 Thread Geliang Tang
On Mon, May 18, 2015 at 12:37:09PM +0100, Ian Abbott wrote:
> On 16/05/15 05:16, Geliang Tang wrote:
> >1) Fixed an error found by checkpatch.pl.
> >ERROR: space required after that ',' (ctx:VxV)
> >./drivers/ni_mio_common.c:3764
> >2) Changed "register 0x%x" to "register=0x%x" to keep the consistency
> >of this file.
> >3) The kernel version is next-20150515, 4.1.0-rc3.
> 
> You shouldn't mention point 3 in the commit message as it will look a bit
> strange when it ends up in the commit log.  If you need to mention that, it
> should go after the commit message, separated from the patch by a "---" line
> like this:
> 
> Body of commit message goes here.
> 
> Signed off by and Cc lines go here.
> ---
> Additional patch commentary goes here.
> ---
> Actual patch goes here.
> 
> Git will ignore the additional commentary when the patch is applied.
> 
> >
> >Signed-off-by: Geliang Tang 
> >---
> >  drivers/staging/comedi/drivers/ni_mio_common.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
> >b/drivers/staging/comedi/drivers/ni_mio_common.c
> >index 9dfd4e6..6cc304a 100644
> >--- a/drivers/staging/comedi/drivers/ni_mio_common.c
> >+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
> >@@ -3761,7 +3761,7 @@ static unsigned int ni_gpct_to_stc_register(struct 
> >comedi_device *dev,
> > if (reg < ARRAY_SIZE(ni_gpct_to_stc_regmap)) {
> > regmap = &ni_gpct_to_stc_regmap[reg];
> > } else {
> >-dev_warn(dev->class_dev,"%s: unhandled register 0x%x\n",
> >+dev_warn(dev->class_dev, "%s: unhandled register=0x%x\n",
> >  __func__, reg);
> > return 0;
> > }
> >
> 
> Apart from that niggle, the patch looks good!
> 
> Reviewed-by: Ian Abbott 
> 
> -- 
> -=( Ian Abbott @ MEV Ltd.E-mail:  )=-
> -=(  Web: http://www.mev.co.uk/  )=-

Thank you for your review. I revised the patch as you suggested.
Here it is.
>From d864f6af18a44031a241e10e64d98f9e6b8c0660 Mon Sep 17 00:00:00 2001
From: Geliang Tang 
Date: Wed, 20 May 2015 14:26:13 +
Subject: [PATCH v2] staging: comedi: fix coding style issues

1) Fixed an error found by checkpatch.pl.
   ERROR: space required after that ',' (ctx:VxV)
   ./drivers/ni_mio_common.c:3764
2) Changed "register 0x%x" to "register=0x%x" to keep the consistency
   of this file.

Signed-off-by: Geliang Tang 
Reviewed-by: Ian Abbott 
---
Changes in v2:
  - remove the kernel version in the commit message.
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 9dfd4e6..6cc304a 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -3761,7 +3761,7 @@ static unsigned int ni_gpct_to_stc_register(struct 
comedi_device *dev,
if (reg < ARRAY_SIZE(ni_gpct_to_stc_regmap)) {
regmap = &ni_gpct_to_stc_regmap[reg];
} else {
-   dev_warn(dev->class_dev,"%s: unhandled register 0x%x\n",
+   dev_warn(dev->class_dev, "%s: unhandled register=0x%x\n",
 __func__, reg);
return 0;
}
-- 
2.3.4

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


[PATCH 2/6] staging: panel: use new parport device model

2015-05-20 Thread Sudip Mukherjee
Converted to use the new device-model parallel port.

Signed-off-by: Sudip Mukherjee 
---

The comment about panel_cb.flags can be removed, it is kept just
for the comment to remind us that it might be better to use
PARPORT_DEV_EXCL.

 drivers/staging/panel/panel.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index 1d8ed8b..70f0ac6 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2190,6 +2190,8 @@ static struct notifier_block panel_notifier = {
 
 static void panel_attach(struct parport *port)
 {
+   struct pardev_cb panel_cb;
+
if (port->number != parport)
return;
 
@@ -2199,10 +2201,11 @@ static void panel_attach(struct parport *port)
return;
}
 
-   pprt = parport_register_device(port, "panel", NULL, NULL,  /* pf, kf */
-  NULL,
-  /*PARPORT_DEV_EXCL */
-  0, (void *)&pprt);
+   memset(&panel_cb, 0, sizeof(panel_cb));
+   panel_cb.private = &pprt;
+   /* panel_cb.flags = 0 should be PARPORT_DEV_EXCL? */
+
+   pprt = parport_register_dev_model(port, "panel", &panel_cb, 0);
if (pprt == NULL) {
pr_err("%s: port->number=%d parport=%d, 
parport_register_device() failed\n",
   __func__, port->number, parport);
@@ -2256,8 +2259,9 @@ static void panel_detach(struct parport *port)
 
 static struct parport_driver panel_driver = {
.name = "panel",
-   .attach = panel_attach,
+   .match_port = panel_attach,
.detach = panel_detach,
+   .devmodel = true,
 };
 
 /* init function */
-- 
1.8.1.2

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


[PATCH 1/6] parport: add device-model to parport subsystem

2015-05-20 Thread Sudip Mukherjee
parport subsystem starts using the device-model. Drivers using the
device-model has to define devmodel as true and should register the
device with parport using parport_register_dev_model().

Tested-by: Jean Delvare 
Tested-by: Alan Cox 
Signed-off-by: Sudip Mukherjee 
---

patch:  renaming of cnt and one label, added one comment.
instead of probe check for devmodel. Define a default probe.
No change in core functionality.

v5:
a) addition/removal of ports are now handled.
b) is_parport moved to the core level
c) common parport_driver_register code
d) parport_register_dev_model now accepts instance number.

v4: use of is_parport() is introduced to check the type of device
that has been passed to probe or match_port.

v3: started use of parport_del_port(). previously it was creating
some ghost parallel ports during port probing.
parport_del_port() removes registered ports if probing has
failed.

v2: started using probe function. Without probe,whenever any driver
is trying to register, it is getting bound to all the available
parallel ports. To solve that probe was required.
Now the driver is binding only to the device it has registered.
And that device will appear as a subdevice of the particular
parallel port it wants to use.

In v1 Greg mentioned that we do not need to maintain our own
list. That has been partially done. we are no longer maintaining
the list of drivers. But we still need to maintain the list of
ports and devices as that will be used by drivers which are not
yet converted to device model. When all drivers are converted
to use the device-model parallel port all these lists can be
removed.

 drivers/parport/parport_pc.c |   4 +-
 drivers/parport/procfs.c |  15 +-
 drivers/parport/share.c  | 345 ---
 include/linux/parport.h  |  43 +-
 4 files changed, 379 insertions(+), 28 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 53d15b3..78530d1 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2255,7 +2255,7 @@ out5:
release_region(base+0x3, 5);
release_region(base, 3);
 out4:
-   parport_put_port(p);
+   parport_del_port(p);
 out3:
kfree(priv);
 out2:
@@ -2294,7 +2294,7 @@ void parport_pc_unregister_port(struct parport *p)
priv->dma_handle);
 #endif
kfree(p->private_data);
-   parport_put_port(p);
+   parport_del_port(p);
kfree(ops); /* hope no-one cached it */
 }
 EXPORT_SYMBOL(parport_pc_unregister_port);
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index 3b47080..c776333 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -558,8 +559,18 @@ int parport_device_proc_unregister(struct pardevice 
*device)
 
 static int __init parport_default_proc_register(void)
 {
+   int ret;
+
parport_default_sysctl_table.sysctl_header =
register_sysctl_table(parport_default_sysctl_table.dev_dir);
+   if (!parport_default_sysctl_table.sysctl_header)
+   return -ENOMEM;
+   ret = parport_bus_init();
+   if (ret) {
+   unregister_sysctl_table(parport_default_sysctl_table.
+   sysctl_header);
+   return ret;
+   }
return 0;
 }
 
@@ -570,6 +581,7 @@ static void __exit parport_default_proc_unregister(void)
sysctl_header);
parport_default_sysctl_table.sysctl_header = NULL;
}
+   parport_bus_exit();
 }
 
 #else /* no sysctl or no procfs*/
@@ -596,11 +608,12 @@ int parport_device_proc_unregister(struct pardevice 
*device)
 
 static int __init parport_default_proc_register (void)
 {
-   return 0;
+   return parport_bus_init();
 }
 
 static void __exit parport_default_proc_unregister (void)
 {
+   parport_bus_exit();
 }
 #endif
 
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 3fa6624..99d03ed 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -100,13 +101,91 @@ static struct parport_operations dead_ops = {
.owner  = NULL,
 };
 
+static struct device_type parport_device_type = {
+   .name = "parport",
+};
+
+static int is_parport(struct device *dev)
+{
+   return dev->type == &parport_device_type;
+}
+
+static int parport_probe(struct device *dev)
+{
+   struct parport_driver *drv;
+
+   if (is_parport(dev))
+   return -ENODEV;
+
+   drv = to_parport_driver(dev->driver);
+   if (!drv->probe) {
+   /* if driver ha

[PATCH 3/6] i2c-parport: define ports to connect

2015-05-20 Thread Sudip Mukherjee
As of now i2c-parport was connecting to all the available parallel
ports. Lets limit that to maximum of 4 instances and at the same time
define which instance connects to which parallel port.

Tested-by: Jean Delvare 
Signed-off-by: Sudip Mukherjee 
---

MODULE_PARM_DESC modified

 drivers/i2c/busses/i2c-parport.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index a1fac5a..155da95 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -46,6 +46,9 @@ struct i2c_par {
 
 static LIST_HEAD(adapter_list);
 static DEFINE_MUTEX(adapter_list_lock);
+#define MAX_DEVICE 4
+static int parport[MAX_DEVICE] = {0, -1, -1, -1};
+
 
 /* - Low-level parallel port access --- */
 
@@ -163,6 +166,19 @@ static void i2c_parport_irq(void *data)
 static void i2c_parport_attach(struct parport *port)
 {
struct i2c_par *adapter;
+   int i;
+   struct pardev_cb i2c_parport_cb;
+
+   for (i = 0; i < MAX_DEVICE; i++) {
+   if (parport[i] == -1)
+   continue;
+   if (port->number == parport[i])
+   break;
+   }
+   if (i == MAX_DEVICE) {
+   pr_debug("i2c-parport: Not using parport%d.\n", port->number);
+   return;
+   }
 
adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL);
if (adapter == NULL) {
@@ -298,5 +314,12 @@ MODULE_AUTHOR("Jean Delvare ");
 MODULE_DESCRIPTION("I2C bus over parallel port");
 MODULE_LICENSE("GPL");
 
+module_param_array(parport, int, NULL, 0);
+MODULE_PARM_DESC(parport,
+"List of parallel ports to bind to, by index.\n"
+" Atmost " __stringify(MAX_DEVICE) " devices are supported.\n"
+" Default is one device connected to parport0.\n"
+);
+
 module_init(i2c_parport_init);
 module_exit(i2c_parport_exit);
-- 
1.8.1.2

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


[PATCH 0/6] use devicemodel with parport

2015-05-20 Thread Sudip Mukherjee
After 5 versions of WIP, finally a patch submission.
parport subsystem is now in the transition stage and supports the old
model and the new device model. 3 of the drivers have been converted
into new model and tested.
After other drivers are converted we can remove the old code from
parport.

Sudip Mukherjee (6):
  parport: add device-model to parport subsystem
  staging: panel: use new parport device model
  i2c-parport: define ports to connect
  i2c-parport: use new parport device model
  paride: use new parport device model
  MAINTAINERS: maintain parport

 MAINTAINERS  |   7 +-
 drivers/block/paride/paride.c|  57 ++-
 drivers/block/paride/paride.h|   2 +
 drivers/block/paride/pcd.c   |   9 +
 drivers/block/paride/pd.c|  12 +-
 drivers/block/paride/pf.c|   7 +
 drivers/block/paride/pg.c|   8 +
 drivers/block/paride/pt.c|   8 +
 drivers/i2c/busses/i2c-parport.c |  38 -
 drivers/parport/parport_pc.c |   4 +-
 drivers/parport/procfs.c |  15 +-
 drivers/parport/share.c  | 345 ---
 drivers/staging/panel/panel.c|  14 +-
 include/linux/parport.h  |  43 -
 14 files changed, 522 insertions(+), 47 deletions(-)

-- 
1.8.1.2

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


[PATCH 4/6] i2c-parport: use new parport device model

2015-05-20 Thread Sudip Mukherjee
Modify i2c-parport driver to use the new parallel port device model.

Tested-by: Jean Delvare 
Signed-off-by: Sudip Mukherjee 
---

i2c_parport_cb is made local, devmodel added to driver structure,
and probe removed. 

 drivers/i2c/busses/i2c-parport.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 155da95..138347e 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -185,11 +185,15 @@ static void i2c_parport_attach(struct parport *port)
printk(KERN_ERR "i2c-parport: Failed to kzalloc\n");
return;
}
+   memset(&i2c_parport_cb, 0, sizeof(i2c_parport_cb));
+   i2c_parport_cb.flags = PARPORT_FLAG_EXCL;
+   i2c_parport_cb.irq_func = i2c_parport_irq;
+   i2c_parport_cb.private = adapter;
 
pr_debug("i2c-parport: attaching to %s\n", port->name);
parport_disable_irq(port);
-   adapter->pdev = parport_register_device(port, "i2c-parport",
-   NULL, NULL, i2c_parport_irq, PARPORT_FLAG_EXCL, adapter);
+   adapter->pdev = parport_register_dev_model(port, "i2c-parport",
+  &i2c_parport_cb, i);
if (!adapter->pdev) {
printk(KERN_ERR "i2c-parport: Unable to register with 
parport\n");
goto err_free;
@@ -283,9 +287,10 @@ static void i2c_parport_detach(struct parport *port)
 }
 
 static struct parport_driver i2c_parport_driver = {
-   .name   = "i2c-parport",
-   .attach = i2c_parport_attach,
-   .detach = i2c_parport_detach,
+   .name   = "i2c-parport",
+   .match_port = i2c_parport_attach,
+   .detach = i2c_parport_detach,
+   .devmodel   = true,
 };
 
 /* - Module loading, unloading and information  */
-- 
1.8.1.2

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


[PATCH 6/6] MAINTAINERS: maintain parport

2015-05-20 Thread Sudip Mukherjee
Lets give the parport subsystem a proper name and start
maintaining the files.

Signed-off-by: Sudip Mukherjee 
---
 MAINTAINERS | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 86d9398..0eb5ce2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7476,13 +7476,16 @@ S:  Maintained
 F: Documentation/mn10300/
 F: arch/mn10300/
 
-PARALLEL PORT SUPPORT
+PARALLEL PORT SUBSYSTEM
+M: Sudip Mukherjee 
+M: Sudip Mukherjee 
 L: linux-parp...@lists.infradead.org (subscribers-only)
-S: Orphan
+S: Maintained
 F: drivers/parport/
 F: include/linux/parport*.h
 F: drivers/char/ppdev.c
 F: include/uapi/linux/ppdev.h
+F: Documentation/parport*.txt
 
 PARAVIRT_OPS INTERFACE
 M: Jeremy Fitzhardinge 
-- 
1.8.1.2

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


[PATCH 5/6] paride: use new parport device model

2015-05-20 Thread Sudip Mukherjee
Modify paride driver to use the new parallel port device model.

Tested-by: Alan Cox 
Signed-off-by: Sudip Mukherjee 
---

One change after testing by Alan, par_cb is made a local variable
instead of a global one.

 drivers/block/paride/paride.c | 57 ++-
 drivers/block/paride/paride.h |  2 ++
 drivers/block/paride/pcd.c|  9 +++
 drivers/block/paride/pd.c | 12 -
 drivers/block/paride/pf.c |  7 ++
 drivers/block/paride/pg.c |  8 ++
 drivers/block/paride/pt.c |  8 ++
 7 files changed, 96 insertions(+), 7 deletions(-)

diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c
index 48c50f1..0e28799 100644
--- a/drivers/block/paride/paride.c
+++ b/drivers/block/paride/paride.c
@@ -30,6 +30,7 @@
 #include 
 #include/* TASK_* */
 #include 
+#include 
 
 #include "paride.h"
 
@@ -244,17 +245,19 @@ void paride_unregister(PIP * pr)
 
 EXPORT_SYMBOL(paride_unregister);
 
-static int pi_register_parport(PIA * pi, int verbose)
+static int pi_register_parport(PIA *pi, int verbose, int unit)
 {
struct parport *port;
+   struct pardev_cb par_cb;
 
port = parport_find_base(pi->port);
if (!port)
return 0;
-
-   pi->pardev = parport_register_device(port,
-pi->device, NULL,
-pi_wake_up, NULL, 0, (void *) pi);
+   memset(&par_cb, 0, sizeof(par_cb));
+   par_cb.wakeup = pi_wake_up;
+   par_cb.private = (void *)pi;
+   pi->pardev = parport_register_dev_model(port, pi->device, &par_cb,
+   unit);
parport_put_port(port);
if (!pi->pardev)
return 0;
@@ -311,7 +314,7 @@ static int pi_probe_unit(PIA * pi, int unit, char *scratch, 
int verbose)
e = pi->proto->max_units;
}
 
-   if (!pi_register_parport(pi, verbose))
+   if (!pi_register_parport(pi, verbose, s))
return 0;
 
if (pi->proto->test_port) {
@@ -432,3 +435,45 @@ int pi_init(PIA * pi, int autoprobe, int port, int mode,
 }
 
 EXPORT_SYMBOL(pi_init);
+
+static int pi_probe(struct pardevice *par_dev)
+{
+   struct device_driver *drv = par_dev->dev.driver;
+   int len = strlen(drv->name);
+
+   if (strncmp(par_dev->name, drv->name, len))
+   return -ENODEV;
+
+   return 0;
+}
+
+void *pi_register_driver(char *name)
+{
+   struct parport_driver *parp_drv;
+   int ret;
+
+   parp_drv = kzalloc(sizeof(*parp_drv), GFP_KERNEL);
+   if (!parp_drv)
+   return NULL;
+
+   parp_drv->name = name;
+   parp_drv->probe = pi_probe;
+   parp_drv->devmodel = true;
+
+   ret = parport_register_driver(parp_drv);
+   if (ret) {
+   kfree(parp_drv);
+   return NULL;
+   }
+   return (void *)parp_drv;
+}
+EXPORT_SYMBOL(pi_register_driver);
+
+void pi_unregister_driver(void *_drv)
+{
+   struct parport_driver *drv = _drv;
+
+   parport_unregister_driver(drv);
+   kfree(drv);
+}
+EXPORT_SYMBOL(pi_unregister_driver);
diff --git a/drivers/block/paride/paride.h b/drivers/block/paride/paride.h
index 2bddbf4..ddb9e58 100644
--- a/drivers/block/paride/paride.h
+++ b/drivers/block/paride/paride.h
@@ -165,6 +165,8 @@ typedef struct pi_protocol PIP;
 
 extern int paride_register( PIP * );
 extern void paride_unregister ( PIP * );
+void *pi_register_driver(char *);
+void pi_unregister_driver(void *);
 
 #endif /* __DRIVERS_PARIDE_H__ */
 /* end of paride.h */
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 3b7c9f1..9336236 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -221,6 +221,7 @@ static int pcd_busy;/* request being 
processed ? */
 static int pcd_sector; /* address of next requested sector */
 static int pcd_count;  /* number of blocks still to do */
 static char *pcd_buf;  /* buffer for request in progress */
+static void *par_drv;  /* reference of parport driver */
 
 /* kernel glue structures */
 
@@ -690,6 +691,12 @@ static int pcd_detect(void)
printk("%s: %s version %s, major %d, nice %d\n",
   name, name, PCD_VERSION, major, nice);
 
+   par_drv = pi_register_driver(name);
+   if (!par_drv) {
+   pr_err("failed to register %s driver\n", name);
+   return -1;
+   }
+
k = 0;
if (pcd_drive_count == 0) { /* nothing spec'd - so autoprobe for 1 */
cd = pcd;
@@ -723,6 +730,7 @@ static int pcd_detect(void)
printk("%s: No CD-ROM drive found\n", name);
for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++)
put_disk(cd->disk);
+   pi_unregister_driver(par_drv);
return -1;
 }
 
@@ -984,6 +992,7 @@ static void __exit pcd_exit(void)
}
blk_cleanup_queue(pcd_queue)

Re: [PATCH 6/6] MAINTAINERS: maintain parport

2015-05-20 Thread Richard Weinberger
On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
 wrote:
> Lets give the parport subsystem a proper name and start
> maintaining the files.

Excuse me, but usually someone takes over the maintainer role after
proving that he
cares for a sub system for a certain period of time.
Or did I miss something?

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


Re: [PATCH 3/6] i2c-parport: define ports to connect

2015-05-20 Thread Wolfram Sang
On Wed, May 20, 2015 at 08:56:59PM +0530, Sudip Mukherjee wrote:
> As of now i2c-parport was connecting to all the available parallel
> ports. Lets limit that to maximum of 4 instances and at the same time
> define which instance connects to which parallel port.
> 
> Tested-by: Jean Delvare 
> Signed-off-by: Sudip Mukherjee 

I assume this goes in as one series:

Acked-by: Wolfram Sang 



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


Re: [PATCH 4/6] i2c-parport: use new parport device model

2015-05-20 Thread Wolfram Sang
On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> Modify i2c-parport driver to use the new parallel port device model.
> 
> Tested-by: Jean Delvare 
> Signed-off-by: Sudip Mukherjee 
> ---

In general:

Acked-by: Wolfram Sang 

>  static struct parport_driver i2c_parport_driver = {
> - .name   = "i2c-parport",
> - .attach = i2c_parport_attach,
> - .detach = i2c_parport_detach,
> + .name   = "i2c-parport",
> + .match_port = i2c_parport_attach,
> + .detach = i2c_parport_detach,
> + .devmodel   = true,

Minor nit: I prefer to not use tabs but a single space after the struct
member names. Less hazzle in the future and still readable IMO.



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


Re: [PATCH 6/6] MAINTAINERS: maintain parport

2015-05-20 Thread Joe Perches
On Wed, 2015-05-20 at 17:46 +0200, Richard Weinberger wrote:
> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
>  wrote:
> > Lets give the parport subsystem a proper name and start
> > maintaining the files.
> 
> Excuse me, but usually someone takes over the maintainer role after
> proving that he
> cares for a sub system for a certain period of time.
> Or did I miss something?

MAINTAINERS:85:Orphan:  No current maintainer [but maybe you could take 
the
MAINTAINERS-86- role as you write your new code].

Parport is an orphan, hasn't had a maintainer since at
least 2.6.12, and has almost no activity minus drive-by
cleanups and new device ID support every once in awhile.

Sudip is writing new code.

If Sudip wants to be a maintainer of parport, assuming
he has the time and resources to give it a go, I think
he should be welcomed to it.

Thanks Sudip.  Best of luck...

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


Re: [PATCH 6/6] MAINTAINERS: maintain parport

2015-05-20 Thread One Thousand Gnomes
On Wed, 20 May 2015 17:46:44 +0200
Richard Weinberger  wrote:

> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
>  wrote:
> > Lets give the parport subsystem a proper name and start
> > maintaining the files.
> 
> Excuse me, but usually someone takes over the maintainer role after
> proving that he
> cares for a sub system for a certain period of time.
> Or did I miss something?

It currently (and for some time) has had no maintainer so having a
maintainer is IMHO definitely an improvement in things.

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


[PATCH 0/3] Drivers: hv: add kexec support

2015-05-20 Thread Vitaly Kuznetsov
To make general-purpose kexec (not just kdump) possible for Hyper-V guests
we need to perform some additional cleanup before starting new kernel (see
[PATCH 2/3] for the detailed description).

Know limitations: kexec with balloned out memory is not possible as the
newly loaded kernel doesn't know about this memory and there is no way to
ask the host to bring all the memory back on cleanup (or at least I'm not
aware of such a way). Kexec with hotplugged memory leads to reboot (not
exactly sure why).

This series is supposed to be applied on top of K.Y.'s "[PATCH V2 0/5]
Drivers: hv: vmbus: Cleanup the vmbus unload path"

Vitaly Kuznetsov (3):
  Drivers: hv: vmbus: remove hv_synic_free_cpu() call from
hv_synic_cleanup()
  Drivers: hv: vmbus: add special kexec handler
  Drivers: hv: don't do hypercalls when hypercall_page is NULL

 arch/x86/include/asm/mshyperv.h |  2 ++
 arch/x86/kernel/cpu/mshyperv.c  | 30 ++
 drivers/hv/hv.c | 15 ---
 drivers/hv/vmbus_drv.c  | 15 +++
 4 files changed, 55 insertions(+), 7 deletions(-)

-- 
1.9.3

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


[PATCH 1/3] Drivers: hv: vmbus: remove hv_synic_free_cpu() call from hv_synic_cleanup()

2015-05-20 Thread Vitaly Kuznetsov
We already have hv_synic_free() which frees all per-cpu pages for all
CPUs, let's remove the hv_synic_free_cpu() call from hv_synic_cleanup()
so it will be possible to do separate cleanup (writing to MSRs) and final
freeing. This is going to be used to assist kexec.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/hv.c| 2 --
 drivers/hv/vmbus_drv.c | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index d3943bc..5b87042 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -530,6 +530,4 @@ void hv_synic_cleanup(void *arg)
rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
sctrl.enable = 0;
wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64);
-
-   hv_synic_free_cpu(cpu);
 }
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 2b56260..612fc0a 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1117,6 +1117,7 @@ static void __exit vmbus_exit(void)
hv_cleanup();
for_each_online_cpu(cpu)
smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
+   hv_synic_free();
acpi_bus_unregister_driver(&vmbus_acpi_driver);
hv_cpu_hotplug_quirk(false);
 }
-- 
1.9.3

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


[PATCH 3/3] Drivers: hv: don't do hypercalls when hypercall_page is NULL

2015-05-20 Thread Vitaly Kuznetsov
At the very late stage of kexec a driver (which are not being unloaded) can
try to post a message or signal an event. This will crash the kernel as we
already did hv_cleanup() and the hypercall page is NULL.

Move all common (between 32 and 64 bit code) declarations to the beginning
of the do_hypercall() function. Unfortunately we have to write the
!hypercall_page check twice to not mix declarations and code.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/hv.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 5b87042..41d8072 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -93,11 +93,14 @@ static int query_hypervisor_info(void)
  */
 static u64 do_hypercall(u64 control, void *input, void *output)
 {
-#ifdef CONFIG_X86_64
-   u64 hv_status = 0;
u64 input_address = (input) ? virt_to_phys(input) : 0;
u64 output_address = (output) ? virt_to_phys(output) : 0;
void *hypercall_page = hv_context.hypercall_page;
+#ifdef CONFIG_X86_64
+   u64 hv_status = 0;
+
+   if (!hypercall_page)
+   return (u64)ULLONG_MAX;
 
__asm__ __volatile__("mov %0, %%r8" : : "r" (output_address) : "r8");
__asm__ __volatile__("call *%3" : "=a" (hv_status) :
@@ -112,13 +115,13 @@ static u64 do_hypercall(u64 control, void *input, void 
*output)
u32 control_lo = control & 0x;
u32 hv_status_hi = 1;
u32 hv_status_lo = 1;
-   u64 input_address = (input) ? virt_to_phys(input) : 0;
u32 input_address_hi = input_address >> 32;
u32 input_address_lo = input_address & 0x;
-   u64 output_address = (output) ? virt_to_phys(output) : 0;
u32 output_address_hi = output_address >> 32;
u32 output_address_lo = output_address & 0x;
-   void *hypercall_page = hv_context.hypercall_page;
+
+   if (!hypercall_page)
+   return (u64)ULLONG_MAX;
 
__asm__ __volatile__ ("call *%8" : "=d"(hv_status_hi),
  "=a"(hv_status_lo) : "d" (control_hi),
-- 
1.9.3

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


[PATCH 2/3] Drivers: hv: vmbus: add special kexec handler

2015-05-20 Thread Vitaly Kuznetsov
When general-purpose kexec (not kdump) is being performed in Hyper-V guest
the newly booted kernel fails with an MCE error coming from the host. It
is the same error which was fixed in the "Drivers: hv: vmbus: Implement
the protocol for tearing down vmbus state" commit - monitor pages remain
special and when they're being written to (as the new kernel doesn't know
these pages are special) bad things happen. We need to perform some
minimalistic cleanup before booting a new kernel on kexec. To do so we
need to register a special machine_ops.shutdown handler to be executed
before the native_machine_shutdown(). Registering a shutdown notification
handler via the register_reboot_notifier() call is not sufficient as it
happens to early for our purposes. machine_ops is not being exported to
modules (and I don't think we want to export it) so let's do this in
mshyperv.c

The minimalistic cleanup consists of cleaning up clockevents, synic MSRs,
guest os id MSR, and hypercall MSR.

Kdump doesn't require all this stuff as it lives in a separate memory
space.

Signed-off-by: Vitaly Kuznetsov 
---
 arch/x86/include/asm/mshyperv.h |  2 ++
 arch/x86/kernel/cpu/mshyperv.c  | 30 ++
 drivers/hv/vmbus_drv.c  | 14 ++
 3 files changed, 46 insertions(+)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index c163215..d3db910 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -20,4 +20,6 @@ void hyperv_vector_handler(struct pt_regs *regs);
 void hv_setup_vmbus_irq(void (*handler)(void));
 void hv_remove_vmbus_irq(void);
 
+void hv_setup_kexec_handler(void (*handler)(void));
+void hv_remove_kexec_handler(void);
 #endif
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 939155f..efc20a0 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -18,6 +18,9 @@
 #include 
 #include 
 #include 
+#ifdef CONFIG_KEXEC
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -28,12 +31,14 @@
 #include 
 #include 
 #include 
+#include 
 
 struct ms_hyperv_info ms_hyperv;
 EXPORT_SYMBOL_GPL(ms_hyperv);
 
 #if IS_ENABLED(CONFIG_HYPERV)
 static void (*vmbus_handler)(void);
+static void (*hv_kexec_handler)(void);
 
 void hyperv_vector_handler(struct pt_regs *regs)
 {
@@ -69,6 +74,28 @@ void hv_remove_vmbus_irq(void)
 }
 EXPORT_SYMBOL_GPL(hv_setup_vmbus_irq);
 EXPORT_SYMBOL_GPL(hv_remove_vmbus_irq);
+
+void hv_setup_kexec_handler(void (*handler)(void))
+{
+   hv_kexec_handler = handler;
+}
+EXPORT_SYMBOL_GPL(hv_setup_kexec_handler);
+
+void hv_remove_kexec_handler(void)
+{
+   /* We have no way to deallocate the interrupt gate */
+   hv_kexec_handler = NULL;
+}
+EXPORT_SYMBOL_GPL(hv_remove_kexec_handler);
+
+static void hv_machine_shutdown(void)
+{
+#ifdef CONFIG_KEXEC
+   if (kexec_in_progress && hv_kexec_handler)
+   hv_kexec_handler();
+#endif
+   native_machine_shutdown();
+}
 #endif
 
 static uint32_t  __init ms_hyperv_platform(void)
@@ -143,6 +170,9 @@ static void __init ms_hyperv_init_platform(void)
no_timer_check = 1;
 #endif
 
+#if IS_ENABLED(CONFIG_HYPERV)
+   machine_ops.shutdown = hv_machine_shutdown;
+#endif
 }
 
 const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 612fc0a..8f41469 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1060,6 +1060,17 @@ static struct acpi_driver vmbus_acpi_driver = {
},
 };
 
+static void hv_kexec_handler(void)
+{
+   int cpu;
+
+   hv_synic_clockevents_cleanup();
+   vmbus_initiate_unload();
+   for_each_online_cpu(cpu)
+   smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1);
+   hv_cleanup();
+};
+
 static int __init hv_acpi_init(void)
 {
int ret, t;
@@ -1092,6 +1103,8 @@ static int __init hv_acpi_init(void)
if (ret)
goto cleanup;
 
+   hv_setup_kexec_handler(hv_kexec_handler);
+
return 0;
 
 cleanup:
@@ -1104,6 +1117,7 @@ static void __exit vmbus_exit(void)
 {
int cpu;
 
+   hv_remove_kexec_handler();
vmbus_connection.conn_state = DISCONNECTED;
hv_synic_clockevents_cleanup();
vmbus_disconnect();
-- 
1.9.3

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


Re: [PATCH 4/4] Staging: lustre: sparse lock warning fix

2015-05-20 Thread Dilger, Andreas
On 2015/05/18, 3:21 PM, "Dan Carpenter"  wrote:

>On Mon, May 18, 2015 at 08:34:51PM +0200, Adrian Remonda wrote:
>> Fixed sparse warning: context imbalance in 'nrs_resource_put_safe' -
>> 'different lock contexts for basic block' by releasing the lock on each
>> iteration of the for loop.
>> 
>
>That changelog doesn't sound correct at all.  That's not a correct
>motivation or explanation.
>
>I reviewed the patch and it's likely going to cause dead locks. The code
>is trying to take the spinlock for the first pointer in the array and
>release it at the end.  Now it takes the first pointer's spinlock a
>bunch of times (dead lock) and releases it once (will not happen because
>we are already dead).

It isn't clear to me what the checkpatch complaint actually means?  Is it
that the spin_lock() and spin_unlock() calls have different amounts of
indentation?

Cheers, Andreas
-- 
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division


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


Re: [PATCH 4/6] i2c-parport: use new parport device model

2015-05-20 Thread Sudip Mukherjee
On Wed, May 20, 2015 at 05:49:07PM +0200, Wolfram Sang wrote:
> On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> > Modify i2c-parport driver to use the new parallel port device model.
> > 
> > Tested-by: Jean Delvare 
> > Signed-off-by: Sudip Mukherjee 
> > ---
> 
> In general:
> 
> Acked-by: Wolfram Sang 
> 
> >  static struct parport_driver i2c_parport_driver = {
> > -   .name   = "i2c-parport",
> > -   .attach = i2c_parport_attach,
> > -   .detach = i2c_parport_detach,
> > +   .name   = "i2c-parport",
> > +   .match_port = i2c_parport_attach,
> > +   .detach = i2c_parport_detach,
> > +   .devmodel   = true,
> 
> Minor nit: I prefer to not use tabs but a single space after the struct
> member names. Less hazzle in the future and still readable IMO.
It was having space originally. I changed that into tab as it was
looking good with them as aligned.
I will wait today for some more review and send v2 tomorrow with this
chanage.

regards
sudip
> 


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


Re: [PATCH 6/6] MAINTAINERS: maintain parport

2015-05-20 Thread Sudip Mukherjee
On Wed, May 20, 2015 at 09:28:16AM -0700, Joe Perches wrote:
> On Wed, 2015-05-20 at 17:46 +0200, Richard Weinberger wrote:
> > On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> >  wrote:
> > > Lets give the parport subsystem a proper name and start
> > > maintaining the files.
> > 
> > Excuse me, but usually someone takes over the maintainer role after
> > proving that he
> > cares for a sub system for a certain period of time.
> > Or did I miss something?
> 
> MAINTAINERS:85:Orphan:  No current maintainer [but maybe you could 
> take the
> MAINTAINERS-86- role as you write your new code].
> 
> Parport is an orphan, hasn't had a maintainer since at
> least 2.6.12, and has almost no activity minus drive-by
> cleanups and new device ID support every once in awhile.
> 
> Sudip is writing new code.
> 
> If Sudip wants to be a maintainer of parport, assuming
> he has the time and resources to give it a go, I think
> he should be welcomed to it.
> 
> Thanks Sudip.  Best of luck...

Thanks Joe & Alan for the support. I consider myself inexperienced
to maintain a subsystem, but I hope you all will be there to review
and help me in the process.

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


Re: [PATCH 4/6] i2c-parport: use new parport device model

2015-05-20 Thread Wolfram Sang

> > >  static struct parport_driver i2c_parport_driver = {
> > > - .name   = "i2c-parport",
> > > - .attach = i2c_parport_attach,
> > > - .detach = i2c_parport_detach,
> > > + .name   = "i2c-parport",
> > > + .match_port = i2c_parport_attach,
> > > + .detach = i2c_parport_detach,
> > > + .devmodel   = true,
> > 
> > Minor nit: I prefer to not use tabs but a single space after the struct
> > member names. Less hazzle in the future and still readable IMO.
> It was having space originally. I changed that into tab as it was
> looking good with them as aligned.
> I will wait today for some more review and send v2 tomorrow with this
> chanage.

Thanks. Just to make sure: Keep it one space only, no alignment.



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


Re: [PATCH 4/6] i2c-parport: use new parport device model

2015-05-20 Thread Jean Delvare
On Wed, 20 May 2015 22:44:52 +0530, Sudip Mukherjee wrote:
> On Wed, May 20, 2015 at 05:49:07PM +0200, Wolfram Sang wrote:
> > On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> > >  static struct parport_driver i2c_parport_driver = {
> > > - .name   = "i2c-parport",
> > > - .attach = i2c_parport_attach,
> > > - .detach = i2c_parport_detach,
> > > + .name   = "i2c-parport",
> > > + .match_port = i2c_parport_attach,
> > > + .detach = i2c_parport_detach,
> > > + .devmodel   = true,
> > 
> > Minor nit: I prefer to not use tabs but a single space after the struct
> > member names. Less hazzle in the future and still readable IMO.
>
> It was having space originally. I changed that into tab as it was
> looking good with them as aligned.

As the driver maintainer, I am fine with both unaligned or tab-aligned.
Space-aligned as I did originally was not a good idea, I admit.

-- 
Jean Delvare
SUSE L3 Support
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] staging: rtl8712: Use ether_addr_copy() instead of memcpy()

2015-05-20 Thread Jagan Teki
On 18 May 2015 at 22:02, Jagan Teki  wrote:
> Fixes Warning encounter this by applying checkpatch.pl against this file:
> Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
> are __aligned(2)
>
> pahole output for respective structures:
> - addr->sa_data
> struct sockaddr {
> sa_family_tsa_family;/* 0 2 */
> char   sa_data[14];  /* 214 */
>
> /* size: 16, cachelines: 1, members: 2 */
> /* last cacheline: 16 bytes */
> };
>
> - pnetdev->dev_addr
> dev_addr is interface address infor from generic net_device structure
> which is properly aligned and have some patches with this change as well.
> "staging: rtl8712: fix Prefer ether_addr_copy() over memcpy()"
> (sha1: 36e4d8826b317080e283e4edd08bf8d5ac706f38)
>
> Signed-off-by: Jagan Teki 
> Cc: Greg Kroah-Hartman 
> Cc: Larry Finger 
> Cc: Florian Schilhabel 
> ---
> Changes for v3:
> - Removed unaligned conversions
> Changes for v2:
> - Describe a changelog, to prove address are aligned
>
>  drivers/staging/rtl8712/os_intfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8712/os_intfs.c 
> b/drivers/staging/rtl8712/os_intfs.c
> index 6e776e5..d5f4c4d 100644
> --- a/drivers/staging/rtl8712/os_intfs.c
> +++ b/drivers/staging/rtl8712/os_intfs.c
> @@ -181,7 +181,7 @@ static int r871x_net_set_mac_address(struct net_device 
> *pnetdev, void *p)
> struct sockaddr *addr = p;
>
> if (padapter->bup == false)
> -   memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
> +   ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
> return 0;
>  }
>
> --

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


Re: [PATCH] staging: rtl8188eu: core: Fix line over 80 characters

2015-05-20 Thread Jagan Teki
On 18 May 2015 at 22:34, Jagan Teki  wrote:
> This patch fixes line over 80 characters warninings while
> running checkpatch.pl - "WARNING: line over 80 characters"
>
> Signed-off-by: Jagan Teki 
> Cc: Greg Kroah-Hartman 
> Cc: Larry Finger 
> ---
>  drivers/staging/rtl8188eu/core/rtw_ap.c | 52 
> +++--
>  1 file changed, 36 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
> b/drivers/staging/rtl8188eu/core/rtw_ap.c
> index e65ee6e..02784dd 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_ap.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
> @@ -81,12 +81,14 @@ static void update_BCNTIM(struct adapter *padapter)
> u8 *pbackup_remainder_ie = NULL;
> uint offset, tmp_len, tim_ielen, tim_ie_offset, 
> remainder_ielen;
>
> -   p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, 
> pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
> +   p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen,
> +   pnetwork_mlmeext->IELength - 
> _FIXED_IE_LENGTH_);
> if (p != NULL && tim_ielen > 0) {
> tim_ielen += 2;
> premainder_ie = p+tim_ielen;
> tim_ie_offset = (int)(p - pie);
> -   remainder_ielen = pnetwork_mlmeext->IELength - 
> tim_ie_offset - tim_ielen;
> +   remainder_ielen = pnetwork_mlmeext->IELength -
> +   tim_ie_offset - tim_ielen;
> /* append TIM IE from dst_ie offset */
> dst_ie = p;
> } else {
> @@ -97,7 +99,10 @@ static void update_BCNTIM(struct adapter *padapter)
> offset += pnetwork_mlmeext->Ssid.SsidLength + 2;
>
> /*  get supported rates len */
> -   p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, 
> _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - 
> _BEACON_IE_OFFSET_));
> +   p = rtw_get_ie(pie + _BEACON_IE_OFFSET_,
> +   _SUPPORTEDRATES_IE_, &tmp_len,
> +   (pnetwork_mlmeext->IELength -
> +   _BEACON_IE_OFFSET_));
> if (p !=  NULL)
> offset += tmp_len+2;
>
> @@ -106,7 +111,8 @@ static void update_BCNTIM(struct adapter *padapter)
>
> premainder_ie = pie + offset;
>
> -   remainder_ielen = pnetwork_mlmeext->IELength - offset 
> - tim_ielen;
> +   remainder_ielen = pnetwork_mlmeext->IELength -
> +   offset - tim_ielen;
>
> /* append TIM IE from offset */
> dst_ie = pie + offset;
> @@ -115,11 +121,13 @@ static void update_BCNTIM(struct adapter *padapter)
> if (remainder_ielen > 0) {
> pbackup_remainder_ie = rtw_malloc(remainder_ielen);
> if (pbackup_remainder_ie && premainder_ie)
> -   memcpy(pbackup_remainder_ie, premainder_ie, 
> remainder_ielen);
> +   memcpy(pbackup_remainder_ie,
> +   premainder_ie, 
> remainder_ielen);
> }
> *dst_ie++ = _TIM_IE_;
>
> -   if ((pstapriv->tim_bitmap&0xff00) && 
> (pstapriv->tim_bitmap&0x00fc))
> +   if ((pstapriv->tim_bitmap&0xff00) &&
> +   (pstapriv->tim_bitmap&0x00fc))
> tim_ielen = 5;
> else
> tim_ielen = 4;
> @@ -154,7 +162,8 @@ static void update_BCNTIM(struct adapter *padapter)
> set_tx_beacon_cmd(padapter);
>  }
>
> -void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex 
> *pnetwork, u8 index, u8 *data, u8 len)
> +void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork,
> +   u8 index, u8 *data, u8 len)
>  {
> struct ndis_802_11_var_ie *pIE;
> u8 bmatch = false;
> @@ -168,7 +177,8 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct 
> wlan_bssid_ex *pnetwork, u8
>
> if (pIE->ElementID > index) {
> break;
> -   } else if (pIE->ElementID == index) { /*  already exist the 
> same IE */
> +   /*  already exist the same IE */
> +   } else if (pIE->ElementID == index) {
> p = (u8 *)pIE;
> ielen = pIE->Length;
> bmatch = true;
> @@ -197,7 +207,8 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct 
> wlan_bssid_ex *pnetwork, u8
> if (remainder_ielen > 0) {
> pbackup_remainder_ie = rtw_malloc(remaind

Re: [PATCH] staging: rtl8188eu: core: Fix line over 80 characters

2015-05-20 Thread Greg Kroah-Hartman
On Thu, May 21, 2015 at 12:12:38AM +0530, Jagan Teki wrote:
> On 18 May 2015 at 22:34, Jagan Teki  wrote:
> > This patch fixes line over 80 characters warninings while
> > running checkpatch.pl - "WARNING: line over 80 characters"
> >
> > Signed-off-by: Jagan Teki 
> > Cc: Greg Kroah-Hartman 
> > Cc: Larry Finger 
> 
> Ping!

A "ping" 2 days later for a checkpatch cleanup?

Remember, this is my todo box on a normal day (like today):
~/mail $ mdfrm -c todo
1011 messages in todo

If after 2-3 weeks you don't get a response, then feel free to ping.

patience...

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


Re: [PATCH 4/4] Staging: lustre: sparse lock warning fix

2015-05-20 Thread Dan Carpenter
On Wed, May 20, 2015 at 04:51:59PM +, Dilger, Andreas wrote:
> On 2015/05/18, 3:21 PM, "Dan Carpenter"  wrote:
> 
> >On Mon, May 18, 2015 at 08:34:51PM +0200, Adrian Remonda wrote:
> >> Fixed sparse warning: context imbalance in 'nrs_resource_put_safe' -
> >> 'different lock contexts for basic block' by releasing the lock on each
> >> iteration of the for loop.
> >> 
> >
> >That changelog doesn't sound correct at all.  That's not a correct
> >motivation or explanation.
> >
> >I reviewed the patch and it's likely going to cause dead locks. The code
> >is trying to take the spinlock for the first pointer in the array and
> >release it at the end.  Now it takes the first pointer's spinlock a
> >bunch of times (dead lock) and releases it once (will not happen because
> >we are already dead).
> 
> It isn't clear to me what the checkpatch complaint actually means?  Is it
> that the spin_lock() and spin_unlock() calls have different amounts of
> indentation?
>

It's not a checkpatch.pl warning, it's a Sparse warning.  Sparse is
crappy at reporting locking bugs.  It's mostly false positives.

I think it's saying that some paths lock and unlock some don't.

Smatch is also fairly crappy at finding locking bugs, unfortunately.
I need to re-write it using modern features and cross function analysis.

regards,
dan carpenter

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


Re: [PATCH v3] staging: rtl8712: Use ether_addr_copy() instead of memcpy()

2015-05-20 Thread Dan Carpenter
On Thu, May 21, 2015 at 12:11:46AM +0530, Jagan Teki wrote:
> Ping!

No answer means that Greg hasn't gotten to it yet and no one else has
an issue with it.  Wait for 2 weeks before asking or 4 weeks if a merge
window is open.

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


Re: [PATCH v3] staging: rtl8712: Use ether_addr_copy() instead of memcpy()

2015-05-20 Thread Larry Finger

On 05/20/2015 01:41 PM, Jagan Teki wrote:

On 18 May 2015 at 22:02, Jagan Teki  wrote:

Fixes Warning encounter this by applying checkpatch.pl against this file:
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)

pahole output for respective structures:
- addr->sa_data
struct sockaddr {
 sa_family_tsa_family;/* 0 2 */
 char   sa_data[14];  /* 214 */

 /* size: 16, cachelines: 1, members: 2 */
 /* last cacheline: 16 bytes */
};

- pnetdev->dev_addr
dev_addr is interface address infor from generic net_device structure
which is properly aligned and have some patches with this change as well.
"staging: rtl8712: fix Prefer ether_addr_copy() over memcpy()"
(sha1: 36e4d8826b317080e283e4edd08bf8d5ac706f38)

Signed-off-by: Jagan Teki 
Cc: Greg Kroah-Hartman 
Cc: Larry Finger 
Cc: Florian Schilhabel 
---
Changes for v3:
 - Removed unaligned conversions
Changes for v2:
 - Describe a changelog, to prove address are aligned

  drivers/staging/rtl8712/os_intfs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/os_intfs.c 
b/drivers/staging/rtl8712/os_intfs.c
index 6e776e5..d5f4c4d 100644
--- a/drivers/staging/rtl8712/os_intfs.c
+++ b/drivers/staging/rtl8712/os_intfs.c
@@ -181,7 +181,7 @@ static int r871x_net_set_mac_address(struct net_device 
*pnetdev, void *p)
 struct sockaddr *addr = p;

 if (padapter->bup == false)
-   memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
+   ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
 return 0;
  }

--


Ping!


Ah. Not only are you ignorant, but you are also rude! The patch was not NACKed, 
thus it will be picked up in good time.


Larry


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


Re: [PATCH 4/4] Staging: lustre: sparse lock warning fix

2015-05-20 Thread Dan Carpenter
In Smatch, it the equivalent warning is turned off by default because
there are too many false positives, but you can enable it with the
--spammy flag.

kchecker --spammy drivers/staging/lustre/lustre/ptlrpc/nrs.c

drivers/staging/lustre/lustre/ptlrpc/nrs.c:512 nrs_resource_put_safe()
warn: 'spin_lock:&nrs->nrs_lock' is sometimes locked here and sometimes 
unlocked.

regards,
dan carpenter

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


Re: [PATCH v3] staging: rtl8712: Use ether_addr_copy() instead of memcpy()

2015-05-20 Thread Jagan Teki
On 21 May 2015 at 01:10, Larry Finger  wrote:
> On 05/20/2015 01:41 PM, Jagan Teki wrote:
>>
>> On 18 May 2015 at 22:02, Jagan Teki  wrote:
>>>
>>> Fixes Warning encounter this by applying checkpatch.pl against this file:
>>> Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
>>> are __aligned(2)
>>>
>>> pahole output for respective structures:
>>> - addr->sa_data
>>> struct sockaddr {
>>>  sa_family_tsa_family;/* 0 2
>>> */
>>>  char   sa_data[14];  /* 214
>>> */
>>>
>>>  /* size: 16, cachelines: 1, members: 2 */
>>>  /* last cacheline: 16 bytes */
>>> };
>>>
>>> - pnetdev->dev_addr
>>> dev_addr is interface address infor from generic net_device structure
>>> which is properly aligned and have some patches with this change as well.
>>> "staging: rtl8712: fix Prefer ether_addr_copy() over memcpy()"
>>> (sha1: 36e4d8826b317080e283e4edd08bf8d5ac706f38)
>>>
>>> Signed-off-by: Jagan Teki 
>>> Cc: Greg Kroah-Hartman 
>>> Cc: Larry Finger 
>>> Cc: Florian Schilhabel 
>>> ---
>>> Changes for v3:
>>>  - Removed unaligned conversions
>>> Changes for v2:
>>>  - Describe a changelog, to prove address are aligned
>>>
>>>   drivers/staging/rtl8712/os_intfs.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/staging/rtl8712/os_intfs.c
>>> b/drivers/staging/rtl8712/os_intfs.c
>>> index 6e776e5..d5f4c4d 100644
>>> --- a/drivers/staging/rtl8712/os_intfs.c
>>> +++ b/drivers/staging/rtl8712/os_intfs.c
>>> @@ -181,7 +181,7 @@ static int r871x_net_set_mac_address(struct
>>> net_device *pnetdev, void *p)
>>>  struct sockaddr *addr = p;
>>>
>>>  if (padapter->bup == false)
>>> -   memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
>>> +   ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
>>>  return 0;
>>>   }
>>>
>>> --
>>
>>
>> Ping!
>
>
> Ah. Not only are you ignorant, but you are also rude! The patch was not
> NACKed, thus it will be picked up in good time.

What are these statements, sending a patch with valid proofs implies rudeness?
Does this patch still have changes..?

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


Re: [PATCH v3] staging: rtl8712: Use ether_addr_copy() instead of memcpy()

2015-05-20 Thread Larry Finger

On 05/20/2015 02:46 PM, Jagan Teki wrote:

On 21 May 2015 at 01:10, Larry Finger  wrote:

On 05/20/2015 01:41 PM, Jagan Teki wrote:


On 18 May 2015 at 22:02, Jagan Teki  wrote:


Fixes Warning encounter this by applying checkpatch.pl against this file:
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses
are __aligned(2)

pahole output for respective structures:
- addr->sa_data
struct sockaddr {
  sa_family_tsa_family;/* 0 2
*/
  char   sa_data[14];  /* 214
*/

  /* size: 16, cachelines: 1, members: 2 */
  /* last cacheline: 16 bytes */
};

- pnetdev->dev_addr
dev_addr is interface address infor from generic net_device structure
which is properly aligned and have some patches with this change as well.
"staging: rtl8712: fix Prefer ether_addr_copy() over memcpy()"
(sha1: 36e4d8826b317080e283e4edd08bf8d5ac706f38)

Signed-off-by: Jagan Teki 
Cc: Greg Kroah-Hartman 
Cc: Larry Finger 
Cc: Florian Schilhabel 
---
Changes for v3:
  - Removed unaligned conversions
Changes for v2:
  - Describe a changelog, to prove address are aligned

   drivers/staging/rtl8712/os_intfs.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/os_intfs.c
b/drivers/staging/rtl8712/os_intfs.c
index 6e776e5..d5f4c4d 100644
--- a/drivers/staging/rtl8712/os_intfs.c
+++ b/drivers/staging/rtl8712/os_intfs.c
@@ -181,7 +181,7 @@ static int r871x_net_set_mac_address(struct
net_device *pnetdev, void *p)
  struct sockaddr *addr = p;

  if (padapter->bup == false)
-   memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
+   ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
  return 0;
   }

--



Ping!



Ah. Not only are you ignorant, but you are also rude! The patch was not
NACKed, thus it will be picked up in good time.


What are these statements, sending a patch with valid proofs implies rudeness?
Does this patch still have changes..?


No, that patch (V3) is OK. Sending a ping after 2 days is most certainly rude. 
That implies that no one has anything better to do than cater to your 
submissions. As Greg told you, wait for a while.


Larry


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


Re: [PATCH 6/6] MAINTAINERS: maintain parport

2015-05-20 Thread Richard Weinberger
Am 20.05.2015 um 18:33 schrieb One Thousand Gnomes:
> On Wed, 20 May 2015 17:46:44 +0200
> Richard Weinberger  wrote:
> 
>> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
>>  wrote:
>>> Lets give the parport subsystem a proper name and start
>>> maintaining the files.
>>
>> Excuse me, but usually someone takes over the maintainer role after
>> proving that he
>> cares for a sub system for a certain period of time.
>> Or did I miss something?
> 
> It currently (and for some time) has had no maintainer so having a
> maintainer is IMHO definitely an improvement in things.

Having a maintainer is good.
All I wanted to point out was that it is IMHO uncommon to claim maintainership
before being the main contributor or the de facto maintainer of a
subsystem.

This "rule" prevents us from "Mommy!!! Look, I'm a maintainer!!!1" patches. ;-)

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


[PATCH 2/3 v4] Staging: rtl8192u: Remove two useless lines at ieee80211_wep_null

2015-05-20 Thread Pedro Marzo Perez
Remove two lines at ieee80211_wep_null which checkpatch.pl reported as errors.
The first one because it has a C99 comment style and the second one because it 
is a void
return which is useless.

Signed-off-by: Pedro Marzo Perez 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
index bd789d1..94622cc 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
@@ -279,6 +279,4 @@ void __exit ieee80211_crypto_wep_exit(void)
 
 void ieee80211_wep_null(void)
 {
-// printk(">%s()\n", __func__);
-   return;
 }
-- 
1.9.1

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


[PATCH 1/3 v4] Staging: rtl8192u: Simplify error check code at prism2_wep_init

2015-05-20 Thread Pedro Marzo Perez
Simplify prism2_wep_init error check code employing goto when a failure is 
detected.
Removed pr_debug which was given a checkpatch.pl error because of literal string
 splitted across two lines of code, it was seldom going to be printed anyway.

Signed-off-by: Pedro Marzo Perez 
---
 .../rtl8192u/ieee80211/ieee80211_crypt_wep.c   | 32 ++
 1 file changed, 9 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
index 0a17f84..bd789d1 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
@@ -43,38 +43,24 @@ static void *prism2_wep_init(int keyidx)
 
priv = kzalloc(sizeof(*priv), GFP_ATOMIC);
if (priv == NULL)
-   goto fail;
+   return NULL;
priv->key_idx = keyidx;
 
priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
-   if (IS_ERR(priv->tx_tfm)) {
-   pr_debug("ieee80211_crypt_wep: could not allocate "
-  "crypto API arc4\n");
-   priv->tx_tfm = NULL;
-   goto fail;
-   }
+   if (IS_ERR(priv->tx_tfm))
+   goto free_priv;
priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
-   if (IS_ERR(priv->rx_tfm)) {
-   pr_debug("ieee80211_crypt_wep: could not allocate "
-  "crypto API arc4\n");
-   priv->rx_tfm = NULL;
-   goto fail;
-   }
+   if (IS_ERR(priv->rx_tfm))
+   goto free_tx;
 
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
 
return priv;
-
-fail:
-   if (priv) {
-   if (priv->tx_tfm)
-   crypto_free_blkcipher(priv->tx_tfm);
-   if (priv->rx_tfm)
-   crypto_free_blkcipher(priv->rx_tfm);
-   kfree(priv);
-   }
-
+free_tx:
+   crypto_free_blkcipher(priv->tx_tfm);
+free_priv:
+   kfree(priv);
return NULL;
 }
 
-- 
1.9.1

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


[PATCH 3/3 v4] Staging: rtl8192u: Correct include indentation and openning braces at new line

2015-05-20 Thread Pedro Marzo Perez
Opening braces should never be in a new line.
Correct include indentation.

Signed-off-by: Pedro Marzo Perez 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
index 94622cc..681611d 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
@@ -19,7 +19,7 @@
 #include "ieee80211.h"
 
 #include 
-#include 
+#include 
 #include 
 
 MODULE_AUTHOR("Jouni Malinen");
@@ -128,9 +128,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
/* Copy rest of the WEP key (the secret part) */
memcpy(key + 3, wep->key, wep->key_len);
 
-   if (!tcb_desc->bHwSec)
-   {
-
+   if (!tcb_desc->bHwSec) {
/* Append little-endian CRC32 and encrypt it to produce ICV */
crc = ~crc32_le(~0, pos, len);
icv = skb_put(skb, 4);
@@ -187,8 +185,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
 
-   if (!tcb_desc->bHwSec)
-   {
+   if (!tcb_desc->bHwSec) {
crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
sg_init_one(&sg, pos, plen+4);
 
-- 
1.9.1

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


[PATCH 0/3 v4] Staging: rtl8192u: Fix coding style issues at ieee80211_crypt_wep.c

2015-05-20 Thread Pedro Marzo Perez
The checkpatch.pl script reports several errors at file ieee80211_crypt_wep.c,
this patch fixes them.

Pedro Marzo Perez (3):
  Simplify error check code at prism2_wep_init
  Remove two useless lines at ieee80211_wep_null
  Correct include indentation and openning braces at new line

 .../rtl8192u/ieee80211/ieee80211_crypt_wep.c   | 43 ++
 1 file changed, 12 insertions(+), 31 deletions(-)

-- 
1.9.1

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


RE: [PATCH 0/2] Drivers: hv: vmbus: use cpu_hotplug_enable/disable for CPU offlining prevention

2015-05-20 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Tuesday, May 19, 2015 5:16 AM
> To: de...@linuxdriverproject.org
> Cc: KY Srinivasan; Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui;
> Ingo Molnar; Paul E. McKenney; Rafael J. Wysocki; Peter Zijlstra; Thomas
> Gleixner; Radim Krčmář
> Subject: [PATCH 0/2] Drivers: hv: vmbus: use cpu_hotplug_enable/disable
> for CPU offlining prevention
> 
> Export cpu_hotplug_enable/cpu_hotplug_disable functions from cpu.c and
> use
> them instead of altering the smp_ops.cpu_disable in Hyper-V vmbus
> module.
> 
> Vitaly Kuznetsov (2):
>   cpu-hotplug: export cpu_hotplug_enable/cpu_hotplug_disable
>   Drivers: hv: vmbus: use cpu_hotplug_enable/disable
> 
>  drivers/hv/vmbus_drv.c | 38 --
>  kernel/cpu.c   |  3 ++-
>  2 files changed, 6 insertions(+), 35 deletions(-)

Greg, 

Can you take both these patches through your tree.

Regards,

K. Y
> 
> --
> 1.9.3

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


RE: [PATCH 0/3] Drivers: hv: add kexec support

2015-05-20 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Wednesday, May 20, 2015 9:46 AM
> To: de...@linuxdriverproject.org
> Cc: KY Srinivasan; Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui;
> Ingo Molnar; H. Peter Anvin; Thomas Gleixner; x...@kernel.org
> Subject: [PATCH 0/3] Drivers: hv: add kexec support
> 
> To make general-purpose kexec (not just kdump) possible for Hyper-V
> guests
> we need to perform some additional cleanup before starting new kernel
> (see
> [PATCH 2/3] for the detailed description).
> 
> Know limitations: kexec with balloned out memory is not possible as the
> newly loaded kernel doesn't know about this memory and there is no way to
> ask the host to bring all the memory back on cleanup (or at least I'm not
> aware of such a way). Kexec with hotplugged memory leads to reboot (not
> exactly sure why).
> 
> This series is supposed to be applied on top of K.Y.'s "[PATCH V2 0/5]
> Drivers: hv: vmbus: Cleanup the vmbus unload path"

I was currently working on this exact issue. After I checked in the clockevents 
device based on the
Hyper-V timers, kexec has been broken since the hypervisor state with regards 
to the synthetic
interrupt controller is not correctly cleaned up. Thank you! Greg, will you be 
able to take these patches 
through your tree as well.

Regards,

K. Y
> 
> Vitaly Kuznetsov (3):
>   Drivers: hv: vmbus: remove hv_synic_free_cpu() call from
> hv_synic_cleanup()
>   Drivers: hv: vmbus: add special kexec handler
>   Drivers: hv: don't do hypercalls when hypercall_page is NULL
> 
>  arch/x86/include/asm/mshyperv.h |  2 ++
>  arch/x86/kernel/cpu/mshyperv.c  | 30
> ++
>  drivers/hv/hv.c | 15 ---
>  drivers/hv/vmbus_drv.c  | 15 +++
>  4 files changed, 55 insertions(+), 7 deletions(-)
> 
> --
> 1.9.3

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


Re: [PATCH 4/4] Staging: lustre: sparse lock warning fix

2015-05-20 Thread Dilger, Andreas
On 2015/05/20, 1:42 PM, "Dan Carpenter"  wrote:

>In Smatch, it the equivalent warning is turned off by default because
>there are too many false positives, but you can enable it with the
>--spammy flag.
>
>kchecker --spammy drivers/staging/lustre/lustre/ptlrpc/nrs.c
>
>drivers/staging/lustre/lustre/ptlrpc/nrs.c:512 nrs_resource_put_safe()
>warn: 'spin_lock:&nrs->nrs_lock' is sometimes locked here and sometimes
>unlocked.

Would this be happier with something like:

for (i = 0; i < NRS_RES_MAX; i++) {
if (pols[i] == NULL)
continue;


if (nrs == NULL) {
nrs = pols[i]->pol_nrs;
if (likely(nrs != NULL)) /* make sparse happy */
spin_lock(&nrs->nrs_lock);
}
nrs_policy_put_locked(pols[i]);
}

if (nrs != NULL)
spin_unlock(&nrs->nrs_lock);

so that the "if" conditions are the same?  The code definitely doesn't
have a bug, because the lock is only locked once when nrs is first set,
and only unlocked if it is set.  Or is there a comment to put there that
will quiet the static checker?


Cheers, Andreas
-- 
Andreas Dilger

Lustre Software Architect
Intel High Performance Data Division


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


[RFC PATCH] checkpatch: check for 2 or more spaces around assignment of a declaration

2015-05-20 Thread Joe Perches
On Wed, 2015-05-20 at 19:59 +0200, Jean Delvare wrote:
> On Wed, 20 May 2015 22:44:52 +0530, Sudip Mukherjee wrote:
> > On Wed, May 20, 2015 at 05:49:07PM +0200, Wolfram Sang wrote:
> > > On Wed, May 20, 2015 at 08:57:00PM +0530, Sudip Mukherjee wrote:
> > > >  static struct parport_driver i2c_parport_driver = {
> > > > -   .name   = "i2c-parport",
> > > > -   .attach = i2c_parport_attach,
> > > > -   .detach = i2c_parport_detach,
> > > > +   .name   = "i2c-parport",
> > > > +   .match_port = i2c_parport_attach,
> > > > +   .detach = i2c_parport_detach,
> > > > +   .devmodel   = true,
> > > 
> > > Minor nit: I prefer to not use tabs but a single space after the struct
> > > member names. Less hazzle in the future and still readable IMO.
> >
> > It was having space originally. I changed that into tab as it was
> > looking good with them as aligned.
> 
> As the driver maintainer, I am fine with both unaligned or tab-aligned.
> Space-aligned as I did originally was not a good idea, I admit.

Perhaps space aligned declarations should have some
checkpatch --strict warning for 2 or more spaces
around any assignment of the declaration.

int a   = 1;// 2+ spaces before =
int b   =  2;   // 2+ spaces after =
int c   =   3;  // uses tabs around =, no warning
int d   = 4;// uses 2 tabs before =, no warning

Something like:
---
 scripts/checkpatch.pl | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 89b1df4..8f9d26f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3902,6 +3902,13 @@ sub process {
"multiple assignments should be avoided\n" . 
$herecurr);
}
 
+# check for space aligned declarations
+   if ($line =~ /^.\s*(?:$Declare|$DeclareMisordered)\s*$Ident 
{2,}=\s*(?:$Lval|$Constant|$String)/ ||
+   $line =~ /^.\s*(?:$Declare|$DeclareMisordered)\s*$Ident\s*= 
{2,}(?:$Lval|$Constant|$String)/) {
+   CHK("SPACING",
+   "Avoid multiple space assigments - prefer a single 
space or tabs\n" . $herecurr);
+   }
+
 ## # check for multiple declarations, allowing for a function declaration
 ## # continuation.
 ## if ($line =~ 
/^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&



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


Re: [RFC PATCH] checkpatch: check for 2 or more spaces around assignment of a declaration

2015-05-20 Thread Willy Tarreau
On Wed, May 20, 2015 at 06:02:06PM -0700, Joe Perches wrote:
> Perhaps space aligned declarations should have some
> checkpatch --strict warning for 2 or more spaces
> around any assignment of the declaration.
> 
>   int a   = 1;// 2+ spaces before =
>   int b   =  2;   // 2+ spaces after =
>   int c   =   3;  // uses tabs around =, no warning
>   int d   = 4;// uses 2 tabs before =, no warning

FWIW, in my own code I've stopped using tabs for this and replaced
them with spaces. Tabs are fine *before* code but they completely
mangle the display for people using different tab sizes, or even
when reading diffs, because they heavily depend on the number of
characters *before* them while what you want is to ensure that
what is *after* is on a fixed position.

I would even go further and report warnings when tabs are used after
text.

Tabs after text were very useful in ASM editors in the past because
it was possible to define 3 fixed positions (mnemonic, operands,
comments) and that was the primary purpose of tabs. But in todays
editors, tabs do not mean "jump to next position" but "add between
1 and 8 to the current position" which doesn't make sense at all
if what preceeds can be larger than 8 (which is most often the case
in C code).

Willy

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


Re: [PATCH 6/6] MAINTAINERS: maintain parport

2015-05-20 Thread Willy Tarreau
On Wed, May 20, 2015 at 05:46:44PM +0200, Richard Weinberger wrote:
> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
>  wrote:
> > Lets give the parport subsystem a proper name and start
> > maintaining the files.
> 
> Excuse me, but usually someone takes over the maintainer role after
> proving that he
> cares for a sub system for a certain period of time.
> Or did I miss something?

Sudip has been volunteering for fixing this code which is marked
as "orphan". So whatever his experience and care in this area,
it will be better for the driver to have a maintainer than none.

Good luck Sudip, as drivers which have become orphans are probably
the ones that deserve the least love :-)

Willy

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


Re: [PATCH 6/6] MAINTAINERS: maintain parport

2015-05-20 Thread Sudip Mukherjee
On Wed, May 20, 2015 at 10:36:04PM +0200, Richard Weinberger wrote:
> Am 20.05.2015 um 18:33 schrieb One Thousand Gnomes:
> > On Wed, 20 May 2015 17:46:44 +0200
> > Richard Weinberger  wrote:
> > 
> >> On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> >>  wrote:
> >>> Lets give the parport subsystem a proper name and start
> >>> maintaining the files.
> >>
> >> Excuse me, but usually someone takes over the maintainer role after
> >> proving that he
> >> cares for a sub system for a certain period of time.
> >> Or did I miss something?
> > 
> > It currently (and for some time) has had no maintainer so having a
> > maintainer is IMHO definitely an improvement in things.
> 
> Having a maintainer is good.
> All I wanted to point out was that it is IMHO uncommon to claim maintainership
> before being the main contributor or the de facto maintainer of a
> subsystem.
> 
> This "rule" prevents us from "Mommy!!! Look, I'm a maintainer!!!1" patches. 
> ;-)

I already have my name in the MAINTAINERS file, so that is not a cookie
to cry for.
Personnaly I will prefer Joe Perches or Dan Carpenter to be the maintainer.
They have reviewed many of my patches since I started contributing here and
I have learnt and still learning many things from them.
if this patch is a debatable topic, then lets drop it. I have written these
changes, and will write the next changes also, it doesnot matter if my name
is there in the MAINTAINERS or not.
The main reason I gave this patch is just because if any problem
(read as regression) arises due to these changes then those problem mails
would have directly come to my inbox.

regards
sudip

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


Re: [PATCH 6/6] MAINTAINERS: maintain parport

2015-05-20 Thread Greg Kroah-Hartman
On Thu, May 21, 2015 at 07:51:18AM +0200, Willy Tarreau wrote:
> On Wed, May 20, 2015 at 05:46:44PM +0200, Richard Weinberger wrote:
> > On Wed, May 20, 2015 at 5:27 PM, Sudip Mukherjee
> >  wrote:
> > > Lets give the parport subsystem a proper name and start
> > > maintaining the files.
> > 
> > Excuse me, but usually someone takes over the maintainer role after
> > proving that he
> > cares for a sub system for a certain period of time.
> > Or did I miss something?
> 
> Sudip has been volunteering for fixing this code which is marked
> as "orphan". So whatever his experience and care in this area,
> it will be better for the driver to have a maintainer than none.
> 
> Good luck Sudip, as drivers which have become orphans are probably
> the ones that deserve the least love :-)

I agree.  I've been "baby-sitting" this subsystem for a long time now.
If Sudip wants to take it on, and based on his recent patches it looks
like he does, I'm all for him to be the maintainer of it.  So this patch
in the series is fine with me, I'll apply it when the rest of this
series gets merged.

thanks,

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


[PATCH v2 4/6] i2c-parport: use new parport device model

2015-05-20 Thread Sudip Mukherjee
Modify i2c-parport driver to use the new parallel port device model.

Tested-by: Jean Delvare 
Acked-by: Wolfram Sang 
Signed-off-by: Sudip Mukherjee 
---

v2: Changed to one space instead of tab in i2c_parport_driver.

i2c_parport_cb is made local, devmodel added to driver structure,
and probe removed. 

 drivers/i2c/busses/i2c-parport.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 155da95..138347e 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -185,11 +185,15 @@ static void i2c_parport_attach(struct parport *port)
printk(KERN_ERR "i2c-parport: Failed to kzalloc\n");
return;
}
+   memset(&i2c_parport_cb, 0, sizeof(i2c_parport_cb));
+   i2c_parport_cb.flags = PARPORT_FLAG_EXCL;
+   i2c_parport_cb.irq_func = i2c_parport_irq;
+   i2c_parport_cb.private = adapter;
 
pr_debug("i2c-parport: attaching to %s\n", port->name);
parport_disable_irq(port);
-   adapter->pdev = parport_register_device(port, "i2c-parport",
-   NULL, NULL, i2c_parport_irq, PARPORT_FLAG_EXCL, adapter);
+   adapter->pdev = parport_register_dev_model(port, "i2c-parport",
+  &i2c_parport_cb, i);
if (!adapter->pdev) {
printk(KERN_ERR "i2c-parport: Unable to register with 
parport\n");
goto err_free;
@@ -283,9 +287,10 @@ static void i2c_parport_detach(struct parport *port)
 }
 
 static struct parport_driver i2c_parport_driver = {
-   .name   = "i2c-parport",
-   .attach = i2c_parport_attach,
-   .detach = i2c_parport_detach,
+   .name = "i2c-parport",
+   .match_port = i2c_parport_attach,
+   .detach = i2c_parport_detach,
+   .devmodel = true,
 };
 
 /* - Module loading, unloading and information  */
-- 
1.8.1.2

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