[PATCH] staging: rtl8188eu: coding style fixup

2014-10-09 Thread Igor Bogomazov
checkpatch.pl tiny fix
get rid of 2 warnings and 2 errors for hal/fw.c

Signed-off-by: Igor Bogomazov yg...@ygrex.ru
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: navin patidar navin.pati...@gmail.com
Cc: Stephen Rothwell s...@canb.auug.org.au
---
for linux-next 3.17.0

this is an updated version of the patch I've sent two days ago, that one
did not apply cleanly

diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
b/drivers/staging/rtl8188eu/hal/fw.c
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -154,9 +154,8 @@ static int _rtl88e_fw_free_to_go(struct adapter *adapt)
break;
} while (counter++  POLLING_READY_TIMEOUT_COUNT);
 
-   if (counter = POLLING_READY_TIMEOUT_COUNT) {
+   if (counter = POLLING_READY_TIMEOUT_COUNT)
goto exit;
-   }
 
value32 = usb_read32(adapt, REG_MCUFWDL);
value32 |= MCUFWDL_RDY;
@@ -193,13 +192,13 @@ int rtl88eu_download_fw(struct adapter *adapt)
u32 fwsize;
int err;
 
-   if (request_firmware(fw, fw_name, device)){
+   if (request_firmware(fw, fw_name, device)) {
dev_err(device, Firmware %s not available\n, fw_name);
return -ENOENT;
}
 
if (fw-size  FW_8188E_SIZE) {
-   dev_err(device,Firmware size exceed 0x%X. Check it.\n,
+   dev_err(device, Firmware size exceed 0x%X. Check it.\n,
 FW_8188E_SIZE);
return -1;
}
@@ -226,7 +225,8 @@ int rtl88eu_download_fw(struct adapter *adapt)
rtl88e_firmware_selfreset(adapt);
}
_rtl88e_enable_fw_download(adapt, true);
-   usb_write8(adapt, REG_MCUFWDL, usb_read8(adapt, REG_MCUFWDL) | 
FWDL_ChkSum_rpt);
+   usb_write8(adapt, REG_MCUFWDL,
+   usb_read8(adapt, REG_MCUFWDL) | FWDL_ChkSum_rpt);
_rtl88e_write_fw(adapt, pfwdata, fwsize);
_rtl88e_enable_fw_download(adapt, false);

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


Re: [PATCH] staging: rtl8188eu: coding style fixup

2014-10-09 Thread Denis Kirjanov
But you haven't CCed people in the CC list

On 10/9/14, Igor Bogomazov yg...@ygrex.ru wrote:
 checkpatch.pl tiny fix
 get rid of 2 warnings and 2 errors for hal/fw.c

 Signed-off-by: Igor Bogomazov yg...@ygrex.ru
 Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
 Cc: navin patidar navin.pati...@gmail.com
 Cc: Stephen Rothwell s...@canb.auug.org.au
 ---
 for linux-next 3.17.0

 this is an updated version of the patch I've sent two days ago, that one
 did not apply cleanly

 diff --git a/drivers/staging/rtl8188eu/hal/fw.c
 b/drivers/staging/rtl8188eu/hal/fw.c
 --- a/drivers/staging/rtl8188eu/hal/fw.c
 +++ b/drivers/staging/rtl8188eu/hal/fw.c
 @@ -154,9 +154,8 @@ static int _rtl88e_fw_free_to_go(struct adapter *adapt)
   break;
   } while (counter++  POLLING_READY_TIMEOUT_COUNT);

 - if (counter = POLLING_READY_TIMEOUT_COUNT) {
 + if (counter = POLLING_READY_TIMEOUT_COUNT)
   goto exit;
 - }

   value32 = usb_read32(adapt, REG_MCUFWDL);
   value32 |= MCUFWDL_RDY;
 @@ -193,13 +192,13 @@ int rtl88eu_download_fw(struct adapter *adapt)
   u32 fwsize;
   int err;

 - if (request_firmware(fw, fw_name, device)){
 + if (request_firmware(fw, fw_name, device)) {
   dev_err(device, Firmware %s not available\n, fw_name);
   return -ENOENT;
   }

   if (fw-size  FW_8188E_SIZE) {
 - dev_err(device,Firmware size exceed 0x%X. Check it.\n,
 + dev_err(device, Firmware size exceed 0x%X. Check it.\n,
FW_8188E_SIZE);
   return -1;
   }
 @@ -226,7 +225,8 @@ int rtl88eu_download_fw(struct adapter *adapt)
   rtl88e_firmware_selfreset(adapt);
   }
   _rtl88e_enable_fw_download(adapt, true);
 - usb_write8(adapt, REG_MCUFWDL, usb_read8(adapt, REG_MCUFWDL) |
 FWDL_ChkSum_rpt);
 + usb_write8(adapt, REG_MCUFWDL,
 + usb_read8(adapt, REG_MCUFWDL) | FWDL_ChkSum_rpt);
   _rtl88e_write_fw(adapt, pfwdata, fwsize);
   _rtl88e_enable_fw_download(adapt, false);

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



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


Re: [PATCH] staging: rtl8188eu: coding style fixup

2014-10-09 Thread Igor Bogomazov
you are right, would be wise to do that, added

On Thu, 9 Oct 2014 10:32:37 +0400
Denis Kirjanov kirja...@gmail.com wrote:

 But you haven't CCed people in the CC list
 
 On 10/9/14, Igor Bogomazov yg...@ygrex.ru wrote:
  checkpatch.pl tiny fix
  get rid of 2 warnings and 2 errors for hal/fw.c
 
  Signed-off-by: Igor Bogomazov yg...@ygrex.ru
  Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
  Cc: navin patidar navin.pati...@gmail.com
  Cc: Stephen Rothwell s...@canb.auug.org.au
  ---
  for linux-next 3.17.0
 
  this is an updated version of the patch I've sent two days ago, that one
  did not apply cleanly
 
  diff --git a/drivers/staging/rtl8188eu/hal/fw.c
  b/drivers/staging/rtl8188eu/hal/fw.c
  --- a/drivers/staging/rtl8188eu/hal/fw.c
  +++ b/drivers/staging/rtl8188eu/hal/fw.c
  @@ -154,9 +154,8 @@ static int _rtl88e_fw_free_to_go(struct adapter *adapt)
  break;
  } while (counter++  POLLING_READY_TIMEOUT_COUNT);
 
  -   if (counter = POLLING_READY_TIMEOUT_COUNT) {
  +   if (counter = POLLING_READY_TIMEOUT_COUNT)
  goto exit;
  -   }
 
  value32 = usb_read32(adapt, REG_MCUFWDL);
  value32 |= MCUFWDL_RDY;
  @@ -193,13 +192,13 @@ int rtl88eu_download_fw(struct adapter *adapt)
  u32 fwsize;
  int err;
 
  -   if (request_firmware(fw, fw_name, device)){
  +   if (request_firmware(fw, fw_name, device)) {
  dev_err(device, Firmware %s not available\n, fw_name);
  return -ENOENT;
  }
 
  if (fw-size  FW_8188E_SIZE) {
  -   dev_err(device,Firmware size exceed 0x%X. Check it.\n,
  +   dev_err(device, Firmware size exceed 0x%X. Check it.\n,
   FW_8188E_SIZE);
  return -1;
  }
  @@ -226,7 +225,8 @@ int rtl88eu_download_fw(struct adapter *adapt)
  rtl88e_firmware_selfreset(adapt);
  }
  _rtl88e_enable_fw_download(adapt, true);
  -   usb_write8(adapt, REG_MCUFWDL, usb_read8(adapt, REG_MCUFWDL) |
  FWDL_ChkSum_rpt);
  +   usb_write8(adapt, REG_MCUFWDL,
  +   usb_read8(adapt, REG_MCUFWDL) | FWDL_ChkSum_rpt);
  _rtl88e_write_fw(adapt, pfwdata, fwsize);
  _rtl88e_enable_fw_download(adapt, false);
 
  ___
  devel mailing list
  de...@linuxdriverproject.org
  http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
 

-- 
Sincerely yours,

Igor Bogomazov
Saint-Petersburg, Russia

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


Re: [PATCH v3 2/2] staging: gs_fpgaboot: Fix Possible unnecessary 'out of memory' message checkpatch.pl warning

2014-10-09 Thread Dzmitry Sledneu
On 10/09/2014 12:48 AM, Greg Kroah-Hartman wrote:
 On Tue, Oct 07, 2014 at 05:54:48PM +0200, Dzmitry Sledneu wrote:
 Fix Possible unnecessary 'out of memory' message checkpatch.pl warning

 Signed-off-by: Dzmitry Sledneu dzmitry.sled...@gmail.com

 ---
  drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 7 ++-
  1 file changed, 2 insertions(+), 5 deletions(-)

 diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c 
 b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
 index 9764a9a..0c18c4c 100644
 --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
 +++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
 @@ -295,10 +295,8 @@ static int gs_fpgaboot(void)
  struct fpgaimage*fimage;
  
  fimage = kmalloc(sizeof(struct fpgaimage), GFP_KERNEL);
 -if (fimage == NULL) {
 -pr_err(No memory is available\n);
 -goto err_out;
 -}
 +if (!fimage)
 +return -ENOMEM;
  
  err = gs_load_image(fimage, file);
  if (err) {
 @@ -340,7 +338,6 @@ err_out2:
  err_out1:
  kfree(fimage);
  
 -err_out:
  return -1;
  
  }
 
 Doesn't apply to my tree properly :(
 

I looked at it in your tree and it has already been fixed there.

But the fix is not quite correct, because it returns -ENOPERM (-1)
it case kmalloc fails and not -ENOMEM (-12).

I will submit a new patch to fix this.

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


[PATCH v4] staging: gs_fpgaboot: Fix out of memory error handling

2014-10-09 Thread Dzmitry Sledneu
Fix out of memory error handling

Signed-off-by: Dzmitry Sledneu dzmitry.sled...@gmail.com

---
 drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c 
b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index cbf70ce..0c18c4c 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -295,8 +295,8 @@ static int gs_fpgaboot(void)
struct fpgaimage*fimage;
 
fimage = kmalloc(sizeof(struct fpgaimage), GFP_KERNEL);
-   if (fimage == NULL)
-   goto err_out;
+   if (!fimage)
+   return -ENOMEM;
 
err = gs_load_image(fimage, file);
if (err) {
@@ -338,7 +338,6 @@ err_out2:
 err_out1:
kfree(fimage);
 
-err_out:
return -1;
 
 }
-- 
2.1.2

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


[PATCH] staging: rtl8188eu: Fix coding style error problems

2014-10-09 Thread Jia He
Signed-off-by: Jia He hejia...@gmail.com
This fixes all coding style error problems at rtl8188eu which
makes checkpatch.pl unhappy
---
 drivers/staging/rtl8188eu/hal/bb_cfg.c | 4 ++--
 drivers/staging/rtl8188eu/hal/fw.c | 4 ++--
 drivers/staging/rtl8188eu/hal/phy.c| 2 +-
 drivers/staging/rtl8188eu/hal/rf.c | 4 ++--
 drivers/staging/rtl8188eu/hal/rf_cfg.c | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c 
b/drivers/staging/rtl8188eu/hal/bb_cfg.c
index 80e8cc9..3743a72 100644
--- a/drivers/staging/rtl8188eu/hal/bb_cfg.c
+++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c
@@ -173,7 +173,7 @@ static bool set_baseband_agc_config(struct adapter *adapt)
u32 v1 = array[i];
u32 v2 = array[i+1];
 
-   if (v1  0xCDCDCDCD){
+   if (v1  0xCDCDCDCD) {
phy_set_bb_reg(adapt, v1, bMaskDWord, v2);
udelay(1);
}
@@ -552,7 +552,7 @@ static void store_pwrindex_offset(struct adapter *Adapter, 
u32 regaddr, u32 bitm
}
 }
 
-static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask ,u32 
data)
+static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask , u32 
data)
 {
if (addr == 0xfe) {
msleep(50);
diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
b/drivers/staging/rtl8188eu/hal/fw.c
index 17b7f37..d6efd54 100644
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -193,13 +193,13 @@ int rtl88eu_download_fw(struct adapter *adapt)
u32 fwsize;
int err;
 
-   if (request_firmware(fw, fw_name, device)){
+   if (request_firmware(fw, fw_name, device)) {
dev_err(device, Firmware %s not available\n, fw_name);
return -ENOENT;
}
 
if (fw-size  FW_8188E_SIZE) {
-   dev_err(device,Firmware size exceed 0x%X. Check it.\n,
+   dev_err(device, Firmware size exceed 0x%X. Check it.\n,
 FW_8188E_SIZE);
return -1;
}
diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index c4f7f35..3f663fe 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -478,7 +478,7 @@ void 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
/* 2.4G, decrease power */
{0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11},
/* 2.4G, increase power */
-   {0, 0, -1, -2, -3, -4,-4, -4, -4, -5, -7, -8,-9, -9, -10},
+   {0, 0, -1, -2, -3, -4, -4, -4, -4, -5, -7, -8, -9, -9, -10},
};
u8 thermal_mapping[2][index_mapping_NUM_88E] = {
/* 2.4G, decrease power */
diff --git a/drivers/staging/rtl8188eu/hal/rf.c 
b/drivers/staging/rtl8188eu/hal/rf.c
index c2fac34..8e7a0b1 100644
--- a/drivers/staging/rtl8188eu/hal/rf.c
+++ b/drivers/staging/rtl8188eu/hal/rf.c
@@ -102,7 +102,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter 
*adapt, u8 *powerlevel)
}
}
rtl88eu_dm_txpower_track_adjust(hal_data-odmpriv, 1, direction,
-   pwrtrac_value);
+   pwrtrac_value);
 
