Re: [PATCH 2/4] Staging: most: fix snprintf() is printing too much

2015-07-30 Thread Christian Gromm
On Wed, 29 Jul 2015 11:53:34 +0530
Sudip Mukherjee  wrote:

> On Tue, Jul 28, 2015 at 05:16:09PM +0200, Christian Gromm wrote:
> > This patch prevents snprintf from exceeding a given buffer size.
> > 
> > Reported-by: Dan Carpenter 
> > Signed-off-by: Christian Gromm 
> > ---
> 
> > -   snprintf(devnod_buf, PAGE_SIZE, "%s-%s", mdev, mdev_ch);
> > +   snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, 
> > mdev_ch);
> And this gives checkpatch warning for more than 80 char.

I know, but decided to keep it anyway for the sake of readabilty.
Thanks for pointing this out.

Regards
Chris

> 
> regards
> sudip

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


Re: [PATCH v4 04/46] staging: emxx_udc: add ep capabilities support

2015-07-30 Thread Robert Baldyga
On 07/29/2015 05:20 PM, Felipe Balbi wrote:
> On Mon, Jul 27, 2015 at 11:16:14AM +0200, Robert Baldyga wrote:
>> Convert endpoint configuration to new capabilities model.
>>
>> Fixed typo in "epc-nulk" to "epc-bulk".
>>
>> Signed-off-by: Robert Baldyga 
>> ---
>>  drivers/staging/emxx_udc/emxx_udc.c | 60 
>> ++---
>>  1 file changed, 29 insertions(+), 31 deletions(-)
>>
>> diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
>> b/drivers/staging/emxx_udc/emxx_udc.c
>> index 3b7aa36..0d64bee 100644
>> --- a/drivers/staging/emxx_udc/emxx_udc.c
>> +++ b/drivers/staging/emxx_udc/emxx_udc.c
>> @@ -3153,36 +3153,33 @@ static const struct usb_gadget_ops nbu2ss_gadget_ops 
>> = {
>>  .ioctl  = nbu2ss_gad_ioctl,
>>  };
>>  
>> -static const char g_ep0_name[] = "ep0";
>> -static const char g_ep1_name[] = "ep1-bulk";
>> -static const char g_ep2_name[] = "ep2-bulk";
>> -static const char g_ep3_name[] = "ep3in-int";
>> -static const char g_ep4_name[] = "ep4-iso";
>> -static const char g_ep5_name[] = "ep5-iso";
>> -static const char g_ep6_name[] = "ep6-bulk";
>> -static const char g_ep7_name[] = "ep7-bulk";
>> -static const char g_ep8_name[] = "ep8in-int";
>> -static const char g_ep9_name[] = "ep9-iso";
>> -static const char g_epa_name[] = "epa-iso";
>> -static const char g_epb_name[] = "epb-bulk";
>> -static const char g_epc_name[] = "epc-nulk";
>> -static const char g_epd_name[] = "epdin-int";
>> -
>> -static const char *gp_ep_name[NUM_ENDPOINTS] = {
>> -g_ep0_name,
>> -g_ep1_name,
>> -g_ep2_name,
>> -g_ep3_name,
>> -g_ep4_name,
>> -g_ep5_name,
>> -g_ep6_name,
>> -g_ep7_name,
>> -g_ep8_name,
>> -g_ep9_name,
>> -g_epa_name,
>> -g_epb_name,
>> -g_epc_name,
>> -g_epd_name,
>> +static const struct {
>> +const char *name;
>> +const struct usb_ep_caps caps;
>> +} ep_info[NUM_ENDPOINTS] = {
>> +#define EP_INFO(_name, _type, _dir) \
>> +{ \
>> +.name = _name, \
>> +.caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \
>> +USB_EP_CAPS_DIR_ ## _dir), \
>> +}
>> +
>> +EP_INFO("ep0",  CONTROL, ALL),
>> +EP_INFO("ep1-bulk", BULK,   ALL),
>> +EP_INFO("ep2-bulk", BULK,   ALL),
>> +EP_INFO("ep3in-int",INT,IN),
>> +EP_INFO("ep4-iso",  INT,ALL),
>> +EP_INFO("ep5-iso",  ISO,ALL),
>> +EP_INFO("ep6-bulk", ISO,ALL),
>> +EP_INFO("ep7-bulk", BULK,   ALL),
>> +EP_INFO("ep8in-int",INT,IN),
>> +EP_INFO("ep9-iso",  ISO,ALL),
>> +EP_INFO("epa-iso",  ISO,ALL),
>> +EP_INFO("epb-bulk", BULK,   ALL),
>> +EP_INFO("epc-bulk", BULK,   ALL),
>> +EP_INFO("epdin-int",INT,IN),
> 
> IMO, this is pointless obfuscation. It just makes it a pain to grep
> source around. Why don't you have UDC drivers initialize the 1-bit flags
> directly ?
> 

Do you mean something like this? It just makes it a pain to scroll this
source ;)

static const struct {
const char *name;
const struct usb_ep_caps caps;
} ep_info[NUM_ENDPOINTS] = {
{
.name = "ep0",
.caps = {
.type_control = true,
.dir_in = true,
.dir_out = true,
},
},
{
.name = "ep1-bulk",
.caps = {
.type_bulk = true,
.dir_in = true,
.dir_out = true,
},
},
{
.name = "ep2-bulk",
.caps = {
.type_bulk = true,
.dir_in = true,
.dir_out = true,
},
},
{
.name = "ep3in-int",
.caps = {
.type_int = true,
.dir_in = true,
},
},
{
.name = "ep4-iso",
.caps = {
.type_iso = true,
.dir_in = true,
.dir_out = true,
},
},
{
.name = "ep5-iso",
.caps = {
.type_iso = true,
.dir_in = true,
.dir_out = true,
},
},
{
.name = "ep6-bulk",
.caps = {
.type_bulk = true,
.dir_in = true,
.dir_out = true,
},
},
{
.name = "ep7-bulk",
.caps = {
.type_bulk = true,
.dir_in = true,
.dir_out = true,
},
},
{
.name = "ep8in-int",
.caps = {
  

Re: [patch] staging: comedi: das16: remove a duplicate condition

2015-07-30 Thread walter harms


Am 29.07.2015 23:36, schrieb Dan Carpenter:
> We checked that "it->options[3]" was non-zero on the line before so
> there is no need to check again.
> 
> Signed-off-by: Dan Carpenter 
> 
> diff --git a/drivers/staging/comedi/drivers/das16.c 
> b/drivers/staging/comedi/drivers/das16.c
> index d7cf4b1..056bca9 100644
> --- a/drivers/staging/comedi/drivers/das16.c
> +++ b/drivers/staging/comedi/drivers/das16.c
> @@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, 
> struct comedi_devconfig *it)
>  
>   /*  check that clock setting is valid */
>   if (it->options[3]) {
> - if (it->options[3] != 0 &&
> - it->options[3] != 1 && it->options[3] != 10) {
> + if (it->options[3] != 1 && it->options[3] != 10) {
>   dev_err(dev->class_dev,
>   "Invalid option. Master clock must be set to 1 
> or 10 (MHz)\n");
>   return -EINVAL;

mmh, acording to the error messages 1 or 10 is allowed, obviously 0 is/was also 
valid.
I would suggest to put that into one if () to make things more obvious.
It 0 is also valid a minor tweak to the error msg would be nice.


re,
 wh

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


Re: [PATCH 2/4] Staging: most: fix snprintf() is printing too much

2015-07-30 Thread Dan Carpenter
On Thu, Jul 30, 2015 at 09:05:39AM +0200, Christian Gromm wrote:
> On Wed, 29 Jul 2015 11:53:34 +0530
> Sudip Mukherjee  wrote:
> 
> > On Tue, Jul 28, 2015 at 05:16:09PM +0200, Christian Gromm wrote:
> > > This patch prevents snprintf from exceeding a given buffer size.
> > > 
> > > Reported-by: Dan Carpenter 
> > > Signed-off-by: Christian Gromm 
> > > ---
> > 
> > > - snprintf(devnod_buf, PAGE_SIZE, "%s-%s", mdev, mdev_ch);
> > > + snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, 
> > > mdev_ch);
> > And this gives checkpatch warning for more than 80 char.
> 
> I know, but decided to keep it anyway for the sake of readabilty.
> Thanks for pointing this out.

I sometimes go over 80 characters, but it's not a good idea to do that
in staging.  Someone is just going to send a follow on patch which adds
a line break.  It takes too much energy to reject those patches.

regards,
dan carpenter

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


Re: [RFC PATCH] staging: rtl8192e: Rework EEPROM handling code

2015-07-30 Thread Mateusz Kulikowski
On Wed, Jul 29, 2015 at 02:04:42AM +0300, Dan Carpenter wrote:
> On Tue, Jul 28, 2015 at 11:52:42PM +0200, Mateusz Kulikowski wrote:
> 
> > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c 
> > b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c
> > index ed54193..fe4e282 100644
> > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c
> > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c
> > @@ -25,115 +25,72 @@
> >  #include "rtl_core.h"
> >  #include "rtl_eeprom.h"
> >  
> > -static void eprom_cs(struct net_device *dev, short bit)
> > +static void _rtl92e_gpio_set(struct net_device *dev, int no, int val)
> 
> I don't like the new name very much.  I don't like the underscore.  Also
> set kind of implies set vs clear.  Maybe:
> 
> static void rtl92e_gpio_write_bit(struct net_device *dev, int bit, bool val)

The underscore is notation used in rtlwifi - they use _rtl92 for 
static functions and rtl92 for the rest.

We may like it or not, but IMHO it's better to have unification if this driver
is ever going to be unstaged.

As for your proposed name - except for prefix part it's fine.

> > -static void eprom_ck_cycle(struct net_device *dev)
> > +static int _rtl92e_gpio_get(struct net_device *dev, int no)
> 
> static bool rtl92e_gpio_get_bit(struct net_device *dev, int bit)

As above

> 
> >  {
> > -   rtl92e_writeb(dev, EPROM_CMD,
> > - (1< > -   udelay(EPROM_DELAY);
> > -   rtl92e_writeb(dev, EPROM_CMD,
> > - rtl92e_readb(dev, EPROM_CMD) & ~(1< > -   udelay(EPROM_DELAY);
> > -}
> > +   u8 reg = rtl92e_readb(dev, EPROM_CMD);
> >  
> > +   return (reg >> no) & 0x1;
> > +}
> >  
> > -static void eprom_w(struct net_device *dev, short bit)
> > +static void _rtl92e_eeprom_ck_cycle(struct net_device *dev)
> >  {
> > -   if (bit)
> > -   rtl92e_writeb(dev, EPROM_CMD, (1< > - rtl92e_readb(dev, EPROM_CMD));
> > -   else
> > -   rtl92e_writeb(dev, EPROM_CMD,
> > - rtl92e_readb(dev, EPROM_CMD) &
> > - ~(1< > -
> > -   udelay(EPROM_DELAY);
> > +   _rtl92e_gpio_set(dev, EPROM_CK_BIT, 1);
> > +   _rtl92e_gpio_set(dev, EPROM_CK_BIT, 0);
> 
> The old cycle function had some delays built in.  You're probably right
> that they aren't needed, but why do you think so?

Delays are now built-in to gpio_set function to give device time to 
respond.

I have removed delays during read operation as we wait after write.
Reading is just reading gpio register - I see reason to wait.
Of course I've tested that - with no delays at all or other bugs 
driver just fails to probe device.

As for other comments - could you take look at "Notes" from patch?
This was one of main concerns for me - Wouldn't it be better 
if I rewrite that code to use GPIO/SPI/EEPROM subsystems?

Although code sie will probably not decrease and we will
be dependent on other modules, but it seems more 'proper'
solution.


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


Re: [patch] staging: comedi: das16: remove a duplicate condition

2015-07-30 Thread Dan Carpenter
On Thu, Jul 30, 2015 at 09:18:56AM +0200, walter harms wrote:
> 
> 
> Am 29.07.2015 23:36, schrieb Dan Carpenter:
> > We checked that "it->options[3]" was non-zero on the line before so
> > there is no need to check again.
> > 
> > Signed-off-by: Dan Carpenter 
> > 
> > diff --git a/drivers/staging/comedi/drivers/das16.c 
> > b/drivers/staging/comedi/drivers/das16.c
> > index d7cf4b1..056bca9 100644
> > --- a/drivers/staging/comedi/drivers/das16.c
> > +++ b/drivers/staging/comedi/drivers/das16.c
> > @@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, 
> > struct comedi_devconfig *it)
> >  
> > /*  check that clock setting is valid */
> > if (it->options[3]) {
> > -   if (it->options[3] != 0 &&
> > -   it->options[3] != 1 && it->options[3] != 10) {
> > +   if (it->options[3] != 1 && it->options[3] != 10) {
> > dev_err(dev->class_dev,
> > "Invalid option. Master clock must be set to 1 
> > or 10 (MHz)\n");
> > return -EINVAL;
> 
> mmh, acording to the error messages 1 or 10 is allowed, obviously 0 is/was 
> also valid.
> I would suggest to put that into one if () to make things more obvious.
> It 0 is also valid a minor tweak to the error msg would be nice.

Zero values are not used.  If you are going to set it then it has to be
1 or 10.  The message makes sense and matches the logic of the code.

regards,
dan carpenter

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


Re: [RFC PATCH] staging: rtl8192e: Rework EEPROM handling code

2015-07-30 Thread Dan Carpenter
On Thu, Jul 30, 2015 at 10:31:04AM +0200, Mateusz Kulikowski wrote:
> As for other comments - could you take look at "Notes" from patch?
> This was one of main concerns for me - Wouldn't it be better 
> if I rewrite that code to use GPIO/SPI/EEPROM subsystems?

I don't know.  Let's just merge this as a clean up since you've already
done it and not do the other unless you really feel like it or the
linux-wireless people ask for it.

regards,
dan carpenter

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


Re: [PATCH 2/4] Staging: most: fix snprintf() is printing too much

2015-07-30 Thread Christian Gromm
On Thu, 30 Jul 2015 11:28:43 +0300
Dan Carpenter  wrote:

> On Thu, Jul 30, 2015 at 09:05:39AM +0200, Christian Gromm wrote:
> > On Wed, 29 Jul 2015 11:53:34 +0530
> > Sudip Mukherjee  wrote:
> > 
> > > On Tue, Jul 28, 2015 at 05:16:09PM +0200, Christian Gromm wrote:
> > > > This patch prevents snprintf from exceeding a given buffer size.
> > > > 
> > > > Reported-by: Dan Carpenter 
> > > > Signed-off-by: Christian Gromm 
> > > > ---
> > > 
> > > > -   snprintf(devnod_buf, PAGE_SIZE, "%s-%s", mdev, mdev_ch);
> > > > +   snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev, 
> > > > mdev_ch);
> > > And this gives checkpatch warning for more than 80 char.
> > 
> > I know, but decided to keep it anyway for the sake of readabilty.
> > Thanks for pointing this out.
> 
> I sometimes go over 80 characters, but it's not a good idea to do that
> in staging.  Someone is just going to send a follow on patch which adds
> a line break.  It takes too much energy to reject those patches.

Thanks for the hint. Appreciate that.

regards,
Chris

> 
> regards,
> dan carpenter
> 

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


[PATCH 0/5] 2nd patch for illegal coding style

2015-07-30 Thread Tony Cho
This patch V2 includes only patches rejected. The rejected patch for the
following, #ifdef conditionals cover entire functions, introduced new error on
required space before the open parenthesis '('. This is my mistake while
rewriting codes.

The original 13th patch didn't include new fix introduced on the previous patch
due to no sync-up issue. The original 13th patch fixed the same warnings but
in different place. 

The 64bit compile warnings will be resolved after sending these patches. Then,
ambiguous sdio/spi parts including preprocessor conditionals will be tried.

Tony Cho (5):
  staging: wilc1000: #ifdef conditionals cover entire functions
  staging: wilc1000: remove unnecessary blank lines
  staging: wilc1000: remove warnings on missing blank line
  staging: wilc1000: remove errors on required space
  staging: wilc1000: remove unused functions

 drivers/staging/wilc1000/wilc_sdio.c | 518 +++
 drivers/staging/wilc1000/wilc_wlan.c |   1 -
 2 files changed, 283 insertions(+), 236 deletions(-)

-- 
1.9.1

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


[PATCH V2 2/5] staging: wilc1000: remove unnecessary blank lines

2015-07-30 Thread Tony Cho
This patch removes the following warnings reported by checkpatch.pl.
- Blank lines aren't necessary after an open brace '{'
- Blank lines aren't necessary before a close brace '}'

Signed-off-by: Tony Cho 
---
V2: This patch doesn't have a difference with the first one but resent
because it's rejected with the 9th patch.
---
 drivers/staging/wilc1000/wilc_sdio.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 50be2a1..42c5ad8 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -679,7 +679,6 @@ static void sdio_set_default_speed(void)
 
 static int sdio_read_size(uint32_t *size)
 {
-
uint32_t tmp;
sdio_cmd52_t cmd;
 
@@ -806,7 +805,6 @@ static int sdio_clear_int_ext(uint32_t val)
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed 
cmd52, set 0xf8 data (%d) ...\n", __LINE__);
goto _fail_;
}
-
}
} else {
/* see below. has_thrpt_enh2 uses register 0xf8 to clear 
interrupts. */
@@ -910,7 +908,6 @@ static int sdio_clear_int_ext(uint32_t val)
g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed 
cmd52, set 0xf8 data (%d) ...\n", __LINE__);
goto _fail_;
}
-
}
} else {
uint32_t vmm_ctl;
-- 
1.9.1

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


[PATCH V2 3/5] staging: wilc1000: remove warnings on missing blank line

2015-07-30 Thread Tony Cho
This patch removes the warnings reported by checkpatch.pl on missing
a blank line after declarations.

Signed-off-by: Tony Cho 
---
V2: This patch doesn't have a difference with the first one. However,
it's resent becasue not accepted with the 9th patch.
---
 drivers/staging/wilc1000/wilc_sdio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index ee1cbd1..50be2a1 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -780,6 +780,7 @@ static int sdio_clear_int_ext(uint32_t val)
 
if (g_sdio.has_thrpt_enh3) {
uint32_t reg;
+
reg = val & ((1 << MAX_NUN_INT_THRPT_ENH2) - 1);
 
/* select VMM table 0 */
-- 
1.9.1

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


[PATCH V2 1/5] staging: wilc1000: #ifdef conditionals cover entire functions

2015-07-30 Thread Tony Cho
This patch lets preprocessor conditionals (#ifdef) related to
WILC_SDIO_IRQ_GPIO to compile out the entire functions. Compiling out
the entire functions is preferred rather than portions of functions or
expressions becausue doing so makes code harder to read.

Signed-off-by: Tony Cho 
---
V2: Remove the warnings on the following:
- ERROR: space required before the open parenthesis '('
This patch is resent because unexpected warning is added while rewriting
codes.
---
 drivers/staging/wilc1000/wilc_sdio.c | 480 +--
 1 file changed, 292 insertions(+), 188 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 5a18148..c52044a 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -155,22 +155,9 @@ _fail_:
return 0;
 }
 
+#ifdef WILC_SDIO_IRQ_GPIO
 static int sdio_clear_int(void)
 {
-#ifndef WILC_SDIO_IRQ_GPIO
-   /* uint32_t sts; */
-   sdio_cmd52_t cmd;
-
-   cmd.read_write = 0;
-   cmd.function = 1;
-   cmd.raw = 0;
-   cmd.address = 0x4;
-   cmd.data = 0;
-   g_sdio.sdio_cmd52(&cmd);
-   int_clrd++;
-
-   return cmd.data;
-#else
uint32_t reg;
 
if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {
@@ -181,9 +168,23 @@ static int sdio_clear_int(void)
sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
int_clrd++;
return 1;
-#endif
+}
+#else
+static int sdio_clear_int(void)
+{
+   sdio_cmd52_t cmd;
+
+   cmd.read_write = 0;
+   cmd.function = 1;
+   cmd.raw = 0;
+   cmd.address = 0x4;
+   cmd.data = 0;
+   g_sdio.sdio_cmd52(&cmd);
+   int_clrd++;
 
+   return cmd.data;
 }
+#endif /* WILC_SDIO_IRQ_GPIO */
 
 uint32_t sdio_xfer_cnt(void)
 {
@@ -521,9 +522,11 @@ static int sdio_deinit(void *pv)
return 1;
 }
 
+#ifdef WILC_SDIO_IRQ_GPIO
 static int sdio_sync(void)
 {
uint32_t reg;
+   int ret;
 
/**
 *  Disable power sequencer
@@ -539,45 +542,60 @@ static int sdio_sync(void)
return 0;
}
 
-#ifdef WILC_SDIO_IRQ_GPIO
-   {
-   uint32_t reg;
-   int ret;
+   /**
+*  interrupt pin mux select
+**/
+   ret = sdio_read_reg(WILC_PIN_MUX_0, ®);
+   if (!ret) {
+   g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", 
WILC_PIN_MUX_0);
+   return 0;
+   }
+   reg |= (1 << 8);
+   ret = sdio_write_reg(WILC_PIN_MUX_0, reg);
+   if (!ret) {
+   g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg 
(%08x)...\n", WILC_PIN_MUX_0);
+   return 0;
+   }
 
-   /**
-*  interrupt pin mux select
-**/
-   ret = sdio_read_reg(WILC_PIN_MUX_0, ®);
-   if (!ret) {
-   g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg 
(%08x)...\n", WILC_PIN_MUX_0);
-   return 0;
-   }
-   reg |= (1 << 8);
-   ret = sdio_write_reg(WILC_PIN_MUX_0, reg);
-   if (!ret) {
-   g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg 
(%08x)...\n", WILC_PIN_MUX_0);
-   return 0;
-   }
+   /**
+*  interrupt enable
+**/
+   ret = sdio_read_reg(WILC_INTR_ENABLE, ®);
+   if (!ret) {
+   g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg (%08x)...\n", 
WILC_INTR_ENABLE);
+   return 0;
+   }
+   reg |= (1 << 16);
+   ret = sdio_write_reg(WILC_INTR_ENABLE, reg);
+   if (!ret) {
+   g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg 
(%08x)...\n", WILC_INTR_ENABLE);
+   return 0;
+   }
 
-   /**
-*  interrupt enable
-**/
-   ret = sdio_read_reg(WILC_INTR_ENABLE, ®);
-   if (!ret) {
-   g_sdio.dPrint(N_ERR, "[wilc spi]: Failed read reg 
(%08x)...\n", WILC_INTR_ENABLE);
-   return 0;
-   }
-   reg |= (1 << 16);
-   ret = sdio_write_reg(WILC_INTR_ENABLE, reg);
-   if (!ret) {
-   g_sdio.dPrint(N_ERR, "[wilc spi]: Failed write reg 
(%08x)...\n", WILC_INTR_ENABLE);
-   return 0;
-   }
+   return 1;
+}
+#else
+static int sdio_sync(void)
+{
+   uint32_t reg;
+
+   /**
+*  Disable power sequencer
+**/
+   if (!sdio_read_reg(WILC_MISC, ®)) {
+   g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed read misc reg...\n");
+   return 0;
+   }
+
+   reg &= ~(1 << 8);
+   if (!sdio_write_reg(WILC_MISC, reg)) {
+   g_sdio.dPrint(N_ERR, "[wilc sdio]: Failed write misc reg...\n");
+   return 0;
}
-#endif
 
return 1;
 }
+#endif /* WILC_SDIO_IRQ_GPIO */
 
 s

[PATCH V2 4/5] staging: wilc1000: remove errors on required space

2015-07-30 Thread Tony Cho
This patch removes the errors reported by checkpatch.pl, which is the
space required before the open parenthesis '('.

Signed-off-by: Tony Cho 
---
V2: This patch is not different with the first one. This patch includes
warnings on no space required before the open parenthesis in the
function, sdio_clear_int_ext. The 9th patch fixed the same problem in
the function,  not sdio_clear_int_ext but sdio_sync.
---
 drivers/staging/wilc1000/wilc_sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 44421d0..ee1cbd1 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -778,7 +778,7 @@ static int sdio_clear_int_ext(uint32_t val)
 {
int ret;
 
-   if(g_sdio.has_thrpt_enh3) {
+   if (g_sdio.has_thrpt_enh3) {
uint32_t reg;
reg = val & ((1 << MAX_NUN_INT_THRPT_ENH2) - 1);
 
-- 
1.9.1

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


[PATCH V2 5/5] staging: wilc1000: remove unused functions

2015-07-30 Thread Tony Cho
This patch removes the dead functions which are not used anymore.
- sdio_check_bs
- sdio_xfer_cnt

Signed-off-by: Tony Cho 
---
V2: This patch doesn't have any difference with the first patch becasue
this patch just removes unnecessary functions. However, it is resent
because it's not accepted with the 9th patch which has a problem.
---
 drivers/staging/wilc1000/wilc_sdio.c | 56 
 drivers/staging/wilc1000/wilc_wlan.c |  1 -
 2 files changed, 57 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index c52044a..44421d0 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -186,67 +186,11 @@ static int sdio_clear_int(void)
 }
 #endif /* WILC_SDIO_IRQ_GPIO */
 
-uint32_t sdio_xfer_cnt(void)
-{
-   uint32_t cnt = 0;
-   sdio_cmd52_t cmd;
-
-   cmd.read_write = 0;
-   cmd.function = 1;
-   cmd.raw = 0;
-   cmd.address = 0x1C;
-   cmd.data = 0;
-   g_sdio.sdio_cmd52(&cmd);
-   cnt = cmd.data;
-
-   cmd.read_write = 0;
-   cmd.function = 1;
-   cmd.raw = 0;
-   cmd.address = 0x1D;
-   cmd.data = 0;
-   g_sdio.sdio_cmd52(&cmd);
-   cnt |= (cmd.data << 8);
-
-   cmd.read_write = 0;
-   cmd.function = 1;
-   cmd.raw = 0;
-   cmd.address = 0x1E;
-   cmd.data = 0;
-   g_sdio.sdio_cmd52(&cmd);
-   cnt |= (cmd.data << 16);
-
-   return cnt;
-}
-
 /
  *
  *  Sdio interfaces
  *
  /
-int sdio_check_bs(void)
-{
-   sdio_cmd52_t cmd;
-
-   /**
-*  poll until BS is 0
-**/
-   cmd.read_write = 0;
-   cmd.function = 0;
-   cmd.raw = 0;
-   cmd.address = 0xc;
-   cmd.data = 0;
-   if (!g_sdio.sdio_cmd52(&cmd)) {
-   g_sdio.dPrint(N_ERR, "[wilc sdio]: Fail cmd 52, get BS 
register...\n");
-   goto _fail_;
-   }
-
-   return 1;
-
-_fail_:
-
-   return 0;
-}
-
 static int sdio_write_reg(uint32_t addr, uint32_t data)
 {
 #ifdef BIG_ENDIAN
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index def72fd..68c38ec 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -25,7 +25,6 @@ extern u8 g_wilc_initialized; /* AMR : 0422 RK3026 Crash 
issue */
 #endif
 extern void WILC_WFI_mgmt_rx(uint8_t *buff, uint32_t size);
 extern void frmw_to_linux(uint8_t *buff, uint32_t size);
-int sdio_xfer_cnt(void);
 uint32_t wilc_get_chipid(uint8_t update);
 u16 Set_machw_change_vir_if(bool bValue);
 
-- 
1.9.1

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


Re: [patch] staging: comedi: das16: remove a duplicate condition

2015-07-30 Thread Ian Abbott

On 29/07/15 22:36, Dan Carpenter wrote:

We checked that "it->options[3]" was non-zero on the line before so
there is no need to check again.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index d7cf4b1..056bca9 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -1032,8 +1032,7 @@ static int das16_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)

/*  check that clock setting is valid */
if (it->options[3]) {
-   if (it->options[3] != 0 &&
-   it->options[3] != 1 && it->options[3] != 10) {
+   if (it->options[3] != 1 && it->options[3] != 10) {
dev_err(dev->class_dev,
"Invalid option. Master clock must be set to 1 or 10 
(MHz)\n");
return -EINVAL;



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] improve lmk to avoid deadlock issue

2015-07-30 Thread Dan Carpenter
I'm not an android dev but this patch seems reasonable enough.  There
are some process issues though.

1) The subject should have a subsystem prefix:

[PATCH] Staing: android: lowmemorykiller: improve lmk to avoid deadlock issue


On Thu, Jul 30, 2015 at 06:49:53AM +, Wang, Biao wrote:
> From: "wang, biao" 
> Date: Thu, 30 Jul 2015 14:14:44 +0800
> Subject: [PATCH] improve lmk to avoid deadlock issue

2)  Don't put these lines in the patch.

> 
> Consider the following case:
> Task A trigger lmk with a lock held, while process B try to
> get this lock, but unfortunately B is the very culprit Task lmk select to
> kill.
> So B will never be killed, and A will forever select B to kill and
> such dead lock trigger softlock up issue.
> This patch try to pick the next task to break this loop.
> 
> Signed-off-by: wang, biao 

3) Use capital letters for your name here.  It should match your email
address.

> Signed-off-by: Zhang Di 

4) Did Zhang write this patch?  If so then add a From: tag at the top
of the email to give authorship credit.  Signed-off-by tags mean that
the patch went through your hands somehow.  Otherwise use the
Reviewed-by, Reported-by, or Acked-by tag whichever is appropriate.

> ---
>  drivers/staging/android/lowmemorykiller.c |   14 +-
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/android/lowmemorykiller.c 
> b/drivers/staging/android/lowmemorykiller.c
> index feafa17..efabeb7 100644
> --- a/drivers/staging/android/lowmemorykiller.c
> +++ b/drivers/staging/android/lowmemorykiller.c
> @@ -127,11 +127,15 @@ static unsigned long lowmem_scan(struct shrinker *s, 
> struct shrink_control *sc)
>   if (!p)
>   continue;
>  
> - if (test_tsk_thread_flag(p, TIF_MEMDIE) &&
> - time_before_eq(jiffies, lowmem_deathpending_timeout)) {
> - task_unlock(p);
> - rcu_read_unlock();
> - return 0;
> + if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
> + if (time_before_eq(jiffies, 
> lowmem_deathpending_timeout)) {

5) This goes over the 80 character limit.  Could you break it up like
this:

if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
if (time_before_eq(jiffies,
   lowmem_deathpending_timeout)) {
task_unlock(p);

Anyway, thank for this patch.  Please fix these small process issues
and resend.

regards,
dan carpenter

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


RE: [PATCH V4 7/7] Drivers: hv: vmbus: disable local interrupt when hvsock's callback is running

2015-07-30 Thread Dexuan Cui
> From: David Miller
> Sent: Thursday, July 30, 2015 6:28
> > From: Dexuan Cui 
> > Date: Tue, 28 Jul 2015 05:35:30 -0700
> >
> > In the SMP guest case, when the per-channel callback hvsock_events() is
> > running on virtual CPU A, if the guest tries to close the connection on
> > virtual CPU B: we invoke vmbus_close() -> vmbus_close_internal(),
> > then we can have trouble: on B, vmbus_close_internal() will send IPI
> > reset_channel_cb() to A, trying to set channel->onchannel_callbackto NULL;
> > on A, if the IPI handler happens between
> > "if (channel->onchannel_callback != NULL)" and invoking
> > channel->onchannel_callback, we'll invoke a function pointer of NULL.
> >
> > This is why the patch is necessary.
> >
> Sorry, I do not accept that you must use conditional locking and/or
> IRQ disabling.
>
> Boil it down to what is necessary for the least common denominator,
> and use that unconditionally.

Hi David,
Thanks for the comment!

I agree with you it's not clean to use conditional IRQ disabling.

Here I didn't use unconditionally IRQ disabling because the Hyper-V netvsc
and storvsc driver's vmbus event callbacks (i.e. netvsc_channel_cb() and
storvsc_on_channel_callback()) may take relatively long time (e.g., netvsc can
operate at a speed of 10Gb) and I think it's bad to disable IRQ for long time
when the callbacks are running in a tasklet context, e.g., the Hyper-V timer
can be affected: see vmbus_isr() -> hv_process_timer_expiration().

To resolve the race condition between vmbus_close_internal() and
process_chn_event() in SMP case, now I propose a new method:

we can serialize the 2 paths by adding
tasklet_disable(hv_context.event_dpc[channel->target_cpu]) and
tasklet_enable(...) in vmbus_close_internal().

In this way, we need the least change and we can drop this patch.

Please let me know your opinion.

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


RE: [PATCH V4 6/7] hvsock: introduce Hyper-V VM Sockets feature

2015-07-30 Thread Dexuan Cui
> From: David Miller
> Sent: Thursday, July 30, 2015 6:28
> >From: Dexuan Cui
> >Date: Tue, 28 Jul 2015 05:35:23 -0700
> >
> > +/* hvsock_release() can be invoked in 2 paths:
> > + * 1. on process termination:
> > + * hvsock_sk_destruct+0x1a/0x20
> > + * __sk_free+0x1d/0x130
> > + * sk_free+0x19/0x20
> > + * hvsock_release+0x138/0x160
> > + * sock_release+0x1f/0x90
> > + * sock_close+0x12/0x20
> > + * __fput+0xdf/0x1f0
> > + * fput+0xe/0x10
> > + * task_work_run+0xd4/0xf0
> > + * do_exit+0x334/0xb90
> > + * ? __do_page_fault+0x1e1/0x490
> > + * ? lockdep_sys_exit_thunk+0x35/0x67
> > + * do_group_exit+0x54/0xe0
> > + * SyS_exit_group+0x14/0x20
> > + * system_call_fastpath+0x16/0x1b
> > + *
> > + *  2. when accept() returns -ENITR:
> > + * hvsock_release+0x151/0x160
> > + * sock_release+0x1f/0x90
> > + * sock_close+0x12/0x20
> > + * __fput+0xdf/0x1f0
> > + * fput+0xe/0x10
> > + * task_work_run+0xb7/0xf0
> > + * get_signal+0x750/0x770
> > + * do_signal+0x28/0xbb0
> > + * ? put_unused_fd+0x52/0x60
> > + * ? SYSC_accept4+0x1ca/0x220
> > + * do_notify_resume+0x4f/0x90
> > + * int_signal+0x12/0x17
> > + */
> 
> It is a bit much to put full stack backtraces into a comment like this.

Thanks for reviewing the patch, David!
I'll remove these lines and add a proper comment here.

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


RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks to process hvsock connection

2015-07-30 Thread Dexuan Cui
> From: David Miller
> Sent: Thursday, July 30, 2015 6:27
> 
> From: Dexuan Cui
> Date: Tue, 28 Jul 2015 05:35:11 -0700
> 
> > With the 2 APIs supplied by the VMBus driver, the coming net/hvsock driver
> > can register 2 callbacks and can know when a new hvsock connection is
> > offered by the host, and when a hvsock connection is being closed by the
> > host.
> >
> This is an extremely terrible interface.
> 
> It's an opaque hook that allows on registry, and it's solve purpose
> is to allow a backdoor call into a foreign driver in another module.
> 
> These are exactly the things we try to avoid.

Hi David,
Thanks a lot for your reviewing and the suggestion!

> Why not create a real abstraction where clients register an object,
> that can be contained as a sub-member inside of their own driver
> private, that provides the callback registry mechanism.

Please pardon me for my inexperience.
Can you please be a bit more specific?
I guess maybe you're referencing a common design pattern in the driver
code, so an example in some existing driver would be the best. :-)

"clients register an object " -- 
does the "clients" mean the hvsock driver?
and the "object" means the 2 callbacks?

IMHO, here the vmbus driver has to synchronously pass the 2 events
to the hvsock driver, so a "backdoor call into the hvsock driver" is
inevitable anyway?

e.g., in the path vmbus_process_offer() -> hvsock_process_offer(), the
return value of the latter is important to the former, because on error
the former needs to clean up some internal states of the vmbus driver (that
is, the "goto err_deq_chan").

 
> That way you can register multiple clients, do things like allow
> AF_PACKET capturing of vmbus traffic, etc.

I thought AF_PACKET can only capture IP packets or Ethernet frames.
Can it be used to capture AF_UNIX packet? 
If yes, I suppose we can consider making it work for AF_HYPERV too,
if people ask for that.

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


[RESEND V2 3/3] staging: wilc1000: coreconfigurator.c: fix kmalloc error check

2015-07-30 Thread Chaehyun Lim
Return -ENOMEM if memory allocation is failed.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 67cec9d..258a0d2 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -675,11 +675,8 @@ s32 CoreConfiguratorInit(void)
sema_init(&SemHandlePktResp, 0);
 
gps8ConfigPacket = kmalloc(MAX_PACKET_BUFF_SIZE, GFP_KERNEL);
-   if (gps8ConfigPacket == NULL) {
-   PRINT_ER("failed in gps8ConfigPacket allocation\n");
-   s32Error = WILC_NO_MEM;
-   goto _fail_;
-   }
+   if (!gps8ConfigPacket)
+   return -ENOMEM;
 
WILC_memset((void *)gps8ConfigPacket, 0, MAX_PACKET_BUFF_SIZE);
 
@@ -1031,10 +1028,8 @@ s32 ParseSurveyResults(u8 
ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
 
pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
sizeof(wid_site_survey_reslts_s), GFP_KERNEL);
-   if (pstrSurveyResults == NULL) {
-   u32SurveyResultsCount = 0;
-   WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-   }
+   if (!pstrSurveyResults)
+   return -ENOMEM;
 
WILC_memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * 
sizeof(wid_site_survey_reslts_s));
 
-- 
1.9.1

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


[RESEND V2 1/3] staging: wilc1000: coreconfigurator.c: remove WILC_MALLOC

2015-07-30 Thread Chaehyun Lim
Use kmalloc and kmalloc_array instead of WILC_MALLOC.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 342a336..37e09b8 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -674,7 +674,7 @@ s32 CoreConfiguratorInit(void)
sema_init(&SemHandleSendPkt, 1);
sema_init(&SemHandlePktResp, 0);
 
-   gps8ConfigPacket = (s8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE);
+   gps8ConfigPacket = kmalloc(MAX_PACKET_BUFF_SIZE, GFP_KERNEL);
if (gps8ConfigPacket == NULL) {
PRINT_ER("failed in gps8ConfigPacket allocation\n");
s32Error = WILC_NO_MEM;
@@ -811,7 +811,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u32 u32Tsf_Lo;
u32 u32Tsf_Hi;
 
-   pstrNetworkInfo = (tstrNetworkInfo 
*)WILC_MALLOC(sizeof(tstrNetworkInfo));
+   pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
WILC_memset((void *)(pstrNetworkInfo), 0, 
sizeof(tstrNetworkInfo));
 
pstrNetworkInfo->s8rssi = pu8WidVal[0];
@@ -861,7 +861,7 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
if (u16IEsLen > 0) {
-   pstrNetworkInfo->pu8IEs = (u8 *)WILC_MALLOC(u16IEsLen);
+   pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
@@ -928,7 +928,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u8 *pu8IEs = 0;
u16 u16IEsLen = 0;
 
-   pstrConnectRespInfo = (tstrConnectRespInfo 
*)WILC_MALLOC(sizeof(tstrConnectRespInfo));
+   pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
WILC_memset((void *)(pstrConnectRespInfo), 0, 
sizeof(tstrConnectRespInfo));
 
/* u16AssocRespLen = pu8Buffer[0]; */
@@ -948,7 +948,7 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
-   pstrConnectRespInfo->pu8RespIEs = (u8 *)WILC_MALLOC(u16IEsLen);
+   pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
@@ -1017,7 +1017,8 @@ s32 ParseSurveyResults(u8 
ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
}
}
 
-   pstrSurveyResults = (wid_site_survey_reslts_s 
*)WILC_MALLOC(u32SurveyResultsCount * sizeof(wid_site_survey_reslts_s));
+   pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
+   sizeof(wid_site_survey_reslts_s), GFP_KERNEL);
if (pstrSurveyResults == NULL) {
u32SurveyResultsCount = 0;
WILC_ERRORREPORT(s32Error, WILC_NO_MEM);
-- 
1.9.1

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


[RESEND V2 0/3] cover letter of wilc1000 patches

2015-07-30 Thread Chaehyun Lim
Hi, Greg

I'm sorry that I did not say whether GFP_ATOMIC should be used or not.
This is my review on it. If it's not correct, please give me any comment or 
direction.

First patch has 4 sites of kmalloc change in coreconfigurator.c
First one, it is used for gps8ConfigPacket at CoreconfiguratorInit and 
CoreConfiguratorDeInit.
I think it should be removed next time because I cannot find anywhere to use it.
Then, it is okay to change flag as GFP_KERNEL.

Other three changes are used to handle host interface message within a kernel 
thread.
The manipulation of host interface message is not called on IRQ context and I 
could not
find any spin lock inside function.

If this patches are accepted, I will try to continue to change WILC_MALLOC 
macro as kmalloc.
I always appreciate your comment and advice.

Thanks
Chaehyun Lim


Chaehyun Lim (3):
  staging: wilc1000: coreconfigurator.c: remove WILC_MALLOC
  staging: wilc1000: coreconfigurator.c: add kmalloc error check
  staging: wilc1000: coreconfigurator.c: fix kmalloc error check

 drivers/staging/wilc1000/coreconfigurator.c | 38 +
 1 file changed, 23 insertions(+), 15 deletions(-)

-- 
1.9.1

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


[RESEND V2 2/3] staging: wilc1000: coreconfigurator.c: add kmalloc error check

2015-07-30 Thread Chaehyun Lim
Add error check if memory allocation is failed.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 37e09b8..67cec9d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -812,6 +812,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u32 u32Tsf_Hi;
 
pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
+   if (!pstrNetworkInfo)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrNetworkInfo), 0, 
sizeof(tstrNetworkInfo));
 
pstrNetworkInfo->s8rssi = pu8WidVal[0];
@@ -862,6 +865,9 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
 
if (u16IEsLen > 0) {
pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
+   if (!pstrNetworkInfo->pu8IEs)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrNetworkInfo->pu8IEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
@@ -929,6 +935,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u16 u16IEsLen = 0;
 
pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
+   if (!pstrConnectRespInfo)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrConnectRespInfo), 0, 
sizeof(tstrConnectRespInfo));
 
/* u16AssocRespLen = pu8Buffer[0]; */
@@ -949,6 +958,9 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
+   if (!pstrConnectRespInfo->pu8RespIEs)
+   return -ENOMEM;
+
WILC_memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, 
u16IEsLen);
 
WILC_memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
-- 
1.9.1

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


Re: [PATCH V2 1/5] staging: wilc1000: #ifdef conditionals cover entire functions

2015-07-30 Thread Sudip Mukherjee
On Thu, Jul 30, 2015 at 06:10:10PM +0900, Tony Cho wrote:
> This patch lets preprocessor conditionals (#ifdef) related to
> WILC_SDIO_IRQ_GPIO to compile out the entire functions. Compiling out
> the entire functions is preferred rather than portions of functions or
> expressions becausue doing so makes code harder to read.
> 
> Signed-off-by: Tony Cho 
> ---

>  
> +#ifdef WILC_SDIO_IRQ_GPIO
>  static int sdio_clear_int(void)
>  {
> -#ifndef WILC_SDIO_IRQ_GPIO
> - /* uint32_t sts; */
> - sdio_cmd52_t cmd;
> -
> - cmd.read_write = 0;
> - cmd.function = 1;
> - cmd.raw = 0;
> - cmd.address = 0x4;
> - cmd.data = 0;
> - g_sdio.sdio_cmd52(&cmd);
> - int_clrd++;
> -
> - return cmd.data;
> -#else
>   uint32_t reg;
>  
>   if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {
> @@ -181,9 +168,23 @@ static int sdio_clear_int(void)
>   sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
>   int_clrd++;
>   return 1;
> -#endif
> +}
> +#else
> +static int sdio_clear_int(void)
> +{
> + sdio_cmd52_t cmd;
> +
> + cmd.read_write = 0;
> + cmd.function = 1;
> + cmd.raw = 0;
> + cmd.address = 0x4;
> + cmd.data = 0;
> + g_sdio.sdio_cmd52(&cmd);
> + int_clrd++;
>  
> + return cmd.data;
>  }
> +#endif /* WILC_SDIO_IRQ_GPIO */
instead of changing #ifndef to #ifdef i think the following would have
been easier:

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 5a18148..5cd4d45 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -155,9 +155,9 @@ _fail_:
return 0;
 }
 
+#ifndef WILC_SDIO_IRQ_GPIO
 static int sdio_clear_int(void)
 {
-#ifndef WILC_SDIO_IRQ_GPIO
/* uint32_t sts; */
sdio_cmd52_t cmd;
 
@@ -170,7 +170,10 @@ static int sdio_clear_int(void)
int_clrd++;
 
return cmd.data;
+}
 #else
+static int sdio_clear_int(void)
+{
uint32_t reg;
 
if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {
@@ -181,9 +184,8 @@ static int sdio_clear_int(void)
sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
int_clrd++;
return 1;
-#endif
-
 }
+#endif
 
 uint32_t sdio_xfer_cnt(void)
 {

>  
>  uint32_t sdio_xfer_cnt(void)

> +#ifdef WILC_SDIO_IRQ_GPIO
>  static int sdio_clear_int_ext(uint32_t val)
>  {
>   int ret;
>  
> - if (g_sdio.has_thrpt_enh3) {
> + if(g_sdio.has_thrpt_enh3) {
why changing this? The original style is according to the kernel coding
style.

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


Re: [RESEND V2 0/3] cover letter of wilc1000 patches

2015-07-30 Thread Chaehyun Lim
I'm sorry that I have mistake the number of kmalloc changes. The total
change is 6, not 4.

On Thu, Jul 30, 2015 at 8:41 PM, Chaehyun Lim  wrote:
> Hi, Greg
>
> I'm sorry that I did not say whether GFP_ATOMIC should be used or not.
> This is my review on it. If it's not correct, please give me any comment or 
> direction.
>
> First patch has 4 sites of kmalloc change in coreconfigurator.c
> First one, it is used for gps8ConfigPacket at CoreconfiguratorInit and 
> CoreConfiguratorDeInit.
> I think it should be removed next time because I cannot find anywhere to use 
> it.
> Then, it is okay to change flag as GFP_KERNEL.
>
> Other three changes are used to handle host interface message within a kernel 
> thread.
> The manipulation of host interface message is not called on IRQ context and I 
> could not
> find any spin lock inside function.
>
> If this patches are accepted, I will try to continue to change WILC_MALLOC 
> macro as kmalloc.
> I always appreciate your comment and advice.
>
> Thanks
> Chaehyun Lim
>
>
> Chaehyun Lim (3):
>   staging: wilc1000: coreconfigurator.c: remove WILC_MALLOC
>   staging: wilc1000: coreconfigurator.c: add kmalloc error check
>   staging: wilc1000: coreconfigurator.c: fix kmalloc error check
>
>  drivers/staging/wilc1000/coreconfigurator.c | 38 
> +
>  1 file changed, 23 insertions(+), 15 deletions(-)
>
> --
> 1.9.1
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2 3/5] staging: wilc1000: remove warnings on missing blank line

2015-07-30 Thread Sudip Mukherjee
On Thu, Jul 30, 2015 at 06:10:12PM +0900, Tony Cho wrote:
> This patch removes the warnings reported by checkpatch.pl on missing
> a blank line after declarations.
> 
> Signed-off-by: Tony Cho 
> ---
> V2: This patch doesn't have a difference with the first one. However,
> it's resent becasue not accepted with the 9th patch.
> ---
>  drivers/staging/wilc1000/wilc_sdio.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
> b/drivers/staging/wilc1000/wilc_sdio.c
> index ee1cbd1..50be2a1 100644
> --- a/drivers/staging/wilc1000/wilc_sdio.c
> +++ b/drivers/staging/wilc1000/wilc_sdio.c
> @@ -780,6 +780,7 @@ static int sdio_clear_int_ext(uint32_t val)
>  
>   if (g_sdio.has_thrpt_enh3) {
>   uint32_t reg;
> +
>   reg = val & ((1 << MAX_NUN_INT_THRPT_ENH2) - 1);
>  
>   /* select VMM table 0 */
This patch will not apply. After your first patch (1/5)
if (g_sdio.has_thrpt_enh3) has become if(g_sdio.has_thrpt_enh3).

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


Re: [RESEND V2 0/3] cover letter of wilc1000 patches

2015-07-30 Thread Dan Carpenter
On Thu, Jul 30, 2015 at 09:03:48PM +0900, Chaehyun Lim wrote:
> On Thu, Jul 30, 2015 at 8:41 PM, Chaehyun Lim  wrote:
> >
> > First patch has 4 sites of kmalloc change in coreconfigurator.c
> > First one, it is used for gps8ConfigPacket at CoreconfiguratorInit and 
> > CoreConfiguratorDeInit.
> > I think it should be removed next time because I cannot find anywhere to 
> > use it.
> > Then, it is okay to change flag as GFP_KERNEL.
> >
> > Other three changes are used to handle host interface message within a 
> > kernel thread.
> > The manipulation of host interface message is not called on IRQ context and 
> > I could not
> > find any spin lock inside function.
> >

This information is good information and it should be in the patch
description.

regards,
dan carpenter

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


[PATCH 3/3] Staging: most: replace min() by min_t()

2015-07-30 Thread Christian Gromm
This patch fixes wrong casting.

Reported-by: Dan Carpenter 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/mostcore/core.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index 49d03af..f872dc0 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -973,7 +973,7 @@ static ssize_t store_add_link(struct most_aim_obj *aim_obj,
char *mdev_devnod;
char devnod_buf[STRING_SIZE];
int ret;
-   unsigned int max_len = min((int)len + 1, STRING_SIZE);
+   size_t max_len = min_t(size_t, len + 1, STRING_SIZE);
 
strlcpy(buffer, buf, max_len);
strlcpy(aim_obj->add_link, buf, max_len);
@@ -1036,7 +1036,7 @@ static ssize_t store_remove_link(struct most_aim_obj 
*aim_obj,
char *mdev;
char *mdev_ch;
int ret;
-   unsigned int max_len = min((int)len + 1, STRING_SIZE);
+   size_t max_len = min_t(size_t, len + 1, STRING_SIZE);
 
strlcpy(buffer, buf, max_len);
strlcpy(aim_obj->remove_link, buf, max_len);
-- 
1.7.9.5

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


[PATCH 2/3] Staging: most: fix doing DMA on stack

2015-07-30 Thread Christian Gromm
This patch fixes error "doing DMA on the stack" by using kzalloc
for buffer allocation.

Reported-by: Dan Carpenter 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |   39 +---
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index a4a3e26..9db31a2 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -45,6 +45,7 @@
 #define USB_VENDOR_ID_SMSC 0x0424  /* VID: SMSC */
 #define USB_DEV_ID_BRDG0xC001  /* PID: USB Bridge */
 #define USB_DEV_ID_INIC0xCF18  /* PID: USB INIC */
+#define HW_RESYNC  0x
 /* DRCI Addresses */
 #define DRCI_REG_NI_STATE  0x0100
 #define DRCI_REG_PACKET_BW 0x0101
@@ -139,21 +140,33 @@ static void wq_netinfo(struct work_struct *wq_obj);
  * trigger_resync_vr - Vendor request to trigger HW re-sync mechanism
  * @dev: usb device
  *
+ * Since some architectures don't allow DMA to the stack, we use
+ * kzalloc for buffer allocation.
+ *
  */
-static inline void trigger_resync_vr(struct usb_device *dev)
+static void trigger_resync_vr(struct usb_device *dev)
 {
-   int data = 0;
-
-   if (0 > usb_control_msg(dev,
-   usb_sndctrlpipe(dev, 0),
-   0,
-   USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_ENDPOINT,
-   0,
-   0,
-   &data,
-   0,
-   5 * HZ))
-   pr_info("Vendor request \"stall\" failed\n");
+   int retval;
+   u8 request_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT;
+   int *data = kzalloc(sizeof(*data), GFP_KERNEL);
+
+   if (!data)
+   goto error;
+   *data = HW_RESYNC;
+   retval = usb_control_msg(dev,
+usb_sndctrlpipe(dev, 0),
+0,
+request_type,
+0,
+0,
+data,
+0,
+5 * HZ);
+   kfree(data);
+   if (retval >= 0)
+   return;
+error:
+   pr_info("Vendor request \"stall\" failed\n");
 }
 
 /**
-- 
1.7.9.5

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


[PATCH 1/3] Staging: most: fix double unlock

2015-07-30 Thread Christian Gromm
This patch fixes double unlocking of a spinlock the aim-v4l2 module.

Reported-by: Dan Carpenter 
Signed-off-by: Christian Gromm 
Signed-off-by: Andrey Shvetsov 
---
 drivers/staging/most/aim-v4l2/video.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index a977b88..d968791 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -619,6 +619,7 @@ static void __exit aim_exit(void)
aim_unregister_videodev(mdev);
v4l2_device_disconnect(&mdev->v4l2_dev);
v4l2_device_put(&mdev->v4l2_dev);
+   spin_lock(&list_lock);
}
spin_unlock(&list_lock);
 
-- 
1.7.9.5

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


Re: [PATCH v4 04/46] staging: emxx_udc: add ep capabilities support

2015-07-30 Thread Felipe Balbi
Hi,

On Thu, Jul 30, 2015 at 09:15:38AM +0200, Robert Baldyga wrote:
> On 07/29/2015 05:20 PM, Felipe Balbi wrote:
> > On Mon, Jul 27, 2015 at 11:16:14AM +0200, Robert Baldyga wrote:
> >> Convert endpoint configuration to new capabilities model.
> >>
> >> Fixed typo in "epc-nulk" to "epc-bulk".
> >>
> >> Signed-off-by: Robert Baldyga 
> >> ---
> >>  drivers/staging/emxx_udc/emxx_udc.c | 60 
> >> ++---
> >>  1 file changed, 29 insertions(+), 31 deletions(-)
> >>
> >> diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
> >> b/drivers/staging/emxx_udc/emxx_udc.c
> >> index 3b7aa36..0d64bee 100644
> >> --- a/drivers/staging/emxx_udc/emxx_udc.c
> >> +++ b/drivers/staging/emxx_udc/emxx_udc.c
> >> @@ -3153,36 +3153,33 @@ static const struct usb_gadget_ops 
> >> nbu2ss_gadget_ops = {
> >>.ioctl  = nbu2ss_gad_ioctl,
> >>  };
> >>  
> >> -static const char g_ep0_name[] = "ep0";
> >> -static const char g_ep1_name[] = "ep1-bulk";
> >> -static const char g_ep2_name[] = "ep2-bulk";
> >> -static const char g_ep3_name[] = "ep3in-int";
> >> -static const char g_ep4_name[] = "ep4-iso";
> >> -static const char g_ep5_name[] = "ep5-iso";
> >> -static const char g_ep6_name[] = "ep6-bulk";
> >> -static const char g_ep7_name[] = "ep7-bulk";
> >> -static const char g_ep8_name[] = "ep8in-int";
> >> -static const char g_ep9_name[] = "ep9-iso";
> >> -static const char g_epa_name[] = "epa-iso";
> >> -static const char g_epb_name[] = "epb-bulk";
> >> -static const char g_epc_name[] = "epc-nulk";
> >> -static const char g_epd_name[] = "epdin-int";
> >> -
> >> -static const char *gp_ep_name[NUM_ENDPOINTS] = {
> >> -  g_ep0_name,
> >> -  g_ep1_name,
> >> -  g_ep2_name,
> >> -  g_ep3_name,
> >> -  g_ep4_name,
> >> -  g_ep5_name,
> >> -  g_ep6_name,
> >> -  g_ep7_name,
> >> -  g_ep8_name,
> >> -  g_ep9_name,
> >> -  g_epa_name,
> >> -  g_epb_name,
> >> -  g_epc_name,
> >> -  g_epd_name,
> >> +static const struct {
> >> +  const char *name;
> >> +  const struct usb_ep_caps caps;
> >> +} ep_info[NUM_ENDPOINTS] = {
> >> +#define EP_INFO(_name, _type, _dir) \
> >> +  { \
> >> +  .name = _name, \
> >> +  .caps = USB_EP_CAPS(USB_EP_CAPS_TYPE_ ## _type, \
> >> +  USB_EP_CAPS_DIR_ ## _dir), \
> >> +  }
> >> +
> >> +  EP_INFO("ep0",  CONTROL, ALL),
> >> +  EP_INFO("ep1-bulk", BULK,   ALL),
> >> +  EP_INFO("ep2-bulk", BULK,   ALL),
> >> +  EP_INFO("ep3in-int",INT,IN),
> >> +  EP_INFO("ep4-iso",  INT,ALL),
> >> +  EP_INFO("ep5-iso",  ISO,ALL),
> >> +  EP_INFO("ep6-bulk", ISO,ALL),
> >> +  EP_INFO("ep7-bulk", BULK,   ALL),
> >> +  EP_INFO("ep8in-int",INT,IN),
> >> +  EP_INFO("ep9-iso",  ISO,ALL),
> >> +  EP_INFO("epa-iso",  ISO,ALL),
> >> +  EP_INFO("epb-bulk", BULK,   ALL),
> >> +  EP_INFO("epc-bulk", BULK,   ALL),
> >> +  EP_INFO("epdin-int",INT,IN),
> > 
> > IMO, this is pointless obfuscation. It just makes it a pain to grep
> > source around. Why don't you have UDC drivers initialize the 1-bit flags
> > directly ?
> > 
> 
> Do you mean something like this? It just makes it a pain to scroll this
> source ;)

but it's at least easy to grep. Another option would be the following:

EP_INFO("ep0", USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL,
USB_EP_CAPS_DIR_ALL)),

that also helps grepping.

-- 
balbi


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


Re: [PATCH 2/3] Staging: most: fix doing DMA on stack

2015-07-30 Thread Greg KH
On Thu, Jul 30, 2015 at 03:31:38PM +0200, Christian Gromm wrote:
> This patch fixes error "doing DMA on the stack" by using kzalloc
> for buffer allocation.
> 
> Reported-by: Dan Carpenter 
> Signed-off-by: Christian Gromm 
> ---
>  drivers/staging/most/hdm-usb/hdm_usb.c |   39 
> +---
>  1 file changed, 26 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
> b/drivers/staging/most/hdm-usb/hdm_usb.c
> index a4a3e26..9db31a2 100644
> --- a/drivers/staging/most/hdm-usb/hdm_usb.c
> +++ b/drivers/staging/most/hdm-usb/hdm_usb.c
> @@ -45,6 +45,7 @@
>  #define USB_VENDOR_ID_SMSC   0x0424  /* VID: SMSC */
>  #define USB_DEV_ID_BRDG  0xC001  /* PID: USB Bridge */
>  #define USB_DEV_ID_INIC  0xCF18  /* PID: USB INIC */
> +#define HW_RESYNC0x
>  /* DRCI Addresses */
>  #define DRCI_REG_NI_STATE0x0100
>  #define DRCI_REG_PACKET_BW   0x0101
> @@ -139,21 +140,33 @@ static void wq_netinfo(struct work_struct *wq_obj);
>   * trigger_resync_vr - Vendor request to trigger HW re-sync mechanism
>   * @dev: usb device
>   *
> + * Since some architectures don't allow DMA to the stack, we use
> + * kzalloc for buffer allocation.

No need to say this, it's a requirement for all USB drivers in Linux.

> + *
>   */
> -static inline void trigger_resync_vr(struct usb_device *dev)
> +static void trigger_resync_vr(struct usb_device *dev)
>  {
> - int data = 0;
> -
> - if (0 > usb_control_msg(dev,
> - usb_sndctrlpipe(dev, 0),
> - 0,
> - USB_DIR_OUT | USB_TYPE_VENDOR | 
> USB_RECIP_ENDPOINT,
> - 0,
> - 0,
> - &data,
> - 0,
> - 5 * HZ))
> - pr_info("Vendor request \"stall\" failed\n");
> + int retval;
> + u8 request_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT;
> + int *data = kzalloc(sizeof(*data), GFP_KERNEL);
> +
> + if (!data)
> + goto error;
> + *data = HW_RESYNC;
> + retval = usb_control_msg(dev,
> +  usb_sndctrlpipe(dev, 0),
> +  0,
> +  request_type,
> +  0,
> +  0,
> +  data,
> +  0,
> +  5 * HZ);
> + kfree(data);
> + if (retval >= 0)
> + return;
> +error:
> + pr_info("Vendor request \"stall\" failed\n");

You have a device, so use 'dev_*' instead of pr_*.  And as this is an
error, use the *_err() version, so this should be a dev_err() call, not
pr_info().

thanks,

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


Re: [RFC PATCH] staging: rtl8192e: Rework EEPROM handling code

2015-07-30 Thread Greg KH
On Thu, Jul 30, 2015 at 11:41:46AM +0300, Dan Carpenter wrote:
> On Thu, Jul 30, 2015 at 10:31:04AM +0200, Mateusz Kulikowski wrote:
> > As for other comments - could you take look at "Notes" from patch?
> > This was one of main concerns for me - Wouldn't it be better 
> > if I rewrite that code to use GPIO/SPI/EEPROM subsystems?
> 
> I don't know.  Let's just merge this as a clean up since you've already
> done it and not do the other unless you really feel like it or the
> linux-wireless people ask for it.

That would require it to be resent, I don't apply "RFC" patches :)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [RFC PATCH] staging: rtl8192e: Rework EEPROM handling code

2015-07-30 Thread Mateusz Kulikowski
On Thu, Jul 30, 2015 at 07:40:14AM -0700, Greg KH wrote:
> On Thu, Jul 30, 2015 at 11:41:46AM +0300, Dan Carpenter wrote:
> > On Thu, Jul 30, 2015 at 10:31:04AM +0200, Mateusz Kulikowski wrote:
> > > As for other comments - could you take look at "Notes" from patch?
> > > This was one of main concerns for me - Wouldn't it be better 
> > > if I rewrite that code to use GPIO/SPI/EEPROM subsystems?
> > 
> > I don't know.  Let's just merge this as a clean up since you've already
> > done it and not do the other unless you really feel like it or the
> > linux-wireless people ask for it.
> 
> That would require it to be resent, I don't apply "RFC" patches :)

It will be resent soon - function names proposed by Dan are better.

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


Re: [PATCH] improve lmk to avoid deadlock issue

2015-07-30 Thread Joe Perches
On Thu, 2015-07-30 at 13:09 +0300, Dan Carpenter wrote:
> > diff --git a/drivers/staging/android/lowmemorykiller.c 
> > b/drivers/staging/android/lowmemorykiller.c
[]
> > @@ -127,11 +127,15 @@ static unsigned long lowmem_scan(struct shrinker *s, 
> > struct shrink_control *sc)
> > if (!p)
> > continue;
> >  
> > -   if (test_tsk_thread_flag(p, TIF_MEMDIE) &&
> > -   time_before_eq(jiffies, lowmem_deathpending_timeout)) {
> > -   task_unlock(p);
> > -   rcu_read_unlock();
> > -   return 0;
> > +   if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
> > +   if (time_before_eq(jiffies, 
> > lowmem_deathpending_timeout)) {
> 
> 5) This goes over the 80 character limit.  Could you break it up like
> this:
> 
>   if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
>   if (time_before_eq(jiffies,
>  lowmem_deathpending_timeout)) {
>   task_unlock(p);
> 
> Anyway, thank for this patch.  Please fix these small process issues
> and resend.

Can the task_unlock in each branch be hoisted?

Another way to write this might be to use time_after:

if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
task_unlock(p);
if (time_after(jiffies, lowmem_deathpending_timeout))
continue;
rcu_read_unlock();
return 0;
}


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


[PATCH v2] Staging: most: fix doing DMA on stack

2015-07-30 Thread Christian Gromm
This patch fixes error "doing DMA on the stack" by using kzalloc
for buffer allocation.

Reported-by: Dan Carpenter 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |   36 
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index a4a3e26..feb4c82 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -45,6 +45,7 @@
 #define USB_VENDOR_ID_SMSC 0x0424  /* VID: SMSC */
 #define USB_DEV_ID_BRDG0xC001  /* PID: USB Bridge */
 #define USB_DEV_ID_INIC0xCF18  /* PID: USB INIC */
+#define HW_RESYNC  0x
 /* DRCI Addresses */
 #define DRCI_REG_NI_STATE  0x0100
 #define DRCI_REG_PACKET_BW 0x0101
@@ -140,20 +141,29 @@ static void wq_netinfo(struct work_struct *wq_obj);
  * @dev: usb device
  *
  */
-static inline void trigger_resync_vr(struct usb_device *dev)
+static void trigger_resync_vr(struct usb_device *dev)
 {
-   int data = 0;
-
-   if (0 > usb_control_msg(dev,
-   usb_sndctrlpipe(dev, 0),
-   0,
-   USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_ENDPOINT,
-   0,
-   0,
-   &data,
-   0,
-   5 * HZ))
-   pr_info("Vendor request \"stall\" failed\n");
+   int retval;
+   u8 request_type = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT;
+   int *data = kzalloc(sizeof(*data), GFP_KERNEL);
+
+   if (!data)
+   goto error;
+   *data = HW_RESYNC;
+   retval = usb_control_msg(dev,
+usb_sndctrlpipe(dev, 0),
+0,
+request_type,
+0,
+0,
+data,
+0,
+5 * HZ);
+   kfree(data);
+   if (retval >= 0)
+   return;
+error:
+   pr_info("Vendor request \"stall\" failed\n");
 }
 
 /**
-- 
1.7.9.5

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


[PATCH] Staging: most: replace pr_*() functions by dev_*()

2015-07-30 Thread Christian Gromm
This patch replaces pr_*() functions with dev_*().

Reported-by: Greg Kroah-Hartman 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |  116 
 1 file changed, 59 insertions(+), 57 deletions(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index feb4c82..514ce35 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -163,7 +163,7 @@ static void trigger_resync_vr(struct usb_device *dev)
if (retval >= 0)
return;
 error:
-   pr_info("Vendor request \"stall\" failed\n");
+   dev_err(&dev->dev, "Vendor request \"stall\" failed\n");
 }
 
 /**
@@ -256,7 +256,7 @@ static unsigned int get_stream_frame_size(struct 
most_channel_config *cfg)
unsigned int sub_size = cfg->subbuffer_size;
 
if (!sub_size) {
-   pr_info("Misconfig: Subbuffer size zero.\n");
+   pr_warn("Misconfig: Subbuffer size zero.\n");
return frame_size;
}
switch (cfg->data_type) {
@@ -265,7 +265,7 @@ static unsigned int get_stream_frame_size(struct 
most_channel_config *cfg)
break;
case MOST_CH_SYNC:
if (cfg->packets_per_xact == 0) {
-   pr_info("Misconfig: Packets per XACT zero\n");
+   pr_warn("Misconfig: Packets per XACT zero\n");
frame_size = 0;
} else if (cfg->packets_per_xact == 0xFF)
frame_size = (USB_MTU / sub_size) * sub_size;
@@ -294,16 +294,16 @@ int hdm_poison_channel(struct most_interface *iface, int 
channel)
 {
struct most_dev *mdev;
 
+   mdev = to_mdev(iface);
if (unlikely(!iface)) {
-   pr_info("Poison: Bad interface.\n");
+   dev_warn(&mdev->usb_device->dev, "Poison: Bad interface.\n");
return -EIO;
}
if (unlikely((channel < 0) || (channel >= iface->num_channels))) {
-   pr_info("Channel ID out of range.\n");
+   dev_warn(&mdev->usb_device->dev, "Channel ID out of range.\n");
return -ECHRNG;
}
 
-   mdev = to_mdev(iface);
mdev->is_channel_healthy[channel] = false;
 
mutex_lock(&mdev->io_mutex);
@@ -340,7 +340,8 @@ int hdm_add_padding(struct most_dev *mdev, int channel, 
struct mbo *mbo)
num_frames = mbo->buffer_length / frame_size;
 
if (num_frames < 1) {
-   pr_err("Missed minimal transfer unit.\n");
+   dev_err(&mdev->usb_device->dev,
+   "Missed minimal transfer unit.\n");
return -EIO;
}
 
@@ -399,6 +400,7 @@ static void hdm_write_completion(struct urb *urb)
struct mbo *mbo;
struct buf_anchor *anchor;
struct most_dev *mdev;
+   struct device *dev;
unsigned int channel;
unsigned long flags;
 
@@ -406,6 +408,7 @@ static void hdm_write_completion(struct urb *urb)
anchor = mbo->priv;
mdev = to_mdev(mbo->ifp);
channel = mbo->hdm_channel_id;
+   dev = &mdev->usb_device->dev;
 
if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) ||
(mdev->is_channel_healthy[channel] == false)) {
@@ -419,7 +422,7 @@ static void hdm_write_completion(struct urb *urb)
mbo->processed_length = 0;
switch (urb->status) {
case -EPIPE:
-   pr_info("Broken OUT pipe detected\n");
+   dev_warn(dev, "Broken OUT pipe detected\n");
most_stop_enqueue(&mdev->iface, channel);
mbo->status = MBO_E_INVAL;
usb_unlink_urb(urb);
@@ -562,6 +565,7 @@ static void hdm_read_completion(struct urb *urb)
struct mbo *mbo;
struct buf_anchor *anchor;
struct most_dev *mdev;
+   struct device *dev;
unsigned long flags;
unsigned int channel;
struct most_channel_config *conf;
@@ -570,6 +574,7 @@ static void hdm_read_completion(struct urb *urb)
anchor = mbo->priv;
mdev = to_mdev(mbo->ifp);
channel = mbo->hdm_channel_id;
+   dev = &mdev->usb_device->dev;
 
if ((urb->status == -ENOENT) || (urb->status == -ECONNRESET) ||
(mdev->is_channel_healthy[channel] == false)) {
@@ -585,7 +590,7 @@ static void hdm_read_completion(struct urb *urb)
mbo->processed_length = 0;
switch (urb->status) {
case -EPIPE:
-   pr_info("Broken IN pipe detected\n");
+   dev_warn(dev, "Broken IN pipe detected\n");
mbo->status = MBO_E_INVAL;
usb_unlink_urb(urb);
INIT_WORK(&anchor->clear_work_obj, wq_clear_halt);
@@ -596,7 +601,7 @@ static void hdm_read_completion(struct urb *urb)
 

[PATCH] staging: fbtft: core: Don't set device platform_data

2015-07-30 Thread Noralf Trønnes
Pass platform_data as an argument to fbtft_framebuffer_alloc()
instead of using dev->platform_data.

This fixes an issue where the device comes from Device Tree
and fbtft_probe_common() sets dev->platform_data to allocated
memory. When the module is reloaded, dev->platform_data points
to freed memory.

Signed-off-by: Noralf Trønnes 
---
 drivers/staging/fbtft/fbtft-core.c | 12 +---
 drivers/staging/fbtft/fbtft.h  |  5 +++--
 drivers/staging/fbtft/flexfb.c |  2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index f04128f..23392eb 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -677,13 +677,13 @@ static void fbtft_merge_fbtftops(struct fbtft_ops *dst, 
struct fbtft_ops *src)
  *
  */
 struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
-   struct device *dev)
+   struct device *dev,
+   struct fbtft_platform_data *pdata)
 {
struct fb_info *info;
struct fbtft_par *par;
struct fb_ops *fbops = NULL;
struct fb_deferred_io *fbdefio = NULL;
-   struct fbtft_platform_data *pdata = dev->platform_data;
u8 *vmem = NULL;
void *txbuf = NULL;
void *buf = NULL;
@@ -828,7 +828,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct 
fbtft_display *display,
 
par = info->par;
par->info = info;
-   par->pdata = dev->platform_data;
+   par->pdata = pdata;
par->debug = display->debug;
par->buf = buf;
spin_lock_init(&par->dirty_lock);
@@ -1265,12 +1265,11 @@ EXPORT_SYMBOL(fbtft_init_display);
  */
 static int fbtft_verify_gpios(struct fbtft_par *par)
 {
-   struct fbtft_platform_data *pdata;
+   struct fbtft_platform_data *pdata = par->pdata;
int i;
 
fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__);
 
-   pdata = par->info->device->platform_data;
if (pdata->display.buswidth != 9 && par->startbyte == 0 &&
par->gpio.dc < 0) {
dev_err(par->info->device,
@@ -1388,10 +1387,9 @@ int fbtft_probe_common(struct fbtft_display *display,
pdata = fbtft_probe_dt(dev);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
-   dev->platform_data = pdata;
}
 
-   info = fbtft_framebuffer_alloc(display, dev);
+   info = fbtft_framebuffer_alloc(display, dev, pdata);
if (!info)
return -ENOMEM;
 
diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 7d817eb..ab4a658 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -264,8 +264,9 @@ struct fbtft_par {
 /* fbtft-core.c */
 extern void fbtft_dbg_hex(const struct device *dev,
int groupsize, void *buf, size_t len, const char *fmt, ...);
-extern struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
-   struct device *dev);
+struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
+   struct device *dev,
+   struct fbtft_platform_data *pdata);
 extern void fbtft_framebuffer_release(struct fb_info *info);
 extern int fbtft_register_framebuffer(struct fb_info *fb_info);
 extern int fbtft_unregister_framebuffer(struct fb_info *fb_info);
diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index ce6e3ae..5b4c712 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -379,7 +379,7 @@ static int flexfb_probe_common(struct spi_device *sdev,
fbtft_init_dbg(dev, "regwidth = %d\n", regwidth);
fbtft_init_dbg(dev, "buswidth = %d\n", buswidth);
 
-   info = fbtft_framebuffer_alloc(&flex_display, dev);
+   info = fbtft_framebuffer_alloc(&flex_display, dev, dev->platform_data);
if (!info)
return -ENOMEM;
 
-- 
2.2.2

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


[PATCH 0/1] staging: rtl8192e: Rework EEPROM handling code

2015-07-30 Thread Mateusz Kulikowski
This patch is fixed version of RFC patch with the same subject:
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2015-July/073860.html

Changes:
- Functions *gpio_set and *gpio_get changed as suggested by Dan
- Changed commit msg
Changes that were NOT made:
- I kept _rtl92e_ prefix for static functions like in other rtlwifi devices

Patch was target tested and should apply cleanly to 
current staging-next (6e64e224).

Mateusz Kulikowski (1):
  staging: rtl8192e: Rework EEPROM handling code

 drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h  |   8 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c | 120 -
 2 files changed, 43 insertions(+), 85 deletions(-)

-- 
1.8.4.1

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


[PATCH 1/1] staging: rtl8192e: Rework EEPROM handling code

2015-07-30 Thread Mateusz Kulikowski
Card configuration is stored in SPI EEPROM (93c46 or 93c56)
working in 128|256x16 mode.
Communication is handled using GPIO bitbang.

>From behaviour perspective, delay after read was removed.
It is not needed as we wait after reading GPIO mapped to
PCI-E register - it should have no side effects.

According to sample EEPROM datasheet (AT93Cx6), max frequency for
worst case scenario (1.8V supply) is 250kHZ (vs. 1MHz for 5V).
Driver generates ~50kHZ clock - margin should be big enough
even for devices from other vendors.

Signed-off-by: Mateusz Kulikowski 
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h  |   8 +-
 drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c | 120 -
 2 files changed, 43 insertions(+), 85 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h 
b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h
index 43c3fb8..c81832d 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h
@@ -119,10 +119,10 @@ enum _RTL8192Pci_HW {
 #define EPROM_CMD_NORMAL 0
 #define EPROM_CMD_LOAD 1
 #define EPROM_CMD_PROGRAM 2
-#define EPROM_CS_SHIFT 3
-#define EPROM_CK_SHIFT 2
-#define EPROM_W_SHIFT 1
-#define EPROM_R_SHIFT 0
+#define EPROM_CS_BIT 3
+#define EPROM_CK_BIT 2
+#define EPROM_W_BIT 1
+#define EPROM_R_BIT 0
 
AFR  = 0x010,
 #define AFR_CardBEn(1<<0)
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c 
b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c
index ed54193..039ccfd 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c
@@ -25,115 +25,73 @@
 #include "rtl_core.h"
 #include "rtl_eeprom.h"
 
-static void eprom_cs(struct net_device *dev, short bit)
+static void _rtl92e_gpio_write_bit(struct net_device *dev, int no, bool val)
 {
-   if (bit)
-   rtl92e_writeb(dev, EPROM_CMD,
- (1 << EPROM_CS_SHIFT) |
- rtl92e_readb(dev, EPROM_CMD));
+   u8 reg = rtl92e_readb(dev, EPROM_CMD);
+
+   if (val)
+   reg |= 1 << no;
else
-   rtl92e_writeb(dev, EPROM_CMD,
- rtl92e_readb(dev, EPROM_CMD) &
- ~(1<> no) & 0x1;
+}
 
-static void eprom_w(struct net_device *dev, short bit)
+static void _rtl92e_eeprom_ck_cycle(struct net_device *dev)
 {
-   if (bit)
-   rtl92e_writeb(dev, EPROM_CMD, (1<> tx_len) & 0x1);
+   _rtl92e_eeprom_ck_cycle(dev);
+   }
 
-static void eprom_send_bits_string(struct net_device *dev, short b[], int len)
-{
-   int i;
+   _rtl92e_gpio_write_bit(dev, EPROM_W_BIT, 0);
 
-   for (i = 0; i < len; i++) {
-   eprom_w(dev, b[i]);
-   eprom_ck_cycle(dev);
+   while (rx_len--) {
+   _rtl92e_eeprom_ck_cycle(dev);
+   ret |= _rtl92e_gpio_get_bit(dev, EPROM_R_BIT) << rx_len;
}
+
+   _rtl92e_gpio_write_bit(dev, EPROM_CS_BIT, 0);
+   _rtl92e_eeprom_ck_cycle(dev);
+
+   return ret;
 }
 
 u32 rtl92e_eeprom_read(struct net_device *dev, u32 addr)
 {
struct r8192_priv *priv = rtllib_priv(dev);
-   short read_cmd[] = {1, 1, 0};
-   short addr_str[8];
-   int i;
-   int addr_len;
-   u32 ret;
+   u32 ret = 0;
 
-   ret = 0;
rtl92e_writeb(dev, EPROM_CMD,
  (EPROM_CMD_PROGRAM << EPROM_CMD_OPERATING_MODE_SHIFT));
udelay(EPROM_DELAY);
 
-   if (priv->epromtype == EEPROM_93C56) {
-   addr_str[7] = addr & 1;
-   addr_str[6] = addr & (1<<1);
-   addr_str[5] = addr & (1<<2);
-   addr_str[4] = addr & (1<<3);
-   addr_str[3] = addr & (1<<4);
-   addr_str[2] = addr & (1<<5);
-   addr_str[1] = addr & (1<<6);
-   addr_str[0] = addr & (1<<7);
-   addr_len = 8;
-   } else {
-   addr_str[5] = addr & 1;
-   addr_str[4] = addr & (1<<1);
-   addr_str[3] = addr & (1<<2);
-   addr_str[2] = addr & (1<<3);
-   addr_str[1] = addr & (1<<4);
-   addr_str[0] = addr & (1<<5);
-   addr_len = 6;
-   }
-   eprom_cs(dev, 1);
-   eprom_ck_cycle(dev);
-   eprom_send_bits_string(dev, read_cmd, 3);
-   eprom_send_bits_string(dev, addr_str, addr_len);
-
-   eprom_w(dev, 0);
-
-   for (i = 0; i < 16; i++) {
-   eprom_ck_cycle(dev);
-   ret |= (eprom_r(dev)<<(15-i));
-   }
-
-   eprom_cs(dev, 0);
-   eprom_ck_cycle(dev);
+   /* EEPROM is configured as x16 */
+   if (priv->epromtype == EEPROM_93C56)
+   ret = _rtl92e_eeprom_xfer(dev, (addr & 0xFF) | (0x6 << 8), 11);
+   else
+   ret = _rtl92e_eeprom_xfer(dev, (addr & 0x3F) | (0x6 << 6), 9);
 
rtl92e_writeb(dev, EPROM_CMD,
  (EPROM_CMD_NORMAL

[PATCH 04/13] staging/lustre: Drop SLAB_DESTROY_BY_RCU redefine, it's always defined

2015-07-30 Thread green
From: Oleg Drokin 

SLAB_DESTROY_BY_RCU is always defined in kernel slab.h, so
no point in checking for it.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 1a6b2fb..38eda23 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,12 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-#ifndef SLAB_DESTROY_BY_RCU
-#define SLAB_DESTROY_BY_RCU 0
-#endif
-
-
-
 static inline int
 ll_quota_on(struct super_block *sb, int off, int ver, char *name, int remount)
 {
-- 
2.1.0

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


[PATCH 03/13] staging/lustre: Drop FS_HAS_FIEMAP compat macro

2015-07-30 Thread green
From: Oleg Drokin 

FS_HAS_FIEMAP was some sort of old RHEL5 construct that's not
really important anymore

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 5 -
 drivers/staging/lustre/lustre/obdclass/obd_mount.c| 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index e7d57e8..1a6b2fb 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,11 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-
-#ifndef FS_HAS_FIEMAP
-#define FS_HAS_FIEMAP  (0)
-#endif
-
 #ifndef SLAB_DESTROY_BY_RCU
 #define SLAB_DESTROY_BY_RCU 0
 #endif
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c 
b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 3e0b8a4..40ab7b2 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -1281,7 +1281,7 @@ struct file_system_type lustre_fs_type = {
.mount  = lustre_mount,
.kill_sb  = lustre_kill_super,
.fs_flags = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV |
-   FS_HAS_FIEMAP | FS_RENAME_DOES_D_MOVE,
+   FS_RENAME_DOES_D_MOVE,
 };
 MODULE_ALIAS_FS("lustre");
 
-- 
2.1.0

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


[PATCH 01/13] staging/lustre: Remove unused ll_vfs_* compat defines

2015-07-30 Thread green
From: Oleg Drokin 

Lustre defines quite a bit of those compatibility defines
duplicating kernel vfs api, but they are not actually used
in the client so remove them all and also ll_dirty_inode,
ll_security_inode_unlink and cfs_path_put

Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/linux/lustre_compat25.h  | 25 --
 1 file changed, 25 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 513c81f..622bc93 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -74,22 +74,9 @@
 #define FS_HAS_FIEMAP  (0)
 #endif
 
-#define ll_vfs_rmdir(dir, entry, mnt)   vfs_rmdir(dir, entry)
-#define ll_vfs_mkdir(inode, dir, mnt, mode)vfs_mkdir(inode, dir, mode)
-#define ll_vfs_link(old, mnt, dir, new, mnt1)   vfs_link(old, dir, new)
-#define ll_vfs_unlink(inode, entry, mnt) vfs_unlink(inode, entry)
-#define ll_vfs_mknod(dir, entry, mnt, mode, dev) \
-vfs_mknod(dir, entry, mode, dev)
-#define ll_security_inode_unlink(dir, entry, mnt) \
-security_inode_unlink(dir, entry)
-#define ll_vfs_rename(old, old_dir, mnt, new, new_dir, mnt1) \
-   vfs_rename(old, old_dir, new, new_dir, NULL, 0)
-
 #define cfs_bio_io_error(a, b)   bio_io_error((a))
 #define cfs_bio_endio(a, b, c)bio_endio((a), (c))
 
-#define cfs_path_put(nd) path_put(&(nd)->path)
-
 
 #ifndef SLAB_DESTROY_BY_RCU
 #define SLAB_DESTROY_BY_RCU 0
@@ -127,14 +114,6 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
 }
 
 
-# define ll_vfs_dq_init dquot_initialize
-# define ll_vfs_dq_drop dquot_drop
-# define ll_vfs_dq_transfer dquot_transfer
-# define ll_vfs_dq_off(sb, remount) dquot_suspend(sb, -1)
-
-
-
-
 
 #define queue_max_phys_segments(rq)   queue_max_segments(rq)
 #define queue_max_hw_segments(rq)   queue_max_segments(rq)
@@ -194,8 +173,4 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
 
 # define ll_umode_tumode_t
 
-#include 
-
-# define ll_dirty_inode(inode, flag)   
(inode)->i_sb->s_op->dirty_inode((inode), flag)
-
 #endif /* _COMPAT25_H */
-- 
2.1.0

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


[PATCH 05/13] staging/lustre: remove *hw_segments compat defines

2015-07-30 Thread green
From: Oleg Drokin 

queue_max_phys_segments, queue_max_hw_segments and bio_hw_segments
are not used anywhere in the client code, so remove them

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 38eda23..d0e8f3c 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -100,10 +100,6 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
 
 
 
-#define queue_max_phys_segments(rq)   queue_max_segments(rq)
-#define queue_max_hw_segments(rq)   queue_max_segments(rq)
-
-
 #define ll_d_hlist_node hlist_node
 #define ll_d_hlist_empty(list) hlist_empty(list)
 #define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name)
@@ -112,8 +108,6 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
p = NULL; hlist_for_each_entry(dentry, i_dentry, alias)
 
 
-#define bio_hw_segments(q, bio) 0
-
 
 #define ll_pagevec_init(pv, cold)   do {} while (0)
 #define ll_pagevec_add(pv, pg)   (0)
-- 
2.1.0

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


[PATCH 13/13] staging/lustre: use ATTR_OPEN directly, remove ATTR_RAW

2015-07-30 Thread green
From: Oleg Drokin 

ATTR_RAW is unused.
No point in redefining ATTR_OPEN as ATTR_FROM_OPEN

Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/linux/lustre_patchless_compat.h| 12 
 drivers/staging/lustre/lustre/mdc/mdc_lib.c  |  2 +-
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git 
a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h
index 1456278..ebe8d68 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_patchless_compat.h
@@ -60,18 +60,6 @@ truncate_complete_page(struct address_space *mapping, struct 
page *page)
ll_delete_from_page_cache(page);
 }
 
-#ifdef ATTR_OPEN
-# define ATTR_FROM_OPEN ATTR_OPEN
-#else
-# ifndef ATTR_FROM_OPEN
-#  define ATTR_FROM_OPEN 0
-# endif
-#endif /* ATTR_OPEN */
-
-#ifndef ATTR_RAW
-#define ATTR_RAW 0
-#endif
-
 #ifndef ATTR_CTIME_SET
 /*
  * set ATTR_CTIME_SET to a high value to avoid any risk of collision with other
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c 
b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index d3234cb..1a850ea 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -286,7 +286,7 @@ static inline __u64 attr_pack(unsigned int ia_valid)
sa_valid |= MDS_ATTR_KILL_SGID;
if (ia_valid & ATTR_CTIME_SET)
sa_valid |= MDS_ATTR_CTIME_SET;
-   if (ia_valid & ATTR_FROM_OPEN)
+   if (ia_valid & ATTR_OPEN)
sa_valid |= MDS_ATTR_FROM_OPEN;
if (ia_valid & ATTR_BLOCKS)
sa_valid |= MDS_ATTR_BLOCKS;
-- 
2.1.0

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


[PATCH 08/13] staging/lustre: replace ll_umode_t with umode_t

2015-07-30 Thread green
From: Oleg Drokin 

umode_t is what we need anyway, so replace all users
and drop the define.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 6 --
 drivers/staging/lustre/lustre/llite/namei.c   | 2 +-
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 754f63f..65493b3 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -104,10 +104,4 @@
 # define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET)
 #endif
 
-
-#include 
-#include 
-
-# define ll_umode_tumode_t
-
 #endif /* _COMPAT25_H */
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 72ce6e7..2ed1e0a 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -1008,7 +1008,7 @@ static int ll_unlink(struct inode *dir, struct dentry 
*dentry)
return rc;
 }
 
-static int ll_mkdir(struct inode *dir, struct dentry *dentry, ll_umode_t mode)
+static int ll_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
int err;
 
-- 
2.1.0

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


[PATCH 00/13] Removal of lustre compat macros

2015-07-30 Thread green
From: Oleg Drokin 

This patchset is a stroll through lustre/include/linux/lustre_compat25.h
that houses a bunch of our "compatibility with old/new kernels"
code and gettign rid of everything that we know for granted is available
because we are part of the tree.

These are the low hanging fruit, the rest are somewhat more tricky and
would need some more research.

a different cfs_bio_* compat removal patch was sent to the linux-block
tree since they changed the prototype, so if there's a conflict with that,
please pick their version.

Oleg Drokin (13):
  staging/lustre: Remove unused ll_vfs_* compat defines
  staging/lustre: get rid of cfs_bio_* compat macroses
  staging/lustre: Drop FS_HAS_FIEMAP compat macro
  staging/lustre: Drop SLAB_DESTROY_BY_RCU redefine, it's always defined
  staging/lustre: remove *hw_segments compat defines
  staging/lustre: Drop SEEK_* definition checks
  staging/lustre: Drop FMODE_UNSIGNED_OFFSET define
  staging/lustre: replace ll_umode_t with umode_t
  staging/lustre: Use hlist primitives directly
  staging/lustre: Get rid of ll_pagevec_ macros
  staging/lustre: ATTR_TIMES_SET is always defined, so don't check it
  staging/lustre: Get rid of inode_dio_write_done and inode_dio_read
  staging/lustre: use ATTR_OPEN directly, remove ATTR_RAW

 .../lustre/lustre/include/linux/lustre_compat25.h  | 119 -
 .../lustre/include/linux/lustre_patchless_compat.h |  12 ---
 drivers/staging/lustre/lustre/llite/dcache.c   |   3 +-
 drivers/staging/lustre/lustre/llite/dir.c  |   4 -
 drivers/staging/lustre/lustre/llite/llite_lib.c|   7 +-
 drivers/staging/lustre/lustre/llite/lloop.c|   4 +-
 drivers/staging/lustre/lustre/llite/namei.c|  12 +--
 drivers/staging/lustre/lustre/llite/vvp_io.c   |   5 +-
 drivers/staging/lustre/lustre/mdc/mdc_lib.c|   2 +-
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |   2 +-
 10 files changed, 15 insertions(+), 155 deletions(-)

-- 
2.1.0

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


[PATCH 10/13] staging/lustre: Get rid of ll_pagevec_ macros

2015-07-30 Thread green
From: Oleg Drokin 

They are noop anyways.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 5 -
 drivers/staging/lustre/lustre/llite/dir.c | 4 
 2 files changed, 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index bc4f752..ffcbc78 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,11 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-#define ll_pagevec_init(pv, cold)   do {} while (0)
-#define ll_pagevec_add(pv, pg)   (0)
-#define ll_pagevec_lru_add_file(pv) do {} while (0)
-
-
 #ifndef QUOTA_OK
 # define QUOTA_OK 0
 #endif
diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 3d746a9..769b611 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -203,7 +203,6 @@ static int ll_dir_filler(void *_hash, struct page *page0)
 
CDEBUG(D_VFSTRACE, "read %d/%d pages\n", nrdpgs, npages);
 
-   ll_pagevec_init(&lru_pvec, 0);
for (i = 1; i < npages; i++) {
unsigned long offset;
int ret;
@@ -228,15 +227,12 @@ static int ll_dir_filler(void *_hash, struct page *page0)
GFP_KERNEL);
if (ret == 0) {
unlock_page(page);
-   if (ll_pagevec_add(&lru_pvec, page) == 0)
-   ll_pagevec_lru_add_file(&lru_pvec);
} else {
CDEBUG(D_VFSTRACE, "page %lu add to page cache failed: 
%d\n",
   offset, ret);
}
page_cache_release(page);
}
-   ll_pagevec_lru_add_file(&lru_pvec);
 
if (page_pool != &page0)
kfree(page_pool);
-- 
2.1.0

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


[PATCH 12/13] staging/lustre: Get rid of inode_dio_write_done and inode_dio_read

2015-07-30 Thread green
From: Oleg Drokin 

These primitives are long deprecated and unused.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 5 -
 drivers/staging/lustre/lustre/llite/llite_lib.c   | 5 +
 drivers/staging/lustre/lustre/llite/vvp_io.c  | 5 ++---
 3 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 157bafb..6b14406 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -64,11 +64,6 @@
 
 #define LTIME_S(time) (time.tv_sec)
 
-/* inode_dio_wait(i) use as-is for write lock */
-# define inode_dio_write_done(i)   do {} while (0) /* for write unlock */
-# define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
-/* inode_dio_done(i) use as-is for read unlock */
-
 #ifndef QUOTA_OK
 # define QUOTA_OK 0
 #endif
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 39f0b2a..55e2dc6 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1356,11 +1356,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr 
*attr, bool hsm_import)
if (!op_data)
return -ENOMEM;
 
-   if (!S_ISDIR(inode->i_mode)) {
-   if (attr->ia_valid & ATTR_SIZE)
-   inode_dio_write_done(inode);
+   if (!S_ISDIR(inode->i_mode))
mutex_unlock(&inode->i_mutex);
-   }
 
memcpy(&op_data->op_attr, attr, sizeof(*attr));
 
diff --git a/drivers/staging/lustre/lustre/llite/vvp_io.c 
b/drivers/staging/lustre/lustre/llite/vvp_io.c
index 91bba79..a659962 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_io.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_io.c
@@ -455,12 +455,11 @@ static void vvp_io_setattr_end(const struct lu_env *env,
struct cl_io *io= ios->cis_io;
struct inode *inode = ccc_object_inode(io->ci_obj);
 
-   if (cl_io_is_trunc(io)) {
+   if (cl_io_is_trunc(io))
/* Truncate in memory pages - they must be clean pages
 * because osc has already notified to destroy osc_extents. */
vvp_do_vmtruncate(inode, io->u.ci_setattr.sa_attr.lvb_size);
-   inode_dio_write_done(inode);
-   }
+
mutex_unlock(&inode->i_mutex);
 }
 
-- 
2.1.0

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


[PATCH 07/13] staging/lustre: Drop FMODE_UNSIGNED_OFFSET define

2015-07-30 Thread green
From: Oleg Drokin 

It's not really used anywhere.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 7d90999..754f63f 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -90,10 +90,6 @@
 # define NO_QUOTA (-EDQUOT)
 #endif
 
-#ifndef FMODE_UNSIGNED_OFFSET
-#define FMODE_UNSIGNED_OFFSET  ((__force fmode_t)0x2000)
-#endif
-
 #if !defined(_ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_) && !defined(ext2_set_bit)
 # define ext2_set_bit   __test_and_set_bit_le
 # define ext2_clear_bit   __test_and_clear_bit_le
-- 
2.1.0

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


[PATCH 11/13] staging/lustre: ATTR_TIMES_SET is always defined, so don't check it

2015-07-30 Thread green
From: Oleg Drokin 

Remove ATTR_TIMES_SET check as it's always present, move
the mask of times define close to where it's used.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 6 --
 drivers/staging/lustre/lustre/llite/llite_lib.c   | 2 ++
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index ffcbc78..157bafb 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -84,10 +84,4 @@
 # define ext2_find_next_zero_bit  find_next_zero_bit_le
 #endif
 
-#ifdef ATTR_TIMES_SET
-# define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)
-#else
-# define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET)
-#endif
-
 #endif /* _COMPAT25_H */
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index ab4839c..39f0b2a 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1150,6 +1150,8 @@ void ll_clear_inode(struct inode *inode)
lli->lli_has_smd = false;
 }
 
+#define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)
+
 static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data,
  struct md_open_data **mod)
 {
-- 
2.1.0

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


[PATCH 02/13] staging/lustre: get rid of cfs_bio_* compat macroses

2015-07-30 Thread green
From: Oleg Drokin 

This replaces cfs_bio_io_error with direct calls to bio_io_error
and cfs_bio_end_io with bio_end_io

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h | 4 
 drivers/staging/lustre/lustre/llite/lloop.c   | 4 ++--
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 622bc93..e7d57e8 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -74,10 +74,6 @@
 #define FS_HAS_FIEMAP  (0)
 #endif
 
-#define cfs_bio_io_error(a, b)   bio_io_error((a))
-#define cfs_bio_endio(a, b, c)bio_endio((a), (c))
-
-
 #ifndef SLAB_DESTROY_BY_RCU
 #define SLAB_DESTROY_BY_RCU 0
 #endif
diff --git a/drivers/staging/lustre/lustre/llite/lloop.c 
b/drivers/staging/lustre/lustre/llite/lloop.c
index cc00fd1..56938d2 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -365,7 +365,7 @@ static void loop_make_request(struct request_queue *q, 
struct bio *old_bio)
loop_add_bio(lo, old_bio);
return;
 err:
-   cfs_bio_io_error(old_bio, old_bio->bi_iter.bi_size);
+   bio_io_error(old_bio);
 }
 
 
@@ -376,7 +376,7 @@ static inline void loop_handle_bio(struct lloop_device *lo, 
struct bio *bio)
while (bio) {
struct bio *tmp = bio->bi_next;
bio->bi_next = NULL;
-   cfs_bio_endio(bio, bio->bi_iter.bi_size, ret);
+   bio_endio(bio, ret);
bio = tmp;
}
 }
-- 
2.1.0

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


[PATCH 06/13] staging/lustre: Drop SEEK_* definition checks

2015-07-30 Thread green
From: Oleg Drokin 

SEEK_DATA and SEEK_HOLE are always defined in the kernel,
drop the definition checks

Signed-off-by: Oleg Drokin 
---
 .../lustre/lustre/include/linux/lustre_compat25.h  | 38 --
 1 file changed, 38 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index d0e8f3c..7d90999 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,37 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-static inline int
-ll_quota_on(struct super_block *sb, int off, int ver, char *name, int remount)
-{
-   int rc;
-
-   if (sb->s_qcop->quota_on) {
-   struct path path;
-
-   rc = kern_path(name, LOOKUP_FOLLOW, &path);
-   if (!rc)
-   return rc;
-   rc = sb->s_qcop->quota_on(sb, off, ver
-   , &path
-  );
-   path_put(&path);
-   return rc;
-   } else
-   return -ENOSYS;
-}
-
-static inline int ll_quota_off(struct super_block *sb, int off, int remount)
-{
-   if (sb->s_qcop->quota_off) {
-   return sb->s_qcop->quota_off(sb, off
-   );
-   } else
-   return -ENOSYS;
-}
-
-
-
 #define ll_d_hlist_node hlist_node
 #define ll_d_hlist_empty(list) hlist_empty(list)
 #define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name)
@@ -121,13 +90,6 @@ static inline int ll_quota_off(struct super_block *sb, int 
off, int remount)
 # define NO_QUOTA (-EDQUOT)
 #endif
 
-#ifndef SEEK_DATA
-#define SEEK_DATA  3   /* seek to the next data */
-#endif
-#ifndef SEEK_HOLE
-#define SEEK_HOLE  4   /* seek to the next hole */
-#endif
-
 #ifndef FMODE_UNSIGNED_OFFSET
 #define FMODE_UNSIGNED_OFFSET  ((__force fmode_t)0x2000)
 #endif
-- 
2.1.0

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


[PATCH 09/13] staging/lustre: Use hlist primitives directly

2015-07-30 Thread green
From: Oleg Drokin 

Get rid of ll_d_hlist* compat defines.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/include/linux/lustre_compat25.h |  9 -
 drivers/staging/lustre/lustre/llite/dcache.c  |  3 +--
 drivers/staging/lustre/lustre/llite/namei.c   | 10 --
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h 
b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
index 65493b3..bc4f752 100644
--- a/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
+++ b/drivers/staging/lustre/lustre/include/linux/lustre_compat25.h
@@ -69,15 +69,6 @@
 # define inode_dio_read(i) atomic_inc(&(i)->i_dio_count)
 /* inode_dio_done(i) use as-is for read unlock */
 
-#define ll_d_hlist_node hlist_node
-#define ll_d_hlist_empty(list) hlist_empty(list)
-#define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name)
-#define ll_d_hlist_for_each(tmp, i_dentry) hlist_for_each(tmp, i_dentry)
-#define ll_d_hlist_for_each_entry(dentry, p, i_dentry, alias) \
-   p = NULL; hlist_for_each_entry(dentry, i_dentry, alias)
-
-
-
 #define ll_pagevec_init(pv, cold)   do {} while (0)
 #define ll_pagevec_add(pv, pg)   (0)
 #define ll_pagevec_lru_add_file(pv) do {} while (0)
diff --git a/drivers/staging/lustre/lustre/llite/dcache.c 
b/drivers/staging/lustre/lustre/llite/dcache.c
index 7b008a6..b866859 100644
--- a/drivers/staging/lustre/lustre/llite/dcache.c
+++ b/drivers/staging/lustre/lustre/llite/dcache.c
@@ -250,7 +250,6 @@ void ll_intent_release(struct lookup_intent *it)
 void ll_invalidate_aliases(struct inode *inode)
 {
struct dentry *dentry;
-   struct ll_d_hlist_node *p;
 
LASSERT(inode != NULL);
 
@@ -258,7 +257,7 @@ void ll_invalidate_aliases(struct inode *inode)
   inode->i_ino, inode->i_generation, inode);
 
ll_lock_dcache(inode);
-   ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry, d_u.d_alias) {
+   hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) {
CDEBUG(D_DENTRY, "dentry in drop %pd (%p) parent %p inode %p 
flags %d\n",
   dentry, dentry, dentry->d_parent,
   d_inode(dentry), dentry->d_flags);
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 2ed1e0a..05e7dc8 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -144,10 +144,9 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash,
 static void ll_invalidate_negative_children(struct inode *dir)
 {
struct dentry *dentry, *tmp_subdir;
-   struct ll_d_hlist_node *p;
 
ll_lock_dcache(dir);
-   ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry, d_u.d_alias) {
+   hlist_for_each_entry(dentry, &dir->i_dentry, d_u.d_alias) {
spin_lock(&dentry->d_lock);
if (!list_empty(&dentry->d_subdirs)) {
struct dentry *child;
@@ -334,15 +333,14 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1, struct 
inode *i2)
 static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)
 {
struct dentry *alias, *discon_alias, *invalid_alias;
-   struct ll_d_hlist_node *p;
 
-   if (ll_d_hlist_empty(&inode->i_dentry))
+   if (hlist_empty(&inode->i_dentry))
return NULL;
 
discon_alias = invalid_alias = NULL;
 
ll_lock_dcache(inode);
-   ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry, d_u.d_alias) {
+   hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) {
LASSERT(alias != dentry);
 
spin_lock(&alias->d_lock);
@@ -690,7 +688,7 @@ static struct inode *ll_create_node(struct inode *dir, 
struct lookup_intent *it)
goto out;
}
 
-   LASSERT(ll_d_hlist_empty(&inode->i_dentry));
+   LASSERT(hlist_empty(&inode->i_dentry));
 
/* We asked for a lock on the directory, but were granted a
 * lock on the inode.  Since we finally have an inode pointer,
-- 
2.1.0

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


[PATCH] staging/lustre/llite: Don't set page writeback on non-dirty page

2015-07-30 Thread green
From: Oleg Drokin 

New writeback changes in 4.2-RC1 have exposed that we incorrectly
set page_writeback on a page that is being written synchronously,
which aside from this new crash (dereference of NULL inode->i_wb
from set_page_writeback) likely threw off some related page
statistics in the past.

 BUG: unable to handle kernel NULL pointer dereference at 0138
 IP: [] __percpu_counter_add+0x1a/0x80
 PGD 0
 Oops:  [#1] SMP DEBUG_PAGEALLOC
 Modules linked in: osc(C) lmv(C) fld(C) mgc(C) lustre(C) mdc(C) fid(C) lov(C) 
ksocklnd(C) ptlrpc(C) obdclass(C) lnet(C) libcfs(C) loop sha512_generic crc32 
rpcsec_gss_krb5 microcode joydev i2c_piix4 acpi_cpufreq pcspkr nfsd syscopyarea 
sysfillrect sysimgblt drm_kms_helper ttm drm serio_raw virtio_blk [last 
unloaded: libcfs]
 CPU: 0 PID: 13328 Comm: cvs Tainted: G C  4.2.0-rc1-vm-nfs+ #30
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
 task: 8800cc98a400 ti: 8801157e8000 task.ti: 8801157e8000
 RIP: 0010:[]  [] 
__percpu_counter_add+0x1a/0x80
 RSP: 0018:8801157eb698  EFLAGS: 00010086
 RAX: 0003 RBX: ea0002b91cc0 RCX: 001a
 RDX: 0020 RSI: 0001 RDI: 00e8
 RBP: 8801157eb6b8 R08: 0001 R09: 
 R10:  R11:  R12: 00e8
 R13: 0001 R14: 8800673587a8 R15: 8800673589b0
 FS:  7f6718b89800() GS:88011f40() knlGS:
 CS:  0010 DS:  ES:  CR0: 80050033
 CR2: 0138 CR3: 9d51c000 CR4: 07f0
 Stack:
  811919e2 ea0002b91cc0 880067358998 880119419800
  8801157eb718 81191a58 8801157eb788 0282
  8800ce5ce920  8800a525af80 880053f68f10
 Call Trace:
  [] ? __test_set_page_writeback+0x72/0x240
  [] __test_set_page_writeback+0xe8/0x240
  [] vvp_page_prep_write+0x33/0xb0 [lustre]
  [] cl_page_invoke+0x57/0x90 [obdclass]
  [] cl_page_prep+0x2d/0x180 [obdclass]
  [] osc_io_submit+0x134/0x4a0 [osc]
  [] cl_io_submit_rw+0x53/0xb0 [obdclass]
  [] lov_io_submit+0x3a5/0x570 [lov]
  [] ? lockdep_init_map+0x5b/0x6d0
  [] cl_io_submit_rw+0x53/0xb0 [obdclass]
  [] cl_io_submit_sync+0xed/0x1c0 [obdclass]
  [] vvp_page_sync_io.isra.15+0x4d/0x100 [lustre]
  [] ? cl_page_clip+0xff/0x130 [obdclass]
  [] vvp_io_commit_write+0x448/0x500 [lustre]
  [] cl_io_commit_write+0x9a/0x130 [obdclass]
  [] ll_commit_write+0xc2/0x230 [lustre]
  [] ll_write_end+0x2a/0x50 [lustre]
  [] generic_perform_write+0xfa/0x1b0
  [] ? dentry_needs_remove_privs.part.16+0x1e/0x30
  [] __generic_file_write_iter+0x190/0x1f0
  [] generic_file_write_iter+0xea/0x1e0
  [] vvp_io_write_start+0xa0/0x1e0 [lustre]
  [] cl_io_start+0x49/0x80 [obdclass]
  [] cl_io_loop+0x73/0xd0 [obdclass]
  [] ll_file_io_generic+0x45f/0x4b0 [lustre]
  [] ll_file_write_iter+0x6c/0xc0 [lustre]
  [] __vfs_write+0xaa/0xe0
  [] vfs_write+0xa9/0x190
  [] SyS_write+0x49/0xa0
  [] entry_SYSCALL_64_fastpath+0x16/0x7a
 Code: 5b 41 5c 41 5d 41 5e 5d c3 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 55 41 
54 53 49 89 fc 49 89 f5 48 83 ec 08 65 ff 05 8e d1 bf 7e <48> 8b 47 50 48 63 ca 
65 8b 18 48 63 db 48 01 f3 48 39 cb 7d 0a

Signed-off-by: Jinshan Xiong 
Signed-off-by: Oleg Drokin 
Reviewed-on: http://review.whamcloud.com/15610
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6854
---
 drivers/staging/lustre/lustre/llite/vvp_page.c   | 27 +++-
 drivers/staging/lustre/lustre/obdclass/cl_page.c |  3 ---
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/vvp_page.c 
b/drivers/staging/lustre/lustre/llite/vvp_page.c
index 954ed08..a3cf5ad 100644
--- a/drivers/staging/lustre/lustre/llite/vvp_page.c
+++ b/drivers/staging/lustre/lustre/llite/vvp_page.c
@@ -227,11 +227,16 @@ static int vvp_page_prep_write(const struct lu_env *env,
   struct cl_io *unused)
 {
struct page *vmpage = cl2vm_page(slice);
+   struct cl_page *pg = slice->cpl_page;
 
LASSERT(PageLocked(vmpage));
LASSERT(!PageDirty(vmpage));
 
-   set_page_writeback(vmpage);
+   /* ll_writepage path is not a sync write, so need to set page writeback
+* flag */
+   if (!pg->cp_sync_io)
+   set_page_writeback(vmpage);
+
vvp_write_pending(cl2ccc(slice->cpl_obj), cl2ccc_page(slice));
 
return 0;
@@ -298,9 +303,6 @@ static void vvp_page_completion_write(const struct lu_env 
*env,
struct cl_page  *pg = slice->cpl_page;
struct page  *vmpage = cp->cpg_page;
 
-   LASSERT(ergo(pg->cp_sync_io != NULL, PageLocked(vmpage)));
-   LASSERT(PageWriteback(vmpage));
-
CL_PAGE_HEADER(D_PAGE, env, pg, "completing WRITE with %d\n", ioret);
 
/*
@@ -316,14 +318,19 @@ static void vvp_page_completion_write(const struct lu_env 
*env,
cp->cpg_write_queued = 0;
vvp_write

Re: [PATCH V2 1/5] staging: wilc1000: #ifdef conditionals cover entire functions

2015-07-30 Thread tony . cho



On 2015년 07월 30일 20:56, Sudip Mukherjee wrote:

On Thu, Jul 30, 2015 at 06:10:10PM +0900, Tony Cho wrote:

This patch lets preprocessor conditionals (#ifdef) related to
WILC_SDIO_IRQ_GPIO to compile out the entire functions. Compiling out
the entire functions is preferred rather than portions of functions or
expressions becausue doing so makes code harder to read.

Signed-off-by: Tony Cho 
---


  
+#ifdef WILC_SDIO_IRQ_GPIO

  static int sdio_clear_int(void)
  {
-#ifndef WILC_SDIO_IRQ_GPIO
-   /* uint32_t sts; */
-   sdio_cmd52_t cmd;
-
-   cmd.read_write = 0;
-   cmd.function = 1;
-   cmd.raw = 0;
-   cmd.address = 0x4;
-   cmd.data = 0;
-   g_sdio.sdio_cmd52(&cmd);
-   int_clrd++;
-
-   return cmd.data;
-#else
uint32_t reg;
  
  	if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {

@@ -181,9 +168,23 @@ static int sdio_clear_int(void)
sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
int_clrd++;
return 1;
-#endif
+}
+#else
+static int sdio_clear_int(void)
+{
+   sdio_cmd52_t cmd;
+
+   cmd.read_write = 0;
+   cmd.function = 1;
+   cmd.raw = 0;
+   cmd.address = 0x4;
+   cmd.data = 0;
+   g_sdio.sdio_cmd52(&cmd);
+   int_clrd++;
  
+	return cmd.data;

  }
+#endif /* WILC_SDIO_IRQ_GPIO */

instead of changing #ifndef to #ifdef i think the following would have
been easier:


Yes, I agree with you. I will rewrite them after a big patch is accepted.
Thanks for your advice.
Tony.



diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 5a18148..5cd4d45 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -155,9 +155,9 @@ _fail_:
return 0;
  }
  
+#ifndef WILC_SDIO_IRQ_GPIO

  static int sdio_clear_int(void)
  {
-#ifndef WILC_SDIO_IRQ_GPIO
/* uint32_t sts; */
sdio_cmd52_t cmd;
  
@@ -170,7 +170,10 @@ static int sdio_clear_int(void)

int_clrd++;
  
  	return cmd.data;

+}
  #else
+static int sdio_clear_int(void)
+{
uint32_t reg;
  
  	if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {

@@ -181,9 +184,8 @@ static int sdio_clear_int(void)
sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
int_clrd++;
return 1;
-#endif
-
  }
+#endif
  
  uint32_t sdio_xfer_cnt(void)

  {

  
  uint32_t sdio_xfer_cnt(void)



+#ifdef WILC_SDIO_IRQ_GPIO
  static int sdio_clear_int_ext(uint32_t val)
  {
int ret;
  
-	if (g_sdio.has_thrpt_enh3) {

+   if(g_sdio.has_thrpt_enh3) {

why changing this? The original style is according to the kernel coding
style.

regards
sudip


--
Cho, Tony
Manager, Staff Engineer | Connectivity System Software Team | Atmel Korea 
(Wireless solutions BU)
#409, Kins Tower, Jeongja-Dong, Bundang-Gu, Seongnam-Si, Gyeonggi-Do, 463-782, 
Korea
Phone:82 31 784 8400(Ext. 317); Mobile: 82 10 7232 1523
email: tony@atmel.com

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


Re: [PATCH V2 1/5] staging: wilc1000: #ifdef conditionals cover entire functions

2015-07-30 Thread tony . cho



On 2015년 07월 30일 20:56, Sudip Mukherjee wrote:

On Thu, Jul 30, 2015 at 06:10:10PM +0900, Tony Cho wrote:

This patch lets preprocessor conditionals (#ifdef) related to
WILC_SDIO_IRQ_GPIO to compile out the entire functions. Compiling out
the entire functions is preferred rather than portions of functions or
expressions becausue doing so makes code harder to read.

Signed-off-by: Tony Cho 
---


  
+#ifdef WILC_SDIO_IRQ_GPIO

  static int sdio_clear_int(void)
  {
-#ifndef WILC_SDIO_IRQ_GPIO
-   /* uint32_t sts; */
-   sdio_cmd52_t cmd;
-
-   cmd.read_write = 0;
-   cmd.function = 1;
-   cmd.raw = 0;
-   cmd.address = 0x4;
-   cmd.data = 0;
-   g_sdio.sdio_cmd52(&cmd);
-   int_clrd++;
-
-   return cmd.data;
-#else
uint32_t reg;
  
  	if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {

@@ -181,9 +168,23 @@ static int sdio_clear_int(void)
sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
int_clrd++;
return 1;
-#endif
+}
+#else
+static int sdio_clear_int(void)
+{
+   sdio_cmd52_t cmd;
+
+   cmd.read_write = 0;
+   cmd.function = 1;
+   cmd.raw = 0;
+   cmd.address = 0x4;
+   cmd.data = 0;
+   g_sdio.sdio_cmd52(&cmd);
+   int_clrd++;
  
+	return cmd.data;

  }
+#endif /* WILC_SDIO_IRQ_GPIO */

instead of changing #ifndef to #ifdef i think the following would have
been easier:


Yes, I agree with you. I will rewrite them after important patches are accepted.
Thanks for your advice,
Tony.



diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 5a18148..5cd4d45 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -155,9 +155,9 @@ _fail_:
return 0;
  }
  
+#ifndef WILC_SDIO_IRQ_GPIO

  static int sdio_clear_int(void)
  {
-#ifndef WILC_SDIO_IRQ_GPIO
/* uint32_t sts; */
sdio_cmd52_t cmd;
  
@@ -170,7 +170,10 @@ static int sdio_clear_int(void)

int_clrd++;
  
  	return cmd.data;

+}
  #else
+static int sdio_clear_int(void)
+{
uint32_t reg;
  
  	if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {

@@ -181,9 +184,8 @@ static int sdio_clear_int(void)
sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
int_clrd++;
return 1;
-#endif
-
  }
+#endif
  
  uint32_t sdio_xfer_cnt(void)

  {

  
  uint32_t sdio_xfer_cnt(void)



+#ifdef WILC_SDIO_IRQ_GPIO
  static int sdio_clear_int_ext(uint32_t val)
  {
int ret;
  
-	if (g_sdio.has_thrpt_enh3) {

+   if(g_sdio.has_thrpt_enh3) {

why changing this? The original style is according to the kernel coding
style.

regards
sudip


--
Cho, Tony
Manager, Staff Engineer | Connectivity System Software Team | Atmel Korea 
(Wireless solutions BU)
#409, Kins Tower, Jeongja-Dong, Bundang-Gu, Seongnam-Si, Gyeonggi-Do, 463-782, 
Korea
Phone:82 31 784 8400(Ext. 317); Mobile: 82 10 7232 1523
email: tony@atmel.com

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


Re: [PATCH V2 1/5] staging: wilc1000: #ifdef conditionals cover entire functions

2015-07-30 Thread Greg KH
On Fri, Jul 31, 2015 at 12:27:04PM +0900, tony.cho wrote:
> 
> 
> On 2015년 07월 30일 20:56, Sudip Mukherjee wrote:
> >On Thu, Jul 30, 2015 at 06:10:10PM +0900, Tony Cho wrote:
> >>This patch lets preprocessor conditionals (#ifdef) related to
> >>WILC_SDIO_IRQ_GPIO to compile out the entire functions. Compiling out
> >>the entire functions is preferred rather than portions of functions or
> >>expressions becausue doing so makes code harder to read.
> >>
> >>Signed-off-by: Tony Cho 
> >>---
> >
> >>+#ifdef WILC_SDIO_IRQ_GPIO
> >>  static int sdio_clear_int(void)
> >>  {
> >>-#ifndef WILC_SDIO_IRQ_GPIO
> >>-   /* uint32_t sts; */
> >>-   sdio_cmd52_t cmd;
> >>-
> >>-   cmd.read_write = 0;
> >>-   cmd.function = 1;
> >>-   cmd.raw = 0;
> >>-   cmd.address = 0x4;
> >>-   cmd.data = 0;
> >>-   g_sdio.sdio_cmd52(&cmd);
> >>-   int_clrd++;
> >>-
> >>-   return cmd.data;
> >>-#else
> >>uint32_t reg;
> >>if (!sdio_read_reg(WILC_HOST_RX_CTRL_0, ®)) {
> >>@@ -181,9 +168,23 @@ static int sdio_clear_int(void)
> >>sdio_write_reg(WILC_HOST_RX_CTRL_0, reg);
> >>int_clrd++;
> >>return 1;
> >>-#endif
> >>+}
> >>+#else
> >>+static int sdio_clear_int(void)
> >>+{
> >>+   sdio_cmd52_t cmd;
> >>+
> >>+   cmd.read_write = 0;
> >>+   cmd.function = 1;
> >>+   cmd.raw = 0;
> >>+   cmd.address = 0x4;
> >>+   cmd.data = 0;
> >>+   g_sdio.sdio_cmd52(&cmd);
> >>+   int_clrd++;
> >>+   return cmd.data;
> >>  }
> >>+#endif /* WILC_SDIO_IRQ_GPIO */
> >instead of changing #ifndef to #ifdef i think the following would have
> >been easier:
> 
> Yes, I agree with you.

Great!

> I will rewrite them after important patches are accepted.

This is the first patch in the series, I'm not going to take it if you
are going to redo it later, please fix it correctly.

I'll drop this series from my queue.

thanks,

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


Re: [PATCH 0/5] 2nd patch for illegal coding style

2015-07-30 Thread Greg KH
On Thu, Jul 30, 2015 at 06:10:09PM +0900, Tony Cho wrote:
> This patch V2 includes only patches rejected. The rejected patch for the
> following, #ifdef conditionals cover entire functions, introduced new error on
> required space before the open parenthesis '('. This is my mistake while
> rewriting codes.
> 
> The original 13th patch didn't include new fix introduced on the previous 
> patch
> due to no sync-up issue. The original 13th patch fixed the same warnings but
> in different place. 
> 
> The 64bit compile warnings will be resolved after sending these patches. Then,
> ambiguous sdio/spi parts including preprocessor conditionals will be tried.

Again, please fix the build warnings first, they are much more important
than coding style issues.

thanks,

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


Re: [PATCH 0/5] 2nd patch for illegal coding style

2015-07-30 Thread tony . cho

Hi Greg,

I understand what you mention. I will first make it.

The 5 patches among the first series of patch was rejected and the 2nd patch 
also has a problem. As you said, I will resend them later after

removing build warnings. They will be delivered soon.

Thanks,

Tony.


On 2015년 07월 31일 12:49, Greg KH wrote:

On Thu, Jul 30, 2015 at 06:10:09PM +0900, Tony Cho wrote:

This patch V2 includes only patches rejected. The rejected patch for the
following, #ifdef conditionals cover entire functions, introduced new error on
required space before the open parenthesis '('. This is my mistake while
rewriting codes.

The original 13th patch didn't include new fix introduced on the previous patch
due to no sync-up issue. The original 13th patch fixed the same warnings but
in different place.

The 64bit compile warnings will be resolved after sending these patches. Then,
ambiguous sdio/spi parts including preprocessor conditionals will be tried.

Again, please fix the build warnings first, they are much more important
than coding style issues.

thanks,

greg k-h


--
Cho, Tony
Manager, Staff Engineer | Connectivity System Software Team | Atmel Korea 
(Wireless solutions BU)
#409, Kins Tower, Jeongja-Dong, Bundang-Gu, Seongnam-Si, Gyeonggi-Do, 463-782, 
Korea
Phone:82 31 784 8400(Ext. 317); Mobile: 82 10 7232 1523
email: tony@atmel.com

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


[PATCH] Staging:wilc1000 :Remove braces for single statement blocks

2015-07-30 Thread Shraddha Barke
This patch fixes the following checkpatch.pl warning:

WARNING: braces {} are not necessary for single statement blocks
Signed-off-by: Shraddha Barke 
---
 drivers/staging/wilc1000/coreconfigurator.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 4d5bd1c..1143282 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -1055,10 +1055,8 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s 
*pstrSurveyResults)
 {
s32 s32Error = WILC_SUCCESS;
 
-   if (pstrSurveyResults != NULL) {
+   if (pstrSurveyResults != NULL)
WILC_FREE(pstrSurveyResults);
-   }
-
return s32Error;
 }
 #endif
-- 
2.1.0

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


[PATCH] Staging: wilc1000 :Insert blank line after declaration

2015-07-30 Thread Shraddha Barke
This patch fixes the following checkpatch.pl warning:

WARNING: Missing a blank line after declarations
Signed-off-by: Shraddha Barke 
---
 drivers/staging/wilc1000/coreconfigurator.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 1143282..0f31d63 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -1094,6 +1094,7 @@ void ProcessCharWid(char *pcPacket, s32 *ps32PktLen,
u8 *pu8val = (u8 *)ps8WidVal;
u8 u8val = 0;
s32 s32PktLen = *ps32PktLen;
+
if (pstrWID == NULL) {
PRINT_WRN(CORECONFIG_DBG, "Can't set CHAR val 0x%x ,NULL 
structure\n", u8val);
return;
-- 
2.1.0

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


Re: [PATCH] Staging:wilc1000 :Remove braces for single statement blocks

2015-07-30 Thread Vaishali Thakkar
On 31 Jul 2015 10:49, "Shraddha Barke"  wrote:
>
> This patch fixes the following checkpatch.pl warning:
>
> WARNING: braces {} are not necessary for single statement blocks

There should be one line space between your commit log
and Signed-off-by line.

> Signed-off-by: Shraddha Barke 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index 4d5bd1c..1143282 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -1055,10 +1055,8 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s 
> *pstrSurveyResults)
>  {
> s32 s32Error = WILC_SUCCESS;
>
> -   if (pstrSurveyResults != NULL) {
> +   if (pstrSurveyResults != NULL)
> WILC_FREE(pstrSurveyResults);
> -   }
> -
> return s32Error;
>  }
>  #endif
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging : wilc1000 :Remove typedef from struct

2015-07-30 Thread Shraddha Barke
This patch fixes the following checkpatch.pl warning:

WARNING: do not add new typedefs
Signed-off-by: Shraddha Barke 
---
 drivers/staging/wilc1000/coreconfigurator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 0f31d63..54eb8a1 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -140,7 +140,7 @@ typedef enum {
 } tenuInfoElemID;
 
 
-typedef struct {
+struct {
char *pcRespBuffer;
s32 s32MaxRespBuffLen;
s32 s32BytesRead;
-- 
2.1.0

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


[PATCH] Staging:wilc1000 :Remove typedef from struct

2015-07-30 Thread Shraddha Barke
This patch fixes the following checkpatch.pl warning:

WARNING: do not add new typedefs

Signed-off-by: Shraddha Barke 
---
 drivers/staging/wilc1000/coreconfigurator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 54eb8a1..d6ef6e1 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -88,7 +88,7 @@ typedef enum {
 } tenuFrmSubtype;
 
 /* Basic Frame Classes */
-typedef enum {
+enum {
CLASS1_FRAME_TYPE  = 0x00,
CLASS2_FRAME_TYPE  = 0x01,
CLASS3_FRAME_TYPE  = 0x02,
-- 
2.1.0

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


Re: [PATCH] Staging : wilc1000 :Remove typedef from struct

2015-07-30 Thread Joe Perches
On Fri, 2015-07-31 at 11:02 +0530, Shraddha Barke wrote:
> This patch fixes the following checkpatch.pl warning:
> 
> WARNING: do not add new typedefs
> Signed-off-by: Shraddha Barke 
> ---
>  drivers/staging/wilc1000/coreconfigurator.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
> b/drivers/staging/wilc1000/coreconfigurator.c
> index 0f31d63..54eb8a1 100644
> --- a/drivers/staging/wilc1000/coreconfigurator.c
> +++ b/drivers/staging/wilc1000/coreconfigurator.c
> @@ -140,7 +140,7 @@ typedef enum {
>  } tenuInfoElemID;
>  
> 
> -typedef struct {
> +struct {
>   char *pcRespBuffer;
>   s32 s32MaxRespBuffLen;
>   s32 s32BytesRead;

You haven't compiled this.

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