if (direction == 1) {
/*  Increase TX power */
@@ -131,7 +131,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter 
*adapt, u8 *powerlevel)
 /*  powerbase1 for HT MCS rates */
 static void getpowerbase88e(struct adapter *adapt, u8 *pwr_level_ofdm,
u8 *pwr_level_bw20, u8 *pwr_level_bw40,
-   u8 channel,u32 *ofdmbase, u32 *mcs_base)
+   u8 channel, u32 *ofdmbase, u32 *mcs_base)
 {
struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt);
u32 powerbase0, powerbase1;
diff --git a/drivers/staging/rtl8188eu/hal/rf_cfg.c 
b/drivers/staging/rtl8188eu/hal/rf_cfg.c
index ddc2f55..5dc11ca 100644
--- a/drivers/staging/rtl8188eu/hal/rf_cfg.c
+++ b/drivers/staging/rtl8188eu/hal/rf_cfg.c
@@ -164,7 +164,7 @@ do {
\
 #define B3WIREDATALENGTH 0x800
 #define BRFSI_RFENV 0x10
 
-static void rtl_rfreg_delay(struct adapter *adapt, enum rf_radio_path 
rfpath,u32 addr, u32 mask, u32 data)
+static void rtl_rfreg_delay(struct adapter *adapt, enum rf_radio_path rfpath, 
u32 addr, u32 mask, u32 data)
 {
if (addr == 0xfe) {
mdelay(50);
@@ -190,7 +190,7 @@ static void rtl8188e_config_rf_reg(struct adapter *adapt,
u32 content = 0x1000; /*RF Content: radio_a_txt*/
u32 maskforphyset = (u32)(content  0xE000);
 
-   rtl_rfreg_delay(adapt, RF90_PATH_A, addr| maskforphyset,
+   rtl_rfreg_delay(adapt, RF90_PATH_A, addr | maskforphyset,
RFREG_OFFSET_MASK,
data);
 }
-- 
1.9.3


Re: [PATCH] staging: comedi: (regression) channel list must be set for COMEDI_CMD ioctl

2014-10-09 Thread Ian Abbott

On 09/10/14 00:13, Hartley Sweeten wrote:

On Wednesday, October 08, 2014 8:09 AM, Ian Abbott wrote:

`do_cmd_ioctl()`, the handler for the `COMEDI_CMD` ioctl can incorrectly
call the Comedi subdevice's `do_cmd()` handler with a NULL channel list
pointer.  This is a regression as the `do_cmd()` handler has never been
expected to deal with that, leading to a kernel OOPS when it tries to
dereference it.

A NULL channel list pointer is allowed for the `COMEDI_CMDTEST` ioctl,
handled by `do_cmdtest_ioctl()` and the subdevice's `do_cmdtest()`
handler, but not for the `COMEDI_CMD` ioctl and its handlers.

Both `do_cmd_ioctl()` and `do_cmdtest_ioctl()` call
`__comedi_get_user_chanlist()` to copy the channel list from user memory
into dynamically allocated kernel memory and check it for consistency.
That function currently returns 0 if the `user_chanlist` parameter
(pointing to the channel list in user memory) is NULL.  That's fine for
`do_cmdtest_ioctl()`, but `do_cmd_ioctl()` incorrectly assumes the
kernel copy of the channel list has been set-up correctly.

Fix it by not allowing the `user_chanlist` parameter to be NULL in
`__comedi_get_user_chanlist()`, and only calling it from
`do_cmdtest_ioctl()` if the parameter is non-NULL.

Thanks to Bernd Porr for reporting the bug via an initial patch sent
privately.

Fixes: c6cd0eefb27b (staging: comedi: comedi_fops: introduce 
__comedi_get_user_chanlist())
Reported-by: Bernd Porr m...@berndporr.me.uk
Signed-off-by: Ian Abbott abbo...@mev.co.uk
Cc: Bernd Porr m...@berndporr.me.uk
Cc: sta...@vger.kernel.org # 3.15.y 3.16.y 3.17.y
---
  drivers/staging/comedi/comedi_fops.c | 15 +++
  1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 495969f..a9b7fe5 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1462,10 +1462,6 @@ static int __comedi_get_user_chanlist(struct 
comedi_device *dev,
unsigned int *chanlist;
int ret;

-   /* user_chanlist could be NULL for do_cmdtest ioctls */
-   if (!user_chanlist)
-   return 0;
-


I think you need a check here to avoid a NULL pointer getting
passed to the  memdup_user().

If (!user_chanlist || cmd-chanlist_len == 0)
return -EINVAL;


chanlist = memdup_user(user_chanlist,
   cmd-chanlist_len * sizeof(unsigned int));
if (IS_ERR(chanlist))


It's fine to pass a NULL pointer to memdup_user().  It won't succeed 
(returning ERR_PTR(-EFAULT)), but it's fine.


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


Re: [PATCH V2] staging: dgap: introduce dgap_stop()

2014-10-09 Thread Sudip Mukherjee
On Thu, Oct 09, 2014 at 01:40:11PM +0900, Daeseok Youn wrote:
 The dgap_init_module() need to unwind for cleanup variables properly.
 Because dgap_init_module() calls dgap_cleanup_module() for freeing
 variables but this function is possible to free variables
 which are not allocated.
 
 Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
 ---
 V2: change ulong which is non-standard to unsigned long.
I think , Dan, in his review of your v1 , asked you to rearrange the functions 
and get rid of the forward declarations.

thanks
sudip

 
  drivers/staging/dgap/dgap.c |   27 ++-
  1 files changed, 22 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
 index 7c79fe6..290ca3b 100644
 --- a/drivers/staging/dgap/dgap.c
 +++ b/drivers/staging/dgap/dgap.c
 @@ -71,6 +71,7 @@ MODULE_DESCRIPTION(Driver for the Digi International EPCA 
 PCI based product lin
  MODULE_SUPPORTED_DEVICE(dgap);
  
  static int dgap_start(void);
 +static void dgap_stop(void);
  static void dgap_init_globals(void);
  static struct board_t *dgap_found_board(struct pci_dev *pdev, int id,
   int boardnum);
 @@ -479,19 +480,20 @@ static int dgap_init_module(void)
  
   rc = pci_register_driver(dgap_driver);
   if (rc)
 - goto err_cleanup;
 + goto err_stop;
  
   rc = dgap_create_driver_sysfiles(dgap_driver);
   if (rc)
 - goto err_cleanup;
 + goto err_unregister;
  
   dgap_driver_state = DRIVER_READY;
  
   return 0;
  
 -err_cleanup:
 -
 - dgap_cleanup_module();
 +err_unregister:
 + pci_unregister_driver(dgap_driver);
 +err_stop:
 + dgap_stop();
  
   return rc;
  }
 @@ -561,6 +563,21 @@ failed_class:
   return rc;
  }
  
 +static void dgap_stop(void)
 +{
 + unsigned long lock_flags;
 +
 + spin_lock_irqsave(dgap_poll_lock, lock_flags);
 + dgap_poll_stop = 1;
 + spin_unlock_irqrestore(dgap_poll_lock, lock_flags);
 +
 + del_timer_sync(dgap_poll_timer);
 +
 + device_destroy(dgap_class, MKDEV(DIGI_DGAP_MAJOR, 0));
 + class_destroy(dgap_class);
 + unregister_chrdev(DIGI_DGAP_MAJOR, dgap);
 +}
 +
  static int dgap_init_one(struct pci_dev *pdev, const struct pci_device_id 
 *ent)
  {
   int rc;
 -- 
 1.7.1
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8188eu: Fix coding style error problems

2014-10-09 Thread Sudip Mukherjee
On Thu, Oct 09, 2014 at 05:03:07PM +0800, Jia He wrote:
 Signed-off-by: Jia He hejia...@gmail.com
 This fixes all coding style error problems at rtl8188eu which
 makes checkpatch.pl unhappy

your commit message should be above your Signed-off line.

mention what type of error you are fixing.

you are doing multiple types of error fix in this patch,
usually we do only a single type of fix in one patch and if you want
to do multiple fix then better send a series of patch , and in each patch
mention what type of error it fixes.

thanks
sudip

 ---
  drivers/staging/rtl8188eu/hal/bb_cfg.c | 4 ++--
  drivers/staging/rtl8188eu/hal/fw.c | 4 ++--
  drivers/staging/rtl8188eu/hal/phy.c| 2 +-
  drivers/staging/rtl8188eu/hal/rf.c | 4 ++--
  drivers/staging/rtl8188eu/hal/rf_cfg.c | 4 ++--
  5 files changed, 9 insertions(+), 9 deletions(-)
 
 diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c 
 b/drivers/staging/rtl8188eu/hal/bb_cfg.c
 index 80e8cc9..3743a72 100644
 --- a/drivers/staging/rtl8188eu/hal/bb_cfg.c
 +++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c
 @@ -173,7 +173,7 @@ static bool set_baseband_agc_config(struct adapter *adapt)
   u32 v1 = array[i];
   u32 v2 = array[i+1];
  
 - if (v1  0xCDCDCDCD){
 + if (v1  0xCDCDCDCD) {
   phy_set_bb_reg(adapt, v1, bMaskDWord, v2);
   udelay(1);
   }
 @@ -552,7 +552,7 @@ static void store_pwrindex_offset(struct adapter 
 *Adapter, u32 regaddr, u32 bitm
   }
  }
  
 -static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask 
 ,u32 data)
 +static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask , 
 u32 data)
  {
   if (addr == 0xfe) {
   msleep(50);
 diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
 b/drivers/staging/rtl8188eu/hal/fw.c
 index 17b7f37..d6efd54 100644
 --- a/drivers/staging/rtl8188eu/hal/fw.c
 +++ b/drivers/staging/rtl8188eu/hal/fw.c
 @@ -193,13 +193,13 @@ int rtl88eu_download_fw(struct adapter *adapt)
   u32 fwsize;
   int err;
  
 - if (request_firmware(fw, fw_name, device)){
 + if (request_firmware(fw, fw_name, device)) {
   dev_err(device, Firmware %s not available\n, fw_name);
   return -ENOENT;
   }
  
   if (fw-size  FW_8188E_SIZE) {
 - dev_err(device,Firmware size exceed 0x%X. Check it.\n,
 + dev_err(device, Firmware size exceed 0x%X. Check it.\n,
FW_8188E_SIZE);
   return -1;
   }
 diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
 b/drivers/staging/rtl8188eu/hal/phy.c
 index c4f7f35..3f663fe 100644
 --- a/drivers/staging/rtl8188eu/hal/phy.c
 +++ b/drivers/staging/rtl8188eu/hal/phy.c
 @@ -478,7 +478,7 @@ void 
 rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
   /* 2.4G, decrease power */
   {0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11},
   /* 2.4G, increase power */
 - {0, 0, -1, -2, -3, -4,-4, -4, -4, -5, -7, -8,-9, -9, -10},
 + {0, 0, -1, -2, -3, -4, -4, -4, -4, -5, -7, -8, -9, -9, -10},
   };
   u8 thermal_mapping[2][index_mapping_NUM_88E] = {
   /* 2.4G, decrease power */
 diff --git a/drivers/staging/rtl8188eu/hal/rf.c 
 b/drivers/staging/rtl8188eu/hal/rf.c
 index c2fac34..8e7a0b1 100644
 --- a/drivers/staging/rtl8188eu/hal/rf.c
 +++ b/drivers/staging/rtl8188eu/hal/rf.c
 @@ -102,7 +102,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter 
 *adapt, u8 *powerlevel)
   }
   }
   rtl88eu_dm_txpower_track_adjust(hal_data-odmpriv, 1, direction,
 - pwrtrac_value);
 + pwrtrac_value);
  
   if (direction == 1) {
   /*  Increase TX power */
 @@ -131,7 +131,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter 
 *adapt, u8 *powerlevel)
  /*  powerbase1 for HT MCS rates */
  static void getpowerbase88e(struct adapter *adapt, u8 *pwr_level_ofdm,
   u8 *pwr_level_bw20, u8 *pwr_level_bw40,
 - u8 channel,u32 *ofdmbase, u32 *mcs_base)
 + u8 channel, u32 *ofdmbase, u32 *mcs_base)
  {
   struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt);
   u32 powerbase0, powerbase1;
 diff --git a/drivers/staging/rtl8188eu/hal/rf_cfg.c 
 b/drivers/staging/rtl8188eu/hal/rf_cfg.c
 index ddc2f55..5dc11ca 100644
 --- a/drivers/staging/rtl8188eu/hal/rf_cfg.c
 +++ b/drivers/staging/rtl8188eu/hal/rf_cfg.c
 @@ -164,7 +164,7 @@ do {  
 \
  #define B3WIREDATALENGTH 0x800
  #define BRFSI_RFENV 0x10
  
 -static void rtl_rfreg_delay(struct adapter *adapt, enum rf_radio_path 
 rfpath,u32 addr, u32 mask, u32 data)
 +static void rtl_rfreg_delay(struct adapter *adapt, enum rf_radio_path 
 rfpath, u32 addr, u32 mask, u32 data)
  {
   if (addr == 0xfe) {
   

Re: [PATCH V2] staging: dgap: introduce dgap_stop()

2014-10-09 Thread Dan Carpenter
On Thu, Oct 09, 2014 at 03:19:03PM +0530, Sudip Mukherjee wrote:
 On Thu, Oct 09, 2014 at 01:40:11PM +0900, Daeseok Youn wrote:
  The dgap_init_module() need to unwind for cleanup variables properly.
  Because dgap_init_module() calls dgap_cleanup_module() for freeing
  variables but this function is possible to free variables
  which are not allocated.
  
  Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
  ---
  V2: change ulong which is non-standard to unsigned long.
 I think , Dan, in his review of your v1 , asked you to rearrange the 
 functions and get rid of the forward declarations.
 

I was fine with v1 actually...  It's a bug fix, and this is staging and
there are tons of forward declarations already.  Eventually we need to
get rid of them but it can be done later.

regards,
dan carpenter

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


[PATCH resend] staging, lustre: fix a sparse error

2014-10-09 Thread WANG Chao
This fixes the following sparse error:

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c:393:9: error:
incompatible types in comparison expression (different address spaces)

Signed-off-by: WANG Chao wangchao19890...@gmail.com
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
index 245c9d7..1510594 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
@@ -390,7 +390,7 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx)
__u32   csum;
void*base;
 
-   LASSERT(tx-tx_iov[0].iov_base == (void *)tx-tx_msg);
+   LASSERT((void __force *) tx-tx_iov[0].iov_base == (void *)tx-tx_msg);
LASSERT(tx-tx_conn != NULL);
LASSERT(tx-tx_conn-ksnc_proto == ksocknal_protocol_v2x);
 
-- 
1.9.3

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


Re: [PATCH V2] staging: dgap: introduce dgap_stop()

2014-10-09 Thread DaeSeok Youn
Hi,

2014-10-09 19:23 GMT+09:00 Dan Carpenter dan.carpen...@oracle.com:
 On Thu, Oct 09, 2014 at 03:19:03PM +0530, Sudip Mukherjee wrote:
 On Thu, Oct 09, 2014 at 01:40:11PM +0900, Daeseok Youn wrote:
  The dgap_init_module() need to unwind for cleanup variables properly.
  Because dgap_init_module() calls dgap_cleanup_module() for freeing
  variables but this function is possible to free variables
  which are not allocated.
 
  Signed-off-by: Daeseok Youn daeseok.y...@gmail.com
  ---
  V2: change ulong which is non-standard to unsigned long.
 I think , Dan, in his review of your v1 , asked you to rearrange the 
 functions and get rid of the forward declarations.


 I was fine with v1 actually...  It's a bug fix, and this is staging and
 there are tons of forward declarations already.  Eventually we need to
 get rid of them but it can be done later.
Yes, I will cleanup as your review.

thanks.

regards,
Daeseok Youn.


 regards,
 dan carpenter

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


Re: [PATCH 01/44] kernel: Add support for poweroff handler call chain

2014-10-09 Thread Pavel Machek
Hi!

 +/**
 + *   register_poweroff_handler_simple - Register function to be called to 
 power off
 + *  the system
 + *   @handler:   Function to be called to power off the system
 + *   @priority:  Handler priority. For priority guidelines see
 + *   register_poweroff_handler.
 + *
 + *   This is a simplified version of register_poweroff_handler. It does not
 + *   take a notifier as argument, but a function pointer. The function
 + *   registers a poweroff handler with specified priority. Poweroff
 + *   handlers registered with this function can not be unregistered,
 + *   and only a single poweroff handler can be installed using it.
 + *
 + *   This function must not be called from modules and is therefore
 + *   not exported.
 + *
 + *   Returns -EBUSY if a poweroff handler has already been registered
 + *   using register_poweroff_handler_simple. Otherwise returns zero,
 + *   since atomic_notifier_chain_register() currently always returns zero.
 + */
 +int register_poweroff_handler_simple(void (*handler)(void), int priority)
 +{
 + char symname[KSYM_NAME_LEN];
 +
 + if (poweroff_handler_data.handler) {
 + lookup_symbol_name((unsigned long)poweroff_handler_data.handler,
 +symname);
 + pr_warn(Poweroff function already registered (%s), symname);
 + lookup_symbol_name((unsigned long)handler, symname);
 + pr_cont(, cannot register %s\n, symname);
 + return -EBUSY;
 + }

Dunno, are you maybe overdoing the debugging infrastructure a bit?
This is not going to happen in production, and if it does happen,
developer can look the symbol name himself.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 03/44] hibernate: Call have_kernel_poweroff instead of checking pm_power_off

2014-10-09 Thread Pavel Machek
On Mon 2014-10-06 22:28:05, Guenter Roeck wrote:
 Poweroff handlers may now be installed with register_poweroff_handler.
 Use the new API function have_kernel_poweroff to determine if a poweroff
 handler has been installed.
 
 Cc: Rafael J. Wysocki r...@rjwysocki.net
 Cc: Pavel Machek pa...@ucw.cz
 Cc: Len Brown len.br...@intel.com
 Signed-off-by: Guenter Roeck li...@roeck-us.net
 ---
  kernel/power/hibernate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
 index a9dfa79..20353c5 100644
 --- a/kernel/power/hibernate.c
 +++ b/kernel/power/hibernate.c
 @@ -602,7 +602,7 @@ static void power_down(void)
   case HIBERNATION_PLATFORM:
   hibernation_platform_enter();
   case HIBERNATION_SHUTDOWN:
 - if (pm_power_off)
 + if (have_kernel_poweroff())
   kernel_power_off();
   break;

poweroff - power_off.

But if you are playing with this, anyway... does it make sense to
introduce kernel_power_off() that just works, no need to check
have_..?
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 08/44] kernel: Move pm_power_off to common code

2014-10-09 Thread Vineet Gupta
On Tuesday 07 October 2014 11:01 AM, Guenter Roeck wrote:

diff --git a/arch/arc/kernel/reset.c b/arch/arc/kernel/reset.c
index 2768fa1..8a4fc47 100644
--- a/arch/arc/kernel/reset.c
+++ b/arch/arc/kernel/reset.c
@@ -26,9 +26,6 @@ void machine_restart(char *__unused)

 void machine_power_off(void)
 {
-   /* FIXME ::  power off ??? */
+   do_kernel_poweroff();
machine_halt();
 }
-
-void (*pm_power_off) (void) = NULL;
-EXPORT_SYMBOL(pm_power_off);

Acked-by: Vineet Gupta vgu...@synopsys.commailto:vgu...@synopsys.com

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


Re: [PATCH 12/44] mfd: ab8500-sysctrl: Register with kernel poweroff handler

2014-10-09 Thread Catalin Marinas
On Tue, Oct 07, 2014 at 09:00:48AM +0100, Lee Jones wrote:
 On Mon, 06 Oct 2014, Guenter Roeck wrote:
  --- a/drivers/mfd/ab8500-sysctrl.c
  +++ b/drivers/mfd/ab8500-sysctrl.c
  @@ -6,6 +6,7 @@
 
 [...]
 
  +static int ab8500_power_off(struct notifier_block *this, unsigned long 
  unused1,
  +   void *unused2)
   {
  sigset_t old;
  sigset_t all;
  @@ -34,11 +36,6 @@ static void ab8500_power_off(void)
  struct power_supply *psy;
  int ret;
   
  -   if (sysctrl_dev == NULL) {
  -   pr_err(%s: sysctrl not initialized\n, __func__);
  -   return;
  -   }
 
 Can you explain the purpose of this change please?

I guess it's because the sysctrl_dev is already initialised when
registering the power_off handler, so there isn't a way to call the
above function with a NULL sysctrl_dev. Probably even with the original
code you didn't need this check (after some race fix in
ab8500_sysctrl_remove but races is one of the things Guenter's patches
try to address).

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


Re: [PATCH 08/44] kernel: Move pm_power_off to common code

2014-10-09 Thread Catalin Marinas
On Tue, Oct 07, 2014 at 06:28:10AM +0100, Guenter Roeck wrote:
 diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
 index e0ef8ba..db396bb 100644
 --- a/arch/arm64/kernel/process.c
 +++ b/arch/arm64/kernel/process.c
 @@ -94,8 +94,6 @@ void soft_restart(unsigned long addr)
  /*
   * Function pointers to optional machine specific functions
   */
 -void (*pm_power_off)(void);
 -EXPORT_SYMBOL_GPL(pm_power_off);
 
  void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
 
 @@ -155,8 +153,7 @@ void machine_power_off(void)
  {
 local_irq_disable();
 smp_send_stop();
 -   if (pm_power_off)
 -   pm_power_off();
 +   do_kernel_poweroff();
  }

Acked-by: Catalin Marinas catalin.mari...@arm.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 08/44] kernel: Move pm_power_off to common code

2014-10-09 Thread Pavel Machek
Hi!

 @@ -184,6 +179,8 @@ machine_halt(void)
  void
  machine_power_off(void)
  {
 + do_kernel_poweroff();
 +

poweroff - power_off for consistency.


 index c4f50a3..1da27d1 100644
 --- a/arch/blackfin/kernel/reboot.c
 +++ b/arch/blackfin/kernel/reboot.c
 @@ -106,6 +107,7 @@ void machine_halt(void)
  __attribute__((weak))
  void native_machine_power_off(void)
  {
 + do_kernel_poweroff();
   idle_with_irq_disabled();
  }


So here we handle do_kernel_poweroff() returning,

 diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
 index b78498e..eaafad0 100644
 --- a/arch/cris/kernel/process.c
 +++ b/arch/cris/kernel/process.c
 @@ -60,6 +57,7 @@ void machine_halt(void)
  
  void machine_power_off(void)
  {
 + do_kernel_poweroff();
  }



Here we don't.

 diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
 index 5d40aeb77..a673725 100644
 --- a/arch/frv/kernel/process.c
 +++ b/arch/frv/kernel/process.c
 @@ -107,6 +104,8 @@ void machine_power_off(void)
   gdbstub_exit(0);
  #endif
  
 + do_kernel_poweroff();
 +
   for (;;);
  }
  

And here we do.

What is right?
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 32/44] arm64: psci: Register with kernel poweroff handler

2014-10-09 Thread Catalin Marinas
On Tue, Oct 07, 2014 at 06:28:34AM +0100, Guenter Roeck wrote:
 Register with kernel poweroff handler instead of setting pm_power_off
 directly.
 
 Cc: Catalin Marinas catalin.mari...@arm.com
 Cc: Will Deacon will.dea...@arm.com
 Signed-off-by: Guenter Roeck li...@roeck-us.net
 ---
  arch/arm64/kernel/psci.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
 index 5539547..c1f3d09 100644
 --- a/arch/arm64/kernel/psci.c
 +++ b/arch/arm64/kernel/psci.c
 @@ -286,7 +286,7 @@ static int __init psci_0_2_init(struct device_node *np)
  
   arm_pm_restart = psci_sys_reset;
  
 - pm_power_off = psci_sys_poweroff;
 + register_poweroff_handler_simple(psci_sys_poweroff, 128);
  
  out_put_node:
   of_node_put(np);

Acked-by: Catalin Marinas catalin.mari...@arm.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 12/44] mfd: ab8500-sysctrl: Register with kernel poweroff handler

2014-10-09 Thread Lee Jones
On Thu, 09 Oct 2014, Catalin Marinas wrote:

 On Tue, Oct 07, 2014 at 09:00:48AM +0100, Lee Jones wrote:
  On Mon, 06 Oct 2014, Guenter Roeck wrote:
   --- a/drivers/mfd/ab8500-sysctrl.c
   +++ b/drivers/mfd/ab8500-sysctrl.c
   @@ -6,6 +6,7 @@
  
  [...]
  
   +static int ab8500_power_off(struct notifier_block *this, unsigned long 
   unused1,
   + void *unused2)
{
 sigset_t old;
 sigset_t all;
   @@ -34,11 +36,6 @@ static void ab8500_power_off(void)
 struct power_supply *psy;
 int ret;

   - if (sysctrl_dev == NULL) {
   - pr_err(%s: sysctrl not initialized\n, __func__);
   - return;
   - }
  
  Can you explain the purpose of this change please?
 
 I guess it's because the sysctrl_dev is already initialised when
 registering the power_off handler, so there isn't a way to call the
 above function with a NULL sysctrl_dev. Probably even with the original
 code you didn't need this check (after some race fix in
 ab8500_sysctrl_remove but races is one of the things Guenter's patches
 try to address).

Sounds reasonable, although I think this change should be part of
another patch.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/44] kernel: Add support for poweroff handler call chain

2014-10-09 Thread Geert Uytterhoeven
On Tue, Oct 7, 2014 at 7:28 AM, Guenter Roeck li...@roeck-us.net wrote:
 +int register_poweroff_handler_simple(void (*handler)(void), int priority)
 +{
 +   char symname[KSYM_NAME_LEN];
 +
 +   if (poweroff_handler_data.handler) {
 +   lookup_symbol_name((unsigned 
 long)poweroff_handler_data.handler,
 +  symname);
 +   pr_warn(Poweroff function already registered (%s), symname);
 +   lookup_symbol_name((unsigned long)handler, symname);
 +   pr_cont(, cannot register %s\n, symname);

Doesn't %ps work to look up symbols?

pr_warn(Poweroff function already registered (%ps), cannot register
%ps\n, poweroff_handler_data.handler, handler);

 +   return -EBUSY;
 +   }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH resend] staging, lustre: fix a sparse error

2014-10-09 Thread Sudip Mukherjee
On Thu, Oct 09, 2014 at 06:25:10PM +0800, WANG Chao wrote:
 This fixes the following sparse error:
 
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c:393:9: error:
 incompatible types in comparison expression (different address spaces)
 
 Signed-off-by: WANG Chao wangchao19890...@gmail.com
 ---
  drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c 
 b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
 index 245c9d7..1510594 100644
 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
 +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
 @@ -390,7 +390,7 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx)
   __u32   csum;
   void*base;
  
 - LASSERT(tx-tx_iov[0].iov_base == (void *)tx-tx_msg);
 + LASSERT((void __force *) tx-tx_iov[0].iov_base == (void *)tx-tx_msg);
is it ok? are you not just suppressing the sparse error?
iov_base is void __user *  

thanks
sudip

   LASSERT(tx-tx_conn != NULL);
   LASSERT(tx-tx_conn-ksnc_proto == ksocknal_protocol_v2x);
  
 -- 
 1.9.3
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] imx-drm: currently only IPUv3 is supported, make it mandatory

2014-10-09 Thread Philipp Zabel
As long as only IPUv3 is supported in imx-drm, hide the separate
DRM_IMX_IPUV3 option and make DRM_IMX depend on IMX_IPUV3_CORE.

Reported-by: Michael Olbrich m.olbr...@pengutronix.de
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/staging/imx-drm/Kconfig | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/imx-drm/Kconfig b/drivers/staging/imx-drm/Kconfig
index 82fb758..ab31848 100644
--- a/drivers/staging/imx-drm/Kconfig
+++ b/drivers/staging/imx-drm/Kconfig
@@ -6,6 +6,7 @@ config DRM_IMX
select DRM_GEM_CMA_HELPER
select DRM_KMS_CMA_HELPER
depends on DRM  (ARCH_MXC || ARCH_MULTIPLATFORM)
+   depends on IMX_IPUV3_CORE
help
  enable i.MX graphics support
 
@@ -40,11 +41,11 @@ config DRM_IMX_LDB
  found on i.MX53 and i.MX6 processors.
 
 config DRM_IMX_IPUV3
-   tristate DRM Support for i.MX IPUv3
+   tristate
depends on DRM_IMX
depends on IMX_IPUV3_CORE
-   help
- Choose this if you have a i.MX5 or i.MX6 processor.
+   default y if DRM_IMX=y
+   default m if DRM_IMX=m
 
 config DRM_IMX_HDMI
tristate Freescale i.MX DRM HDMI
-- 
2.1.0

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


Re: [PATCH 03/44] hibernate: Call have_kernel_poweroff instead of checking pm_power_off

2014-10-09 Thread Guenter Roeck

On 10/09/2014 03:32 AM, Pavel Machek wrote:

On Mon 2014-10-06 22:28:05, Guenter Roeck wrote:

Poweroff handlers may now be installed with register_poweroff_handler.
Use the new API function have_kernel_poweroff to determine if a poweroff
handler has been installed.

Cc: Rafael J. Wysocki r...@rjwysocki.net
Cc: Pavel Machek pa...@ucw.cz
Cc: Len Brown len.br...@intel.com
Signed-off-by: Guenter Roeck li...@roeck-us.net
---
  kernel/power/hibernate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index a9dfa79..20353c5 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -602,7 +602,7 @@ static void power_down(void)
case HIBERNATION_PLATFORM:
hibernation_platform_enter();
case HIBERNATION_SHUTDOWN:
-   if (pm_power_off)
+   if (have_kernel_poweroff())
kernel_power_off();
break;


poweroff - power_off.


As mentioned in my other reply, that was on purpose to distinguish
existing functions from poweroff handler functions.


But if you are playing with this, anyway... does it make sense to
introduce kernel_power_off() that just works, no need to check
have_..?
Pavel


I am trying not to change existing behavior.

kernel_power_off is an existing function which does some cleanup
before calling machine_power_off which in turn calls do_kernel_poweroff
(or currently pm_power_off and may do some other machine specific stuff.

Sure, poweroff handling could be unified further. We could decide to
enter an endless loop if machine_power_off() returns, or we could decide
to dump a warning or panic in this case. But that is all separate from
the issue I am trying to solve here, which is to provide a capability to
register more than one poweroff handler. It would also not be that simple,
since some architectures call machine_power_off() directly from various
places.

Guenter

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


Re: [PATCH 12/44] mfd: ab8500-sysctrl: Register with kernel poweroff handler

2014-10-09 Thread Guenter Roeck

On 10/09/2014 03:49 AM, Lee Jones wrote:

On Thu, 09 Oct 2014, Catalin Marinas wrote:


On Tue, Oct 07, 2014 at 09:00:48AM +0100, Lee Jones wrote:

On Mon, 06 Oct 2014, Guenter Roeck wrote:

--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -6,6 +6,7 @@


[...]


+static int ab8500_power_off(struct notifier_block *this, unsigned long unused1,
+   void *unused2)
  {
sigset_t old;
sigset_t all;
@@ -34,11 +36,6 @@ static void ab8500_power_off(void)
struct power_supply *psy;
int ret;

-   if (sysctrl_dev == NULL) {
-   pr_err(%s: sysctrl not initialized\n, __func__);
-   return;
-   }


Can you explain the purpose of this change please?


I guess it's because the sysctrl_dev is already initialised when
registering the power_off handler, so there isn't a way to call the
above function with a NULL sysctrl_dev. Probably even with the original
code you didn't need this check (after some race fix in
ab8500_sysctrl_remove but races is one of the things Guenter's patches
try to address).


Sounds reasonable, although I think this change should be part of
another patch.


Sure, no problem. I'll split this into two patches.

Since we are at it, any idea what to do with the restart function
in the same file ? It is not used anywhere.

Guenter

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


Re: [PATCH 01/44] kernel: Add support for poweroff handler call chain

2014-10-09 Thread Guenter Roeck

On 10/09/2014 04:31 AM, Geert Uytterhoeven wrote:

On Tue, Oct 7, 2014 at 7:28 AM, Guenter Roeck li...@roeck-us.net wrote:

+int register_poweroff_handler_simple(void (*handler)(void), int priority)
+{
+   char symname[KSYM_NAME_LEN];
+
+   if (poweroff_handler_data.handler) {
+   lookup_symbol_name((unsigned long)poweroff_handler_data.handler,
+  symname);
+   pr_warn(Poweroff function already registered (%s), symname);
+   lookup_symbol_name((unsigned long)handler, symname);
+   pr_cont(, cannot register %s\n, symname);


Doesn't %ps work to look up symbols?

pr_warn(Poweroff function already registered (%ps), cannot register
%ps\n, poweroff_handler_data.handler, handler);



Hi Geert,

That is great. One never stops learning. I'll use that.

Thanks!

Guenter

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


Re: [PATCH net 1/1] hyperv: Fix a bug in netvsc_send()

2014-10-09 Thread Sitsofe Wheeler
On Sun, Oct 05, 2014 at 09:11:29PM -0400, David Miller wrote:
 From: K. Y. Srinivasan k...@microsoft.com
 Date: Sun,  5 Oct 2014 10:42:51 -0700
 
  After the packet is successfully sent, we should not touch the packet 
  as it may have been freed. This patch is based on the work done by
  Long Li lon...@microsoft.com.
  
  David, please queue this up for stable.

With 3.17.0 g782d59c (which should include this patch) I'm still seeing
the following:

Oct 09 13:14:51 a network[428]: Bringing up interface eth0:
Oct 09 13:14:51 a dhclient[538]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 
(xid=0x1dd33078)
Oct 09 13:14:51 a dhclient[538]: DHCPACK from 10.x.x.x (xid=0x1dd33078)
Oct 09 13:14:55 a kernel: BUG: unable to handle kernel paging request at 
8800ed2e72e3
Oct 09 13:14:55 a kernel: IP: [814ede1d] 
netvsc_select_queue+0x3d/0x150
Oct 09 13:14:55 a kernel: PGD 2db5067 PUD 2075be067 PMD 207454067 PTE 
8000ed2e7060
Oct 09 13:14:55 a kernel: Oops:  [#1] SMP DEBUG_PAGEALLOC
Oct 09 13:14:55 a kernel: CPU: 6 PID: 566 Comm: arping Not tainted 
3.17.0.x86_64-05585-g782d59c #147
Oct 09 13:14:55 a kernel: Hardware name: Microsoft Corporation Virtual 
Machine/Virtual Machine, BIOS 090006  05/23/2012
Oct 09 13:14:55 a kernel: task: 8801f978b9f0 ti: 8801f3b84000 task.ti: 
8801f3b84000
Oct 09 13:14:55 a kernel: RIP: 0010:[814ede1d]  [814ede1d] 
netvsc_select_queue+0x3d/0x150
Oct 09 13:14:55 a kernel: RSP: 0018:8801f3b87c60  EFLAGS: 00010202
Oct 09 13:14:55 a kernel: RAX:  RBX: 8800f13e8000 RCX: 

Oct 09 13:14:55 a kernel: RDX: 8800ed2d72d8 RSI: 8801fabca1c0 RDI: 
8800f13e8000
Oct 09 13:14:55 a kernel: RBP: 8801f3b87c88 R08: 002a R09: 

Oct 09 13:14:55 a kernel: R10: 8801f83b3f60 R11: 0008 R12: 
8801fabca1c0
Oct 09 13:14:55 a kernel: R13:  R14: 8800ed359bd8 R15: 
8801fabca1c0
Oct 09 13:14:55 a kernel: FS:  7f943a5c9740() GS:880206cc() 
knlGS:
Oct 09 13:14:55 a kernel: CS:  0010 DS:  ES:  CR0: 80050033
Oct 09 13:14:55 a kernel: CR2: 8800ed2e72e3 CR3: 0001f3957000 CR4: 
000406e0
Oct 09 13:14:55 a kernel: Stack:
Oct 09 13:14:55 a kernel:  816a0221 8800f13e8000 001c 

Oct 09 13:14:55 a kernel:  8800ed359bd8 8801f3b87d48 816a3fce 
8801f3b87cb0
Oct 09 13:14:55 a kernel:  816c34a7 0001 8801f3b87db8 
001c
Oct 09 13:14:55 a kernel: Call Trace:
Oct 09 13:14:55 a kernel:  [816a0221] ? packet_pick_tx_queue+0x31/0xa0
Oct 09 13:14:55 a kernel:  [816a3fce] packet_sendmsg+0xc6e/0xe30
Oct 09 13:14:55 a kernel:  [816c34a7] ? _raw_spin_unlock+0x27/0x40
Oct 09 13:14:55 a kernel:  [81091bba] ? prepare_creds+0x3a/0x170
Oct 09 13:14:55 a kernel:  [815d2e08] sock_sendmsg+0x88/0xb0
Oct 09 13:14:55 a kernel:  [81188f83] ? might_fault+0xa3/0xb0
Oct 09 13:14:55 a kernel:  [81188f3a] ? might_fault+0x5a/0xb0
Oct 09 13:14:55 a kernel:  [815d2f3e] SYSC_sendto+0x10e/0x150
Oct 09 13:14:55 a kernel:  [81188f3a] ? might_fault+0x5a/0xb0
Oct 09 13:14:55 a kernel:  [816c41d5] ? sysret_check+0x22/0x5d
Oct 09 13:14:55 a kernel:  [810ba3fd] ? 
trace_hardirqs_on_caller+0x17d/0x210
Oct 09 13:14:55 a kernel:  [813a20ee] ? 
trace_hardirqs_on_thunk+0x3a/0x3f
Oct 09 13:14:55 a kernel:  [815d3f1e] SyS_sendto+0xe/0x10
Oct 09 13:14:55 a kernel:  [816c41a9] system_call_fastpath+0x16/0x1b
Oct 09 13:14:55 a kernel: Code: 00 4d 85 d2 0f 84 1c 01 00 00 44 8b 9f 8c 03 00 
00 31 c0 41 83 fb 01 0f 86 1b 01 00 00 0f b7 8e b6 00 00 00 
Oct 09 13:14:55 a kernel: RIP  [814ede1d] 
netvsc_select_queue+0x3d/0x150
Oct 09 13:14:55 a kernel:  RSP 8801f3b87c60
Oct 09 13:14:55 a kernel: CR2: 8800ed2e72e3
Oct 09 13:14:55 a kernel: ---[ end trace e52f922dd7435e0d ]---

Was the above meant to have been fixed by the patch [PATCH 1/1]
Drivers: net: hyperv: Cleanup  netvsc_change_mtu () from
https://lkml.org/lkml/2014/8/29/369 ? If so will that patch be resent?

-- 
Sitsofe | http://sucs.org/~sits/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 12/44] mfd: ab8500-sysctrl: Register with kernel poweroff handler

2014-10-09 Thread Lee Jones
On Thu, 09 Oct 2014, Guenter Roeck wrote:

 On 10/09/2014 03:49 AM, Lee Jones wrote:
 On Thu, 09 Oct 2014, Catalin Marinas wrote:
 
 On Tue, Oct 07, 2014 at 09:00:48AM +0100, Lee Jones wrote:
 On Mon, 06 Oct 2014, Guenter Roeck wrote:
 --- a/drivers/mfd/ab8500-sysctrl.c
 +++ b/drivers/mfd/ab8500-sysctrl.c
 @@ -6,6 +6,7 @@
 
 [...]
 
 +static int ab8500_power_off(struct notifier_block *this, unsigned long 
 unused1,
 + void *unused2)
   {
   sigset_t old;
   sigset_t all;
 @@ -34,11 +36,6 @@ static void ab8500_power_off(void)
   struct power_supply *psy;
   int ret;
 
 - if (sysctrl_dev == NULL) {
 - pr_err(%s: sysctrl not initialized\n, __func__);
 - return;
 - }
 
 Can you explain the purpose of this change please?
 
 I guess it's because the sysctrl_dev is already initialised when
 registering the power_off handler, so there isn't a way to call the
 above function with a NULL sysctrl_dev. Probably even with the original
 code you didn't need this check (after some race fix in
 ab8500_sysctrl_remove but races is one of the things Guenter's patches
 try to address).
 
 Sounds reasonable, although I think this change should be part of
 another patch.
 
 Sure, no problem. I'll split this into two patches.
 
 Since we are at it, any idea what to do with the restart function
 in the same file ? It is not used anywhere.

You can strip it out with Linus Walleij's Ack.  Or I'll be happy to do
it?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 08/44] kernel: Move pm_power_off to common code

2014-10-09 Thread Guenter Roeck

On 10/09/2014 03:38 AM, Pavel Machek wrote:

Hi!


@@ -184,6 +179,8 @@ machine_halt(void)
  void
  machine_power_off(void)
  {
+   do_kernel_poweroff();
+


poweroff - power_off for consistency.


Dunno; matter of personal preference. I started with that, but ultimately went
with poweroff to distinguish poweroff handler functions from existing code,
specifically kernel_power_off().

Does anyone else have an opinion ?




index c4f50a3..1da27d1 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -106,6 +107,7 @@ void machine_halt(void)
  __attribute__((weak))
  void native_machine_power_off(void)
  {
+   do_kernel_poweroff();
idle_with_irq_disabled();
  }



So here we handle do_kernel_poweroff() returning,


diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index b78498e..eaafad0 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -60,6 +57,7 @@ void machine_halt(void)

  void machine_power_off(void)
  {
+   do_kernel_poweroff();
  }




Here we don't.


diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 5d40aeb77..a673725 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -107,6 +104,8 @@ void machine_power_off(void)
gdbstub_exit(0);
  #endif

+   do_kernel_poweroff();
+
for (;;);
  }



And here we do.

What is right?
Pavel


Up to the architecture maintainer to decide. My goal was to not change
existing behavior if no poweroff handler is registered.

Guenter

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


[PATCH 0/2] staging: rtl8188eu: Fix a series of coding style problems

2014-10-09 Thread Jia He
This fixes all coding style error problems at rtl8188eu which
makes checkpatch.pl unhappy

Jia He (2):
  staging: rtl8188eu: Fix coding style space missing problems
  staging: rtl8188eu: Fix coding style not using tab problem

 drivers/staging/rtl8188eu/hal/bb_cfg.c | 4 ++--
 drivers/staging/rtl8188eu/hal/fw.c | 4 ++--
 drivers/staging/rtl8188eu/hal/phy.c| 2 +-
 drivers/staging/rtl8188eu/hal/rf.c | 4 ++--
 drivers/staging/rtl8188eu/hal/rf_cfg.c | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

-- 
1.9.3

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


[PATCH 2/2] staging: rtl8188eu: Fix coding style not using tab problem

2014-10-09 Thread Jia He
This fixes ERROR: code indent should use tabs where possible

Signed-off-by: Jia He hejia...@gmail.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/rtl8188eu/hal/rf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/rf.c 
b/drivers/staging/rtl8188eu/hal/rf.c
index eea4c8a..8e7a0b1 100644
--- a/drivers/staging/rtl8188eu/hal/rf.c
+++ b/drivers/staging/rtl8188eu/hal/rf.c
@@ -102,7 +102,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter 
*adapt, u8 *powerlevel)
}
}
rtl88eu_dm_txpower_track_adjust(hal_data-odmpriv, 1, direction,
-   pwrtrac_value);
+   pwrtrac_value);
 
if (direction == 1) {
/*  Increase TX power */
-- 
1.9.3

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


[PATCH 1/2] staging: rtl8188eu: Fix coding style space missing problems

2014-10-09 Thread Jia He
This fixes space missing problems,eg. before '-', after ',', around
'|'

Signed-off-by: Jia He hejia...@gmail.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/rtl8188eu/hal/bb_cfg.c | 4 ++--
 drivers/staging/rtl8188eu/hal/fw.c | 4 ++--
 drivers/staging/rtl8188eu/hal/phy.c| 2 +-
 drivers/staging/rtl8188eu/hal/rf.c | 2 +-
 drivers/staging/rtl8188eu/hal/rf_cfg.c | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/bb_cfg.c 
b/drivers/staging/rtl8188eu/hal/bb_cfg.c
index 80e8cc9..3743a72 100644
--- a/drivers/staging/rtl8188eu/hal/bb_cfg.c
+++ b/drivers/staging/rtl8188eu/hal/bb_cfg.c
@@ -173,7 +173,7 @@ static bool set_baseband_agc_config(struct adapter *adapt)
u32 v1 = array[i];
u32 v2 = array[i+1];
 
-   if (v1  0xCDCDCDCD){
+   if (v1  0xCDCDCDCD) {
phy_set_bb_reg(adapt, v1, bMaskDWord, v2);
udelay(1);
}
@@ -552,7 +552,7 @@ static void store_pwrindex_offset(struct adapter *Adapter, 
u32 regaddr, u32 bitm
}
 }
 
-static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask ,u32 
data)
+static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask , u32 
data)
 {
if (addr == 0xfe) {
msleep(50);
diff --git a/drivers/staging/rtl8188eu/hal/fw.c 
b/drivers/staging/rtl8188eu/hal/fw.c
index 17b7f37..d6efd54 100644
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -193,13 +193,13 @@ int rtl88eu_download_fw(struct adapter *adapt)
u32 fwsize;
int err;
 
-   if (request_firmware(fw, fw_name, device)){
+   if (request_firmware(fw, fw_name, device)) {
dev_err(device, Firmware %s not available\n, fw_name);
return -ENOENT;
}
 
if (fw-size  FW_8188E_SIZE) {
-   dev_err(device,Firmware size exceed 0x%X. Check it.\n,
+   dev_err(device, Firmware size exceed 0x%X. Check it.\n,
 FW_8188E_SIZE);
return -1;
}
diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index c4f7f35..3f663fe 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -478,7 +478,7 @@ void 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
/* 2.4G, decrease power */
{0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11},
/* 2.4G, increase power */
-   {0, 0, -1, -2, -3, -4,-4, -4, -4, -5, -7, -8,-9, -9, -10},
+   {0, 0, -1, -2, -3, -4, -4, -4, -4, -5, -7, -8, -9, -9, -10},
};
u8 thermal_mapping[2][index_mapping_NUM_88E] = {
/* 2.4G, decrease power */
diff --git a/drivers/staging/rtl8188eu/hal/rf.c 
b/drivers/staging/rtl8188eu/hal/rf.c
index c2fac34..eea4c8a 100644
--- a/drivers/staging/rtl8188eu/hal/rf.c
+++ b/drivers/staging/rtl8188eu/hal/rf.c
@@ -131,7 +131,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter 
*adapt, u8 *powerlevel)
 /*  powerbase1 for HT MCS rates */
 static void getpowerbase88e(struct adapter *adapt, u8 *pwr_level_ofdm,
u8 *pwr_level_bw20, u8 *pwr_level_bw40,
-   u8 channel,u32 *ofdmbase, u32 *mcs_base)
+   u8 channel, u32 *ofdmbase, u32 *mcs_base)
 {
struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt);
u32 powerbase0, powerbase1;
diff --git a/drivers/staging/rtl8188eu/hal/rf_cfg.c 
b/drivers/staging/rtl8188eu/hal/rf_cfg.c
index ddc2f55..5dc11ca 100644
--- a/drivers/staging/rtl8188eu/hal/rf_cfg.c
+++ b/drivers/staging/rtl8188eu/hal/rf_cfg.c
@@ -164,7 +164,7 @@ do {
\
 #define B3WIREDATALENGTH 0x800
 #define BRFSI_RFENV 0x10
 
-static void rtl_rfreg_delay(struct adapter *adapt, enum rf_radio_path 
rfpath,u32 addr, u32 mask, u32 data)
+static void rtl_rfreg_delay(struct adapter *adapt, enum rf_radio_path rfpath, 
u32 addr, u32 mask, u32 data)
 {
if (addr == 0xfe) {
mdelay(50);
@@ -190,7 +190,7 @@ static void rtl8188e_config_rf_reg(struct adapter *adapt,
u32 content = 0x1000; /*RF Content: radio_a_txt*/
u32 maskforphyset = (u32)(content  0xE000);
 
-   rtl_rfreg_delay(adapt, RF90_PATH_A, addr| maskforphyset,
+   rtl_rfreg_delay(adapt, RF90_PATH_A, addr | maskforphyset,
RFREG_OFFSET_MASK,
data);
 }
-- 
1.9.3

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


Please reply

2014-10-09 Thread Jose Calvache
Dear Sir/Madam, Here is a pdf attachment of my proposal to you. Please
read and reply I would be grateful. Jose Calvache

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


[PATCH] staging: rtl8192e: Fix pointer type declaration style errors

2014-10-09 Thread John Ledbetter
This fixes the following checkpatch.pl errors:

drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1290 error: foo* bar
should be foo *bar

drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c:1305 error: foo * bar
should be foo *bar

Signed-off-by: John Ledbetter j...@throttle.io
---
 drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c 
b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 0ffed2d..552d943 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -1287,7 +1287,7 @@ void  rtl8192_tx_fill_desc(struct net_device *dev, struct 
tx_desc *pdesc,
 
 void  rtl8192_tx_fill_cmd_desc(struct net_device *dev,
   struct tx_desc_cmd *entry,
-  struct cb_desc *cb_desc, struct sk_buff* skb)
+  struct cb_desc *cb_desc, struct sk_buff *skb)
 {
struct r8192_priv *priv = rtllib_priv(dev);
dma_addr_t mapping = pci_map_single(priv-pdev, skb-data, skb-len,
@@ -1302,7 +1302,7 @@ void  rtl8192_tx_fill_cmd_desc(struct net_device *dev,
if (cb_desc-bCmdOrInit == DESC_PACKET_TYPE_INIT) {
entry-CmdInit = DESC_PACKET_TYPE_INIT;
} else {
-   struct tx_desc * entry_tmp = (struct tx_desc *)entry;
+   struct tx_desc *entry_tmp = (struct tx_desc *)entry;
 
entry_tmp-CmdInit = DESC_PACKET_TYPE_NORMAL;
entry_tmp-Offset = sizeof(struct tx_fwinfo_8190pci) + 8;
-- 
2.1.2

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


Re: [PATCH] staging: rtl8188eu: coding style fixup

2014-10-09 Thread Greg KH
On Thu, Oct 09, 2014 at 10:30:06AM +0400, Igor Bogomazov wrote:
 checkpatch.pl tiny fix
 get rid of 2 warnings and 2 errors for hal/fw.c

What warnings?  What errors?  Be specific please.

 

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


Re: [PATCH V3] Staging: rtl8712 removed unnecessary else after return

2014-10-09 Thread Nitin Kuppelur
Hi Greg,

Sorry for noob question. I am still new to Kernel development.

I understood from your comment that the patch did not apply cleanly to
your tree (may be due to change in the code which I have modified)

But what should I do after this?
1) Send patch on rebased file to same mail chain with (--in-reply-to)
and [PATCH V4] ? OR
2) Create new PATCH and start new mail chain done on latest code.

Regards,
Nitin

On Thu, Oct 9, 2014 at 4:14 AM, Greg KH gre...@linuxfoundation.org wrote:
 On Thu, Oct 02, 2014 at 02:32:26PM +0200, Nitin Kuppelur wrote:
 Removed unnecessary else after return to solve
 checkpatch.pl warning

 Signed-off-by: Nitin Kuppelur nitinkuppe...@gmail.com
 ---
  drivers/staging/rtl8712/hal_init.c | 7 ++-
  1 file changed, 2 insertions(+), 5 deletions(-)

 diff --git a/drivers/staging/rtl8712/hal_init.c 
 b/drivers/staging/rtl8712/hal_init.c
 index 81cd654..fbaba11 100644
 --- a/drivers/staging/rtl8712/hal_init.c
 +++ b/drivers/staging/rtl8712/hal_init.c
 @@ -387,12 +387,9 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)
  uint rtl871x_hal_init(struct _adapter *padapter)
  {
   padapter-hw_init_completed = false;
 - if (padapter-halpriv.hal_bus_init == NULL)
 + if (padapter-halpriv.hal_bus_init == NULL ||
 + padapter-halpriv.hal_bus_init(padapter) != _SUCCESS)
   return _FAIL;
 - else {
 - if (padapter-halpriv.hal_bus_init(padapter) != _SUCCESS)
 - return _FAIL;
 - }
   if (rtl8712_hal_init(padapter) == _SUCCESS)
   padapter-hw_init_completed = true;
   else {

 This doesn't apply to my tree :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/44] kernel: Add support for poweroff handler call chain

2014-10-09 Thread Guenter Roeck
On Thu, Oct 09, 2014 at 12:31:43PM +0200, Pavel Machek wrote:
 Hi!
 
  +/**
  + * register_poweroff_handler_simple - Register function to be called to 
  power off
  + *the system
  + * @handler:   Function to be called to power off the system
  + * @priority:  Handler priority. For priority guidelines see
  + * register_poweroff_handler.
  + *
  + * This is a simplified version of register_poweroff_handler. It does not
  + * take a notifier as argument, but a function pointer. The function
  + * registers a poweroff handler with specified priority. Poweroff
  + * handlers registered with this function can not be unregistered,
  + * and only a single poweroff handler can be installed using it.
  + *
  + * This function must not be called from modules and is therefore
  + * not exported.
  + *
  + * Returns -EBUSY if a poweroff handler has already been registered
  + * using register_poweroff_handler_simple. Otherwise returns zero,
  + * since atomic_notifier_chain_register() currently always returns zero.
  + */
  +int register_poweroff_handler_simple(void (*handler)(void), int priority)
  +{
  +   char symname[KSYM_NAME_LEN];
  +
  +   if (poweroff_handler_data.handler) {
  +   lookup_symbol_name((unsigned long)poweroff_handler_data.handler,
  +  symname);
  +   pr_warn(Poweroff function already registered (%s), symname);
  +   lookup_symbol_name((unsigned long)handler, symname);
  +   pr_cont(, cannot register %s\n, symname);
  +   return -EBUSY;
  +   }
 
 Dunno, are you maybe overdoing the debugging infrastructure a bit?
 This is not going to happen in production, and if it does happen,
 developer can look the symbol name himself.

On the other side, I don't think it hurts to have that message.
Anyway, I'll use %ps as suggested by Geert.

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


Re: [PATCH 12/44] mfd: ab8500-sysctrl: Register with kernel poweroff handler

2014-10-09 Thread Guenter Roeck
On Thu, Oct 09, 2014 at 02:33:55PM +0100, Lee Jones wrote:
 On Thu, 09 Oct 2014, Guenter Roeck wrote:
 
  On 10/09/2014 03:49 AM, Lee Jones wrote:
  On Thu, 09 Oct 2014, Catalin Marinas wrote:
  
  On Tue, Oct 07, 2014 at 09:00:48AM +0100, Lee Jones wrote:
  On Mon, 06 Oct 2014, Guenter Roeck wrote:
  --- a/drivers/mfd/ab8500-sysctrl.c
  +++ b/drivers/mfd/ab8500-sysctrl.c
  @@ -6,6 +6,7 @@
  
  [...]
  
  +static int ab8500_power_off(struct notifier_block *this, unsigned long 
  unused1,
  +   void *unused2)
{
  sigset_t old;
  sigset_t all;
  @@ -34,11 +36,6 @@ static void ab8500_power_off(void)
  struct power_supply *psy;
  int ret;
  
  -   if (sysctrl_dev == NULL) {
  -   pr_err(%s: sysctrl not initialized\n, __func__);
  -   return;
  -   }
  
  Can you explain the purpose of this change please?
  
  I guess it's because the sysctrl_dev is already initialised when
  registering the power_off handler, so there isn't a way to call the
  above function with a NULL sysctrl_dev. Probably even with the original
  code you didn't need this check (after some race fix in
  ab8500_sysctrl_remove but races is one of the things Guenter's patches
  try to address).
  
  Sounds reasonable, although I think this change should be part of
  another patch.
  
  Sure, no problem. I'll split this into two patches.
  
  Since we are at it, any idea what to do with the restart function
  in the same file ? It is not used anywhere.
 
 You can strip it out with Linus Walleij's Ack.  Or I'll be happy to do
 it?
 
I'll strip it out in a 3rd patch.

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


Re: [PATCH V3] Staging: rtl8712 removed unnecessary else after return

2014-10-09 Thread Greg KH

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top


On Thu, Oct 09, 2014 at 09:00:58PM +0530, Nitin Kuppelur wrote:
 Hi Greg,
 
 Sorry for noob question. I am still new to Kernel development.
 
 I understood from your comment that the patch did not apply cleanly to
 your tree (may be due to change in the code which I have modified)

Or due to changes that others made and got accepted.

 But what should I do after this?
 1) Send patch on rebased file to same mail chain with (--in-reply-to)
 and [PATCH V4] ? OR
 2) Create new PATCH and start new mail chain done on latest code.

Create a new patch and new email thread please.

thanks,

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


Re: [PATCH 12/44] mfd: ab8500-sysctrl: Register with kernel poweroff handler

2014-10-09 Thread Guenter Roeck
On Thu, Oct 09, 2014 at 11:49:27AM +0100, Lee Jones wrote:
 On Thu, 09 Oct 2014, Catalin Marinas wrote:
 
  On Tue, Oct 07, 2014 at 09:00:48AM +0100, Lee Jones wrote:
   On Mon, 06 Oct 2014, Guenter Roeck wrote:
--- a/drivers/mfd/ab8500-sysctrl.c
+++ b/drivers/mfd/ab8500-sysctrl.c
@@ -6,6 +6,7 @@
   
   [...]
   
+static int ab8500_power_off(struct notifier_block *this, unsigned long 
unused1,
+   void *unused2)
 {
sigset_t old;
sigset_t all;
@@ -34,11 +36,6 @@ static void ab8500_power_off(void)
struct power_supply *psy;
int ret;
 
-   if (sysctrl_dev == NULL) {
-   pr_err(%s: sysctrl not initialized\n, __func__);
-   return;
-   }
   
   Can you explain the purpose of this change please?
  
  I guess it's because the sysctrl_dev is already initialised when
  registering the power_off handler, so there isn't a way to call the
  above function with a NULL sysctrl_dev. Probably even with the original
  code you didn't need this check (after some race fix in
  ab8500_sysctrl_remove but races is one of the things Guenter's patches
  try to address).
 
 Sounds reasonable, although I think this change should be part of
 another patch.
 
Turns out the options are to either drop the check or to use the device
managed function to register the poweroff handler. I decided to keep
the check and use the device managed function.

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


[PATCH] drivers: staging: imx-drm driver cleanup

2014-10-09 Thread Rene Kolarik
Wrapping two too long lines in two files of the imx-drm driver.

Signed-off-by: Rene Kolarik rene.kola...@gmail.com
---
 drivers/staging/imx-drm/imx-drm-core.c | 3 ++-
 drivers/staging/imx-drm/imx-tve.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-drm-core.c 
b/drivers/staging/imx-drm/imx-drm-core.c
index 9cb222e..3ca1acd 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -632,7 +632,8 @@ static int imx_drm_platform_probe(struct platform_device 
*pdev)
continue;
}
 
-   component_match_add(pdev-dev, match, compare_of, 
remote);
+   component_match_add(pdev-dev, match, compare_of,
+   remote);
of_node_put(remote);
}
of_node_put(port);
diff --git a/drivers/staging/imx-drm/imx-tve.c 
b/drivers/staging/imx-drm/imx-tve.c
index 42c651b..f22b2ac 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -665,7 +665,8 @@ static int imx_tve_bind(struct device *dev, struct device 
*master, void *data)
 
ret = regmap_read(tve-regmap, TVE_COM_CONF_REG, val);
if (ret  0) {
-   dev_err(dev, failed to read configuration register: %d\n, 
ret);
+   dev_err(dev, failed to read configuration register: %d\n,
+   ret);
return ret;
}
if (val != 0x0010) {
-- 
1.9.3

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


Re: [PATCH 08/44] kernel: Move pm_power_off to common code

2014-10-09 Thread Pavel Machek
Hi!

 @@ -184,6 +179,8 @@ machine_halt(void)
   void
   machine_power_off(void)
   {
 +   do_kernel_poweroff();
 +
 
 poweroff - power_off for consistency.
 
 Dunno; matter of personal preference. I started with that, but ultimately went
 with poweroff to distinguish poweroff handler functions from existing code,
 specifically kernel_power_off().

That works for you, but once it is merged, it is ugly/confusing typo.
Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/3] staging: vt6655: delete SndEvt_ToAPI code

2014-10-09 Thread Greg Kroah-Hartman
On Thu, Oct 09, 2014 at 03:38:55PM +1100, Vladimir A. Nazarenko wrote:
 It's never enabled, so we can safely remove it.
 
 Signed-off-by: Vladimir A. Nazarenko nas...@ya.ru
 ---
  drivers/staging/vt6655/device_main.c | 10 ++
  1 file changed, 2 insertions(+), 8 deletions(-)
 
 diff --git a/drivers/staging/vt6655/device_main.c 
 b/drivers/staging/vt6655/device_main.c
 index de5378e..6728de5 100644
 --- a/drivers/staging/vt6655/device_main.c
 +++ b/drivers/staging/vt6655/device_main.c
 @@ -2916,14 +2916,8 @@ static int  device_ioctl(struct net_device *dev, 
 struct ifreq *rq, int cmd)
  
   case IOCTL_CMD_SET:
  
 -#ifdef SndEvt_ToAPI
 - if PSCmdRequest)rq)-wCmdCode != WLAN_CMD_SET_EVT) 
 - !(pDevice-flags  DEVICE_FLAGS_OPENED))
 -#else
 - if (!(pDevice-flags  DEVICE_FLAGS_OPENED) 
 - (((PSCmdRequest)rq)-wCmdCode != WLAN_CMD_SET_WPA))
 -#endif
 - {
 + if (!(pDevice-flags  DEVICE_FLAGS_OPENED) 
 + (((PSCmdRequest)rq)-wCmdCode != WLAN_CMD_SET_WPA)) {
   rc = -EFAULT;
   break;
   } else {

This didn't apply to my tree :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: vt6655: delete SndEvt_ToAPI code

2014-10-09 Thread Vladimir A. Nazarenko
It's never enabled, so we can safely remove it.

Signed-off-by: Vladimir A. Nazarenko nas...@ya.ru
---
 drivers/staging/vt6655/device_main.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/vt6655/device_main.c 
b/drivers/staging/vt6655/device_main.c
index 6a77f0d..c8f262f 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -2911,14 +2911,8 @@ static int  device_ioctl(struct net_device *dev, struct 
ifreq *rq, int cmd)
 
case IOCTL_CMD_SET:
 
-#ifdef SndEvt_ToAPI
-   if PSCmdRequest)rq)-wCmdCode != WLAN_CMD_SET_EVT) 
-   !(pDevice-flags  DEVICE_FLAGS_OPENED))
-#else
-   if (!(pDevice-flags  DEVICE_FLAGS_OPENED) 
-   (((PSCmdRequest)rq)-wCmdCode != WLAN_CMD_SET_WPA))
-#endif
-   {
+   if (!(pDevice-flags  DEVICE_FLAGS_OPENED) 
+   (((PSCmdRequest)rq)-wCmdCode != WLAN_CMD_SET_WPA)) {
rc = -EFAULT;
break;
}
-- 
2.1.1

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


Re: [PATCH resend] staging, lustre: fix a sparse error

2014-10-09 Thread WANG Chao
On 10/09/14 at 05:58pm, Sudip Mukherjee wrote:
 On Thu, Oct 09, 2014 at 06:25:10PM +0800, WANG Chao wrote:
  This fixes the following sparse error:
  
  drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c:393:9: error:
  incompatible types in comparison expression (different address spaces)
  
  Signed-off-by: WANG Chao wangchao19890...@gmail.com
  ---
   drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
  
  diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c 
  b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
  index 245c9d7..1510594 100644
  --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
  +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
  @@ -390,7 +390,7 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx)
  __u32   csum;
  void*base;
   
  -   LASSERT(tx-tx_iov[0].iov_base == (void *)tx-tx_msg);
  +   LASSERT((void __force *) tx-tx_iov[0].iov_base == (void *)tx-tx_msg);
 is it ok? are you not just suppressing the sparse error?
 iov_base is void __user *  

I think __user annotation is for no dereferencing in kernel space. In
this case, I think it's fine to override this error by __force. Because
they're pointers with identical target types.

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


[PATCH v2] mfd: rtsx: fix PM suspend for 5227 5249

2014-10-09 Thread micky_ching
From: Micky Ching micky_ch...@realsil.com.cn

Fix rts52275249 failed send buffer cmd after suspend,
PM_CTRL3 should reset before send any buffer cmd after suspend.
Otherwise, buffer cmd will failed, this will lead resume fail.

Signed-off-by: Micky Ching micky_ch...@realsil.com.cn
---
 drivers/mfd/Makefile |  2 +-
 drivers/mfd/rts5227.c|  6 ++
 drivers/mfd/rts5249.c|  4 
 drivers/mfd/rtsx_gops.c  | 37 +
 drivers/mfd/rtsx_pcr.h   |  3 +++
 include/linux/mfd/rtsx_pci.h | 28 
 6 files changed, 79 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mfd/rtsx_gops.c

diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index f001487..7f45c06 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_MFD_CROS_EC) += cros_ec.o
 obj-$(CONFIG_MFD_CROS_EC_I2C)  += cros_ec_i2c.o
 obj-$(CONFIG_MFD_CROS_EC_SPI)  += cros_ec_spi.o
 
-rtsx_pci-objs  := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o 
rts5227.o rts5249.o
+rtsx_pci-objs  := rtsx_pcr.o rtsx_gops.o rts5209.o rts5229.o 
rtl8411.o rts5227.o rts5249.o
 obj-$(CONFIG_MFD_RTSX_PCI) += rtsx_pci.o
 obj-$(CONFIG_MFD_RTSX_USB) += rtsx_usb.o
 
diff --git a/drivers/mfd/rts5227.c b/drivers/mfd/rts5227.c
index 9c8eec8..3240740 100644
--- a/drivers/mfd/rts5227.c
+++ b/drivers/mfd/rts5227.c
@@ -130,6 +130,12 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
 
 static int rts5227_optimize_phy(struct rtsx_pcr *pcr)
 {
+   int err;
+
+   err = rtsx_gops_pm_reset(pcr);
+   if (err  0)
+   return err;
+
/* Optimize RX sensitivity */
return rtsx_pci_write_phy_register(pcr, 0x00, 0xBA42);
 }
diff --git a/drivers/mfd/rts5249.c b/drivers/mfd/rts5249.c
index 573de7b..cf425cc 100644
--- a/drivers/mfd/rts5249.c
+++ b/drivers/mfd/rts5249.c
@@ -130,6 +130,10 @@ static int rts5249_optimize_phy(struct rtsx_pcr *pcr)
 {
int err;
 
+   err = rtsx_gops_pm_reset(pcr);
+   if (err  0)
+   return err;
+
err = rtsx_pci_write_phy_register(pcr, PHY_REG_REV,
PHY_REG_REV_RESV | PHY_REG_REV_RXIDLE_LATCHED |
PHY_REG_REV_P1_EN | PHY_REG_REV_RXIDLE_EN |
diff --git a/drivers/mfd/rtsx_gops.c b/drivers/mfd/rtsx_gops.c
new file mode 100644
index 000..b1a98c6
--- /dev/null
+++ b/drivers/mfd/rtsx_gops.c
@@ -0,0 +1,37 @@
+/* Driver for Realtek PCI-Express card reader
+ *
+ * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see http://www.gnu.org/licenses/.
+ *
+ * Author:
+ *   Micky Ching micky_ch...@realsil.com.cn
+ */
+
+#include linux/mfd/rtsx_pci.h
+#include rtsx_pcr.h
+
+int rtsx_gops_pm_reset(struct rtsx_pcr *pcr)
+{
+   int err;
+
+   /* init aspm */
+   rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0x00);
+   err = rtsx_pci_update_cfg_byte(pcr, LCTLR, ~LCTLR_ASPM_CTL_MASK, 0x00);
+   if (err  0)
+   return err;
+
+   /* reset PM_CTRL3 before send buffer cmd */
+   return rtsx_pci_write_register(pcr, PM_CTRL3, D3_DELINK_MODE_EN, 0x00);
+}
diff --git a/drivers/mfd/rtsx_pcr.h b/drivers/mfd/rtsx_pcr.h
index 07e4c2e..fe2bbb6 100644
--- a/drivers/mfd/rtsx_pcr.h
+++ b/drivers/mfd/rtsx_pcr.h
@@ -72,4 +72,7 @@ do {  
\
pcr-ms_pull_ctl_disable_tbl = __device##_ms_pull_ctl_disable_tbl; \
 } while (0)
 
+/* generic operations */
+int rtsx_gops_pm_reset(struct rtsx_pcr *pcr);
+
 #endif
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 74346d5..1604dda 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -707,6 +707,14 @@
 #define PM_CTRL1   0xFF44
 #define PM_CTRL2   0xFF45
 #define PM_CTRL3   0xFF46
+#define   SDIO_SEND_PME_EN 0x80
+#define   FORCE_RC_MODE_ON 0x40
+#define   FORCE_RX50_LINK_ON   0x20
+#define   D3_DELINK_MODE_EN0x10
+#define   USE_PESRTB_CTL_DELINK0x08
+#define   DELAY_PIN_WAKE   0x04
+#define   RESET_PIN_WAKE   0x02
+#define   PM_WAKE_EN   0x01
 #define PM_CTRL4   0xFF47
 
 /* Memory mapping */
@@ -752,6 +760,14 @@