Re: [RFC 3/3] MAINTAINERS: add maintainer entry for ks7010

2017-05-31 Thread Tobin C. Harding
On Thu, Jun 01, 2017 at 12:46:30PM +0900, Greg KH wrote:
> On Thu, Jun 01, 2017 at 01:27:08PM +1000, Tobin C. Harding wrote:
> > Driver ks7010 does not currently have a maintainer.
> > 
> > Add maintainers entry for ks7010.
> > 
> > Signed-off-by: Tobin C. Harding 
> > ---
> >  MAINTAINERS | 7 +++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 9e98464..75250ee 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -7429,6 +7429,13 @@ F:   Documentation/auxdisplay/ks0108
> >  F: drivers/auxdisplay/ks0108.c
> >  F: include/linux/ks0108.h
> >  
> > +KS7010 KEYSTREAM DRIVER
> > +M:  Tobin Harding 
> > +L:  driverdev-devel@linuxdriverproject.org
> > +T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> > +S:  Maintained
> > +F:  drivers/staging/ks7010/
> 
> All tabs please :)

Will fix in v2.

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


Re: [RFC 1/3] staging: ks7010: move WEXT files to sub directory

2017-05-31 Thread Tobin C. Harding
On Thu, Jun 01, 2017 at 12:45:37PM +0900, Greg KH wrote:
> On Thu, Jun 01, 2017 at 01:27:06PM +1000, Tobin C. Harding wrote:
> > Current driver implements the WEXT interface. WEXT is in maintenance
> > mode, we need to re-write the driver using cfg80211. The current
> > driver is handy as a reference for the new implementation, we can keep
> > it in tree for now.
> > 
> > Move WEXT driver to sub directory, add dummy Makefile and Kconfig so
> > build completes successfully but does not process any files from the
> > WEXT directory.
> > 
> > Signed-off-by: Tobin C. Harding 
> > ---
> >  drivers/staging/ks7010/Kconfig  |6 +-
> >  drivers/staging/ks7010/Makefile |3 -
> >  drivers/staging/ks7010/TODO |   36 -
> >  drivers/staging/ks7010/eap_packet.h |  144 --
> >  drivers/staging/ks7010/ks7010_sdio.c| 1079 --
> >  drivers/staging/ks7010/ks7010_sdio.h|  164 --
> >  drivers/staging/ks7010/ks_hostif.c  | 2638 ---
> >  drivers/staging/ks7010/ks_hostif.h  |  685 --
> >  drivers/staging/ks7010/ks_wlan.h|  514 -
> >  drivers/staging/ks7010/ks_wlan_ioctl.h  |   67 -
> >  drivers/staging/ks7010/ks_wlan_net.c| 2999 
> > ---
> >  drivers/staging/ks7010/michael_mic.c|  148 --
> >  drivers/staging/ks7010/michael_mic.h|   25 -
> >  drivers/staging/ks7010/wext/Kconfig |   10 +
> >  drivers/staging/ks7010/wext/Makefile|4 +
> >  drivers/staging/ks7010/wext/TODO|   36 +
> >  drivers/staging/ks7010/wext/eap_packet.h|  144 ++
> >  drivers/staging/ks7010/wext/ks7010_sdio.c   | 1079 ++
> >  drivers/staging/ks7010/wext/ks7010_sdio.h   |  164 ++
> >  drivers/staging/ks7010/wext/ks_hostif.c | 2638 +++
> >  drivers/staging/ks7010/wext/ks_hostif.h |  685 ++
> >  drivers/staging/ks7010/wext/ks_wlan.h   |  514 +
> >  drivers/staging/ks7010/wext/ks_wlan_ioctl.h |   67 +
> >  drivers/staging/ks7010/wext/ks_wlan_net.c   | 2999 
> > +++
> >  drivers/staging/ks7010/wext/michael_mic.c   |  148 ++
> >  drivers/staging/ks7010/wext/michael_mic.h   |   25 +
> >  26 files changed, 8514 insertions(+), 8507 deletions(-)
> >  delete mode 100644 drivers/staging/ks7010/TODO
> >  delete mode 100644 drivers/staging/ks7010/eap_packet.h
> >  delete mode 100644 drivers/staging/ks7010/ks7010_sdio.c
> >  delete mode 100644 drivers/staging/ks7010/ks7010_sdio.h
> >  delete mode 100644 drivers/staging/ks7010/ks_hostif.c
> >  delete mode 100644 drivers/staging/ks7010/ks_hostif.h
> >  delete mode 100644 drivers/staging/ks7010/ks_wlan.h
> >  delete mode 100644 drivers/staging/ks7010/ks_wlan_ioctl.h
> >  delete mode 100644 drivers/staging/ks7010/ks_wlan_net.c
> >  delete mode 100644 drivers/staging/ks7010/michael_mic.c
> >  delete mode 100644 drivers/staging/ks7010/michael_mic.h
> >  create mode 100644 drivers/staging/ks7010/wext/Kconfig
> >  create mode 100644 drivers/staging/ks7010/wext/Makefile
> >  create mode 100644 drivers/staging/ks7010/wext/TODO
> >  create mode 100644 drivers/staging/ks7010/wext/eap_packet.h
> >  create mode 100644 drivers/staging/ks7010/wext/ks7010_sdio.c
> >  create mode 100644 drivers/staging/ks7010/wext/ks7010_sdio.h
> >  create mode 100644 drivers/staging/ks7010/wext/ks_hostif.c
> >  create mode 100644 drivers/staging/ks7010/wext/ks_hostif.h
> >  create mode 100644 drivers/staging/ks7010/wext/ks_wlan.h
> >  create mode 100644 drivers/staging/ks7010/wext/ks_wlan_ioctl.h
> >  create mode 100644 drivers/staging/ks7010/wext/ks_wlan_net.c
> >  create mode 100644 drivers/staging/ks7010/wext/michael_mic.c
> >  create mode 100644 drivers/staging/ks7010/wext/michael_mic.h
> 
> Please use the -M option to 'git format-patch" so that we can just see
> file moves, not delete/add like you have here.

Point noted, will submit v2 using -M option. This is the second time
you have told me this, that means I have to buy you a beer doesn't it?

Will follow the 'wait a day before submitting next version' rule.

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


Re: [RFC 3/3] MAINTAINERS: add maintainer entry for ks7010

2017-05-31 Thread Joe Perches
On Thu, 2017-06-01 at 12:46 +0900, Greg KH wrote:
> On Thu, Jun 01, 2017 at 01:27:08PM +1000, Tobin C. Harding wrote:
> > Add maintainers entry for ks7010.
[]
> > diff --git a/MAINTAINERS b/MAINTAINERS
[]
> > @@ -7429,6 +7429,13 @@ F:   Documentation/auxdisplay/ks0108
> >  F: drivers/auxdisplay/ks0108.c
> >  F: include/linux/ks0108.h
> >  
> > +KS7010 KEYSTREAM DRIVER
> > +M:  Tobin Harding 
> > +L:  driverdev-devel@linuxdriverproject.org
> > +T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> > +S:  Maintained
> > +F:  drivers/staging/ks7010/
> 
> All tabs please :)

Right.  Perhaps someone could do:

$ sed -r -i -e "s/^([A-Z]):\s*/\1:\t/" MAINTAINERS

For today's -next, that gives:
---
 MAINTAINERS | 122 ++--
 1 file changed, 61 insertions(+), 61 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a4d082acb458..335a18e9785b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1080,7 +1080,7 @@ S:Maintained
 F: arch/arm/mach-meson/
 F: arch/arm/boot/dts/meson*
 F: arch/arm64/boot/dts/amlogic/
-F: drivers/pinctrl/meson/
+F: drivers/pinctrl/meson/
 F: drivers/mmc/host/meson*
 N: meson
 
@@ -3101,14 +3101,14 @@ S:  Supported
 F: drivers/mmc/host/cavium*
 
 CAVIUM LIQUIDIO NETWORK DRIVER
-M: Derek Chickles 
-M: Satanand Burla 
-M: Felix Manlunas 
-M: Raghu Vatsavayi 
-L: net...@vger.kernel.org
-W: http://www.cavium.com
-S: Supported
-F: drivers/net/ethernet/cavium/liquidio/
+M: Derek Chickles 
+M: Satanand Burla 
+M: Felix Manlunas 
+M: Raghu Vatsavayi 
+L: net...@vger.kernel.org
+W: http://www.cavium.com
+S: Supported
+F: drivers/net/ethernet/cavium/liquidio/
 
 CAVIUM OCTEON-TX CRYPTO DRIVER
 M: George Cherian 
@@ -4327,14 +4327,14 @@ F:  include/uapi/drm/i915_drm.h
 F: Documentation/gpu/i915.rst
 
 INTEL GVT-g DRIVERS (Intel GPU Virtualization)
-M:  Zhenyu Wang 
-M:  Zhi Wang 
-L:  intel-gvt-...@lists.freedesktop.org
-L:  intel-...@lists.freedesktop.org
-W:  https://01.org/igvt-g
-T:  git https://github.com/01org/gvt-linux.git
-S:  Supported
-F:  drivers/gpu/drm/i915/gvt/
+M: Zhenyu Wang 
+M: Zhi Wang 
+L: intel-gvt-...@lists.freedesktop.org
+L: intel-...@lists.freedesktop.org
+W: https://01.org/igvt-g
+T: git https://github.com/01org/gvt-linux.git
+S: Supported
+F: drivers/gpu/drm/i915/gvt/
 
 DRM DRIVERS FOR ATMEL HLCDC
 M: Boris Brezillon 
@@ -4933,10 +4933,10 @@ F:  drivers/edac/skx_edac.c
 
 EDAC-XGENE
 APPLIED MICRO (APM) X-GENE SOC EDAC
-M: Loc Ho 
-S: Supported
-F: drivers/edac/xgene_edac.c
-F: Documentation/devicetree/bindings/edac/apm-xgene-edac.txt
+M: Loc Ho 
+S: Supported
+F: drivers/edac/xgene_edac.c
+F: Documentation/devicetree/bindings/edac/apm-xgene-edac.txt
 
 EDIROL UA-101/UA-1000 DRIVER
 M: Clemens Ladisch 
@@ -6778,11 +6778,11 @@ F:  drivers/net/ethernet/intel/
 F: drivers/net/ethernet/intel/*/
 
 INTEL RDMA RNIC DRIVER
-M: Faisal Latif 
-M: Shiraz Saleem 
-L: linux-r...@vger.kernel.org
-S: Supported
-F: drivers/infiniband/hw/i40iw/
+M: Faisal Latif 
+M: Shiraz Saleem 
+L: linux-r...@vger.kernel.org
+S: Supported
+F: drivers/infiniband/hw/i40iw/
 
 INTEL MERRIFIELD GPIO DRIVER
 M: Andy Shevchenko 
@@ -6867,7 +6867,7 @@ W:http://software.intel.com/en-us/mic-developer
 F: include/linux/mic_bus.h
 F: include/linux/scif.h
 F: include/uapi/linux/mic_common.h
-F: include/uapi/linux/mic_ioctl.h
+F: include/uapi/linux/mic_ioctl.h
 F: include/uapi/linux/scif_ioctl.h
 F: drivers/misc/mic/
 F: drivers/dma/mic_x100_dma.c
@@ -8393,10 +8393,10 @@ F:  drivers/leds/leds-mlxcpld.c
 F: Documentation/leds/leds-mlxcpld.txt
 
 MELLANOX PLATFORM DRIVER
-M:  Vadim Pasternak 
-L:  platform-driver-...@vger.kernel.org
-S:  Supported
-F:  drivers/platform/x86/mlx-platform.c
+M: Vadim Pasternak 
+L: platform-driver-...@vger.kernel.org
+S: Supported
+F: drivers/platform/x86/mlx-platform.c
 
 MELLANOX MLX CPLD HOTPLUG DRIVER
 M: Vadim Pasternak 
@@ -9677,11 +9677,11 @@ F:  Documentation/mn10300/
 F: arch/mn10300/
 
 PARALLEL LCD/KEYPAD PANEL DRIVER
-M:  Willy Tarreau 
-M:  Ksenija Stanojevic 
-S:  Odd Fixes
-F:  Documentation/misc-devices/lcd-panel-cgram.txt
-F:  drivers/misc/panel.c
+M: Willy Tarreau 
+M: Ksenija Stanojevic 
+S: Odd Fixes
+F: Documentation/misc-devices/lcd-panel-cgram.txt
+F: drivers/misc/panel.c
 
 PARALLEL PORT SUBSYSTEM
 M: Sudip Mukherjee 
@@ -10002,11 +10002,11 @@ F:
Documentation/devicetree/bindings/pci/rockchip-pcie.txt
 F: drivers/pci/host/pcie-rockchip.c
 
 PCIE DRIVER FOR QUALCOMM MSM
-M: Stanimir Varbanov 
-L: linux-...@vger.kernel.org
-L: linux-arm-...@vger.kernel

[PATCH] rts5208: Fix a sleep-in-atomic bug in sd_power_off_card3v3

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is:
rtsx_exclusive_enter_ss (acquire the lock by spin_lock)
  rtsx_enter_ss
rtsx_power_off_card
  sd_power_off_card3v3
wait_timeout
  schedule_timeout --> may sleep

To fix it, "wait_timeout" is replaced with mdelay in sd_power_off_card3v3.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/rts5208/sd.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index bdd35b6..aa14454 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -5231,7 +5231,7 @@ int sd_power_off_card3v3(struct rtsx_chip *chip)
return STATUS_FAIL;
}
 
-   wait_timeout(50);
+   mdelay(50);
}
 
if (chip->asic_code) {
-- 
1.7.9.5


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


Re: [RFC 3/3] MAINTAINERS: add maintainer entry for ks7010

2017-05-31 Thread Greg KH
On Thu, Jun 01, 2017 at 01:27:08PM +1000, Tobin C. Harding wrote:
> Driver ks7010 does not currently have a maintainer.
> 
> Add maintainers entry for ks7010.
> 
> Signed-off-by: Tobin C. Harding 
> ---
>  MAINTAINERS | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9e98464..75250ee 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7429,6 +7429,13 @@ F: Documentation/auxdisplay/ks0108
>  F:   drivers/auxdisplay/ks0108.c
>  F:   include/linux/ks0108.h
>  
> +KS7010 KEYSTREAM DRIVER
> +M:  Tobin Harding 
> +L:  driverdev-devel@linuxdriverproject.org
> +T:   git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
> +S:  Maintained
> +F:  drivers/staging/ks7010/

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


Re: [RFC 1/3] staging: ks7010: move WEXT files to sub directory

2017-05-31 Thread Greg KH
On Thu, Jun 01, 2017 at 01:27:06PM +1000, Tobin C. Harding wrote:
> Current driver implements the WEXT interface. WEXT is in maintenance
> mode, we need to re-write the driver using cfg80211. The current
> driver is handy as a reference for the new implementation, we can keep
> it in tree for now.
> 
> Move WEXT driver to sub directory, add dummy Makefile and Kconfig so
> build completes successfully but does not process any files from the
> WEXT directory.
> 
> Signed-off-by: Tobin C. Harding 
> ---
>  drivers/staging/ks7010/Kconfig  |6 +-
>  drivers/staging/ks7010/Makefile |3 -
>  drivers/staging/ks7010/TODO |   36 -
>  drivers/staging/ks7010/eap_packet.h |  144 --
>  drivers/staging/ks7010/ks7010_sdio.c| 1079 --
>  drivers/staging/ks7010/ks7010_sdio.h|  164 --
>  drivers/staging/ks7010/ks_hostif.c  | 2638 ---
>  drivers/staging/ks7010/ks_hostif.h  |  685 --
>  drivers/staging/ks7010/ks_wlan.h|  514 -
>  drivers/staging/ks7010/ks_wlan_ioctl.h  |   67 -
>  drivers/staging/ks7010/ks_wlan_net.c| 2999 
> ---
>  drivers/staging/ks7010/michael_mic.c|  148 --
>  drivers/staging/ks7010/michael_mic.h|   25 -
>  drivers/staging/ks7010/wext/Kconfig |   10 +
>  drivers/staging/ks7010/wext/Makefile|4 +
>  drivers/staging/ks7010/wext/TODO|   36 +
>  drivers/staging/ks7010/wext/eap_packet.h|  144 ++
>  drivers/staging/ks7010/wext/ks7010_sdio.c   | 1079 ++
>  drivers/staging/ks7010/wext/ks7010_sdio.h   |  164 ++
>  drivers/staging/ks7010/wext/ks_hostif.c | 2638 +++
>  drivers/staging/ks7010/wext/ks_hostif.h |  685 ++
>  drivers/staging/ks7010/wext/ks_wlan.h   |  514 +
>  drivers/staging/ks7010/wext/ks_wlan_ioctl.h |   67 +
>  drivers/staging/ks7010/wext/ks_wlan_net.c   | 2999 
> +++
>  drivers/staging/ks7010/wext/michael_mic.c   |  148 ++
>  drivers/staging/ks7010/wext/michael_mic.h   |   25 +
>  26 files changed, 8514 insertions(+), 8507 deletions(-)
>  delete mode 100644 drivers/staging/ks7010/TODO
>  delete mode 100644 drivers/staging/ks7010/eap_packet.h
>  delete mode 100644 drivers/staging/ks7010/ks7010_sdio.c
>  delete mode 100644 drivers/staging/ks7010/ks7010_sdio.h
>  delete mode 100644 drivers/staging/ks7010/ks_hostif.c
>  delete mode 100644 drivers/staging/ks7010/ks_hostif.h
>  delete mode 100644 drivers/staging/ks7010/ks_wlan.h
>  delete mode 100644 drivers/staging/ks7010/ks_wlan_ioctl.h
>  delete mode 100644 drivers/staging/ks7010/ks_wlan_net.c
>  delete mode 100644 drivers/staging/ks7010/michael_mic.c
>  delete mode 100644 drivers/staging/ks7010/michael_mic.h
>  create mode 100644 drivers/staging/ks7010/wext/Kconfig
>  create mode 100644 drivers/staging/ks7010/wext/Makefile
>  create mode 100644 drivers/staging/ks7010/wext/TODO
>  create mode 100644 drivers/staging/ks7010/wext/eap_packet.h
>  create mode 100644 drivers/staging/ks7010/wext/ks7010_sdio.c
>  create mode 100644 drivers/staging/ks7010/wext/ks7010_sdio.h
>  create mode 100644 drivers/staging/ks7010/wext/ks_hostif.c
>  create mode 100644 drivers/staging/ks7010/wext/ks_hostif.h
>  create mode 100644 drivers/staging/ks7010/wext/ks_wlan.h
>  create mode 100644 drivers/staging/ks7010/wext/ks_wlan_ioctl.h
>  create mode 100644 drivers/staging/ks7010/wext/ks_wlan_net.c
>  create mode 100644 drivers/staging/ks7010/wext/michael_mic.c
>  create mode 100644 drivers/staging/ks7010/wext/michael_mic.h

Please use the -M option to 'git format-patch" so that we can just see
file moves, not delete/add like you have here.

thanks,

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


[PATCH] rts5208: Fix a sleep-in-atomic bug in rtsx_exclusive_enter_ss

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is:
rtsx_exclusive_enter_ss (acquire the lock by spin_lock)
  rtsx_enter_ss
rtsx_power_off_card
  sd_cleanup_work
sd_stop_seq_mode
  sd_switch_clock
sd_ddr_tuning
  sd_ddr_pre_tuning_tx
sd_change_phase
  wait_timeout
schedule_timeout --> may sleep

To fix it, "wait_timeout" is replaced with mdelay in sd_change_phase.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/rts5208/sd.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index bdd35b6..76bd105 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -1057,7 +1057,7 @@ static int sd_change_phase(struct rtsx_chip *chip, u8 
sample_point, u8 tune_dir)
 
rtsx_write_register(chip, SD_DCMPS_CTL, DCMPS_CHANGE, 0);
rtsx_write_register(chip, SD_VP_CTL, PHASE_CHANGE, 0);
-   wait_timeout(10);
+   mdelay(10);
sd_reset_dcm(chip, tune_dir);
return STATUS_FAIL;
 }
-- 
1.7.9.5


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


[RFC 2/3] staging: ks7010: add cfg80211 files

2017-05-31 Thread Tobin C. Harding
We are in the process of re-writing the current WEXT driver to use the
cfg80211 configuration API. Currently driver root directory is
empty. First step is to implement all the firmware interface in a
single layer of abstraction, Firmware Interface Layer (FIL). We can
add a skeleton implementation for most of the rest of the driver at
the same time.

Add cfg80211 driver skeleton. Implement FIL.

Signed-off-by: Tobin C. Harding 
---
 drivers/staging/ks7010/Makefile|6 +
 drivers/staging/ks7010/README.rst  |   73 ++
 drivers/staging/ks7010/TODO.rst|   17 +
 drivers/staging/ks7010/cfg80211.c  |   45 ++
 drivers/staging/ks7010/cfg80211.h  |9 +
 drivers/staging/ks7010/common.h|   10 +
 drivers/staging/ks7010/eap.h   |   36 +
 drivers/staging/ks7010/fil.c   | 1294 
 drivers/staging/ks7010/fil.h   |  527 +++
 drivers/staging/ks7010/fil_types.h |  845 +++
 drivers/staging/ks7010/hif.c   |  104 +++
 drivers/staging/ks7010/hif.h   |   23 +
 drivers/staging/ks7010/ks7010.h|   94 +++
 drivers/staging/ks7010/main.c  |  122 
 drivers/staging/ks7010/sdio.c  |  399 +++
 drivers/staging/ks7010/sdio.h  |   86 +++
 drivers/staging/ks7010/tx.c|   29 +
 17 files changed, 3719 insertions(+)
 create mode 100644 drivers/staging/ks7010/README.rst
 create mode 100644 drivers/staging/ks7010/TODO.rst
 create mode 100644 drivers/staging/ks7010/cfg80211.c
 create mode 100644 drivers/staging/ks7010/cfg80211.h
 create mode 100644 drivers/staging/ks7010/common.h
 create mode 100644 drivers/staging/ks7010/eap.h
 create mode 100644 drivers/staging/ks7010/fil.c
 create mode 100644 drivers/staging/ks7010/fil.h
 create mode 100644 drivers/staging/ks7010/fil_types.h
 create mode 100644 drivers/staging/ks7010/hif.c
 create mode 100644 drivers/staging/ks7010/hif.h
 create mode 100644 drivers/staging/ks7010/ks7010.h
 create mode 100644 drivers/staging/ks7010/main.c
 create mode 100644 drivers/staging/ks7010/sdio.c
 create mode 100644 drivers/staging/ks7010/sdio.h
 create mode 100644 drivers/staging/ks7010/tx.c

diff --git a/drivers/staging/ks7010/Makefile b/drivers/staging/ks7010/Makefile
index f58cf9a..29c46db 100644
--- a/drivers/staging/ks7010/Makefile
+++ b/drivers/staging/ks7010/Makefile
@@ -1 +1,7 @@
 obj-$(CONFIG_KS7010) += ks7010.o
+ks7010-y+= main.o
+ks7010-y+= tx.o
+ks7010-y+= sdio.o
+ks7010-y+= cfg80211.o
+ks7010-y+= fil.o
+ks7010-y+= hif.o
diff --git a/drivers/staging/ks7010/README.rst 
b/drivers/staging/ks7010/README.rst
new file mode 100644
index 000..5ce54f9
--- /dev/null
+++ b/drivers/staging/ks7010/README.rst
@@ -0,0 +1,73 @@
+=
+Key Stream SDIO Device Driver
+=
+
+Current Status
+--
+
+Firmware Interface Layer only.
+Skeleton implementation in all other files.
+
+Description
+---
+
+Driver conversion from WEXT interface to cfg80211 API.
+
+The current KeyStream SDIO wireless driver (drivers/staging/ks7010)
+implements the WEXT interface.
+
+This driver is based on source code from the Ben Nanonote extra repository [1]
+which is based on the original v007 release from Renesas [2].
+
+[1] 
http://projects.qi-hardware.com/index.php/p/openwrt-packages/source/tree/master/ks7010/src
+[2] http://downloads.qi-hardware.com/software/ks7010_sdio_v007.tar.bz2
+
+Extensive refactoring has been done to the driver whilst in staging
+and the current mainline tip is untested.
+
+WEXT driver files :-
+ - ks7010_sdio.[ch]- SDIO code.
+ - ks_hostif.[ch]  - Device interface.
+ - ks_wlan_net.c   - WEXT interface.
+ - mic.[ch]- Custom Michael MIC implementation.
+ - eap_packet.h- EAP headers.
+ - ks_wlan_ioctl.h - WEXT IOCTL.
+
+cfg80211 driver files :-
+ - main.c  - Main driver file (net_device_ops etc).
+ - ks7010.h- Main driver header file.
+ - common.h- Constant definitions and forward declarations.
+ - eap.h   - EAPOL structure descriptions.
+ - sdio.[ch]   - SDIO code.
+ - fil.[ch]- Firmware Interface Layer.
+ - fil_types.h - Internal FIL types.
+ - hif.[ch]- Host Interface Layer.
+ - cfg80211.c  - cfg80211 API implementation.
+ - tx.c- Transmit path functions.
+
+cfg80211 driver files to do :-
+ - mic.[ch]- Interface to the kernel Michael MIC implementation.
+ - rx.c- Recive path functions.
+
+Other Information
+=
+
+Hardware
+
+https://wikidevi.com/wiki/Spectec_SDW-821_(KeyStream)
+https://wikidevi.com/wiki/Spectec_SDW-823
+
+Kernel Config
+-
+http://cateee.net/lkddb/web-lkddb/KS7010.html
+
+also enable
+ - MMC_DEBUG
+
+Testing
+---
+http://elinux.org/Tests:SDIO-KS7010
+
+Writing SDIO Linux Drivers
+--
+http://ww

[RFC 3/3] MAINTAINERS: add maintainer entry for ks7010

2017-05-31 Thread Tobin C. Harding
Driver ks7010 does not currently have a maintainer.

Add maintainers entry for ks7010.

Signed-off-by: Tobin C. Harding 
---
 MAINTAINERS | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9e98464..75250ee 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7429,6 +7429,13 @@ F:   Documentation/auxdisplay/ks0108
 F: drivers/auxdisplay/ks0108.c
 F: include/linux/ks0108.h
 
+KS7010 KEYSTREAM DRIVER
+M:  Tobin Harding 
+L:  driverdev-devel@linuxdriverproject.org
+T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
+S:  Maintained
+F:  drivers/staging/ks7010/
+
 L3MDEV
 M: David Ahern 
 L: net...@vger.kernel.org
-- 
2.7.4

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


[RFC 0/3] staging: ks7010: cfg80211 conversion, add FIL

2017-05-31 Thread Tobin C. Harding
Current ks7010 driver uses the WEXT interface. This series is the
initial stage of re-writing the driver to use cfg80211.

Patch set applies on Linus' mainline.

5ed02dbb497422bf225783f46e6eadd237d23d6b Linux 4.12-rc3

Throws 4 compiler warnings for functions defined and not used.

As a first step I have implemented a Firmware Interface Layer (FIL)
based on how the current driver interfaces with the firmware.

This is my first interaction with wireless networking and device
driver development. Please be as pedantic as you like, I am here to
learn.

I have attempted to document the driver functionality thoroughly,
including explanation of wireless networking features. My
understanding is far from complete, if I have made mistakes please do
point them out. My aim is for this driver to be approachable by
developers new to Wi-Fi drivers (as well as shamelessly educating
myself).

I am unsure of the etiquette when attempting such a conversion so
elected to keep the original code in a sub directory but exclude it
from the build process.

Also the code does not include a licence comment in each file. It does
include the MODULE_LICENSE("GPL") macro. I am unsure of the correct
handling of the licensing, in particular which exact form of license
comment to use and what to do about copyright. I do not wish to
violate, or upset, the previous developers in any way. I am not employed
by a company, all work is my own and is based on the current kernel driver.

Thank you for taking the time to read this and thank you in advance
for any time that you spend on this RFC. All feedback very much
appreciated.

Regards,
Tobin.

Tobin C. Harding (3):
  staging: ks7010: move WEXT files to sub directory
  staging: ks7010: Add cfg80211 files
  MAINTAINERS: add maintainer entry for ks7010

 MAINTAINERS |7 +
 drivers/staging/ks7010/Kconfig  |6 +-
 drivers/staging/ks7010/Makefile |9 +-
 drivers/staging/ks7010/README.rst   |   73 +
 drivers/staging/ks7010/TODO |   36 -
 drivers/staging/ks7010/TODO.rst |   17 +
 drivers/staging/ks7010/cfg80211.c   |   45 +
 drivers/staging/ks7010/cfg80211.h   |9 +
 drivers/staging/ks7010/common.h |   10 +
 drivers/staging/ks7010/eap.h|   36 +
 drivers/staging/ks7010/eap_packet.h |  144 --
 drivers/staging/ks7010/fil.c| 1294 
 drivers/staging/ks7010/fil.h|  527 +
 drivers/staging/ks7010/fil_types.h  |  845 
 drivers/staging/ks7010/hif.c|  104 +
 drivers/staging/ks7010/hif.h|   23 +
 drivers/staging/ks7010/ks7010.h |   94 +
 drivers/staging/ks7010/ks7010_sdio.c| 1079 --
 drivers/staging/ks7010/ks7010_sdio.h|  164 --
 drivers/staging/ks7010/ks_hostif.c  | 2638 ---
 drivers/staging/ks7010/ks_hostif.h  |  685 --
 drivers/staging/ks7010/ks_wlan.h|  514 -
 drivers/staging/ks7010/ks_wlan_ioctl.h  |   67 -
 drivers/staging/ks7010/ks_wlan_net.c| 2999 ---
 drivers/staging/ks7010/main.c   |  122 ++
 drivers/staging/ks7010/michael_mic.c|  148 --
 drivers/staging/ks7010/michael_mic.h|   25 -
 drivers/staging/ks7010/sdio.c   |  399 
 drivers/staging/ks7010/sdio.h   |   86 +
 drivers/staging/ks7010/tx.c |   29 +
 drivers/staging/ks7010/wext/Kconfig |   10 +
 drivers/staging/ks7010/wext/Makefile|4 +
 drivers/staging/ks7010/wext/TODO|   36 +
 drivers/staging/ks7010/wext/eap_packet.h|  144 ++
 drivers/staging/ks7010/wext/ks7010_sdio.c   | 1079 ++
 drivers/staging/ks7010/wext/ks7010_sdio.h   |  164 ++
 drivers/staging/ks7010/wext/ks_hostif.c | 2638 +++
 drivers/staging/ks7010/wext/ks_hostif.h |  685 ++
 drivers/staging/ks7010/wext/ks_wlan.h   |  514 +
 drivers/staging/ks7010/wext/ks_wlan_ioctl.h |   67 +
 drivers/staging/ks7010/wext/ks_wlan_net.c   | 2999 +++
 drivers/staging/ks7010/wext/michael_mic.c   |  148 ++
 drivers/staging/ks7010/wext/michael_mic.h   |   25 +
 43 files changed, 12240 insertions(+), 8507 deletions(-)
 create mode 100644 drivers/staging/ks7010/README.rst
 delete mode 100644 drivers/staging/ks7010/TODO
 create mode 100644 drivers/staging/ks7010/TODO.rst
 create mode 100644 drivers/staging/ks7010/cfg80211.c
 create mode 100644 drivers/staging/ks7010/cfg80211.h
 create mode 100644 drivers/staging/ks7010/common.h
 create mode 100644 drivers/staging/ks7010/eap.h
 delete mode 100644 drivers/staging/ks7010/eap_packet.h
 create mode 100644 drivers/staging/ks7010/fil.c
 create mode 100644 drivers/staging/ks7010/fil.h
 create mode 100644 drivers/staging/ks7010/fil_types.h
 create mode 100644 drivers/staging/ks7010/hif.c
 create mode 100644 drivers/staging/ks7

Re: [PATCH net-next 1/1] netvsc: Add #include's for csum_* function declarations

2017-05-31 Thread Joe Perches
On Wed, 2017-05-31 at 13:59 -0400, David Miller wrote:
> From: Michael Kelley 
> Date: Tue, 30 May 2017 10:43:04 -0700
> 
> > Add direct #include statements for declarations of csum_tcpudp_magic()
> > and csum_ipv6_magic(). While the needed #include's are picked up
> > indirectly for the x86 architecture, they aren't on other
> > architectures, resulting in compile errors.
> > 
> > Signed-off-by: Michael Kelley 
> 
> Applied, thank you.

Did you apply this one or the v2?

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


Re: [PATCH net-next 1/1] netvsc: Add #include's for csum_* function declarations

2017-05-31 Thread David Miller
From: Joe Perches 
Date: Wed, 31 May 2017 15:59:31 -0700

> On Wed, 2017-05-31 at 13:59 -0400, David Miller wrote:
>> From: Michael Kelley 
>> Date: Tue, 30 May 2017 10:43:04 -0700
>> 
>> > Add direct #include statements for declarations of csum_tcpudp_magic()
>> > and csum_ipv6_magic(). While the needed #include's are picked up
>> > indirectly for the x86 architecture, they aren't on other
>> > architectures, resulting in compile errors.
>> > 
>> > Signed-off-by: Michael Kelley 
>> 
>> Applied, thank you.
> 
> Did you apply this one or the v2?

I got v2 which used net/checksum.h et al.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v7 00/34] i.MX Media Driver

2017-05-31 Thread Pavel Machek
Hi!

> >If there's a need for this (there should not be, as the controls are exposed
> >to the user space through the sub-device nodes as the other drivers do), the
> >framework APIs need to be extended.
> 
> Right, this gets back to the media framework usability arguments. At least
> myself, Philipp, and Russell feel that automatic inheritance of a configured
> pipeline's controls to a video device adds to the usability.

For the record, usability can be pretty much fixed in v4l-utils... I
have patches that try ioctls on a list of fd's. Now we need a way to
find out which /dev/video* files belong to single camera. I believe
kernel already has required APIs, we just need to apply v4l-utils
patch to use them...

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


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


Re: [PATCH v7 16/34] [media] add Omnivision OV5640 sensor driver

2017-05-31 Thread Pavel Machek
Hi!

> +/* min/typical/max system clock (xclk) frequencies */
> +#define OV5640_XCLK_MIN  600
> +#define OV5640_XCLK_MAX 2400
> +
> +/*
> + * FIXME: there is no subdev API to set the MIPI CSI-2
> + * virtual channel yet, so this is hardcoded for now.
> + */
> +#define OV5640_MIPI_VC   1

Can the FIXME be fixed?

> +/*
> + * image size under 1280 * 960 are SUBSAMPLING

-> Image

> + * image size upper 1280 * 960 are SCALING

above?

> +/*
> + * FIXME: all of these register tables are likely filled with
> + * entries that set the register to their power-on default values,
> + * and which are otherwise not touched by this driver. Those entries
> + * should be identified and removed to speed register load time
> + * over i2c.
> + */

load->loading? Can the FIXME be fixed?

> + /* Auto/manual exposure */
> + ctrls->auto_exp = v4l2_ctrl_new_std_menu(hdl, ops,
> +  V4L2_CID_EXPOSURE_AUTO,
> +  V4L2_EXPOSURE_MANUAL, 0,
> +  V4L2_EXPOSURE_AUTO);
> + ctrls->exposure = v4l2_ctrl_new_std(hdl, ops,
> + V4L2_CID_EXPOSURE_ABSOLUTE,
> + 0, 65535, 1, 0);

Is exposure_absolute supposed to be in microseconds...?


> + /* Auto/manual gain */
> + ctrls->auto_gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_AUTOGAIN,
> +  0, 1, 1, 1);
> + ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_GAIN,
> + 0, 1023, 1, 0);
> +
> + ctrls->saturation = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_SATURATION,
> +   0, 255, 1, 64);
> + ctrls->hue = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_HUE,
> +0, 359, 1, 0);
> + ctrls->contrast = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_CONTRAST,
> + 0, 255, 1, 0);
> + ctrls->test_pattern =
> + v4l2_ctrl_new_std_menu_items(hdl, ops, V4L2_CID_TEST_PATTERN,
> +  ARRAY_SIZE(test_pattern_menu) - 1,
> +  0, 0, test_pattern_menu);
> +

It is good to see sensor that has autogain/etc. I'm emulating them in
v4l-utils, and hardware that supports it is a good argument. 

Best regards,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


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


[patch] staging: speakup: check for null before calling TTY's flush_buffer

2017-05-31 Thread Okash Khawaja
We should check the flush_buffer method of a tty for null before
invoking it. Some drivers such as usbserial don't implement
flush_buffer. This will be required for upcoming patches where we expand
spk_ttyio to support more than just ttyS*.

Signed-off-by: Okash Khawaja 
Reviewed-by: Samuel Thibault 

---
 drivers/staging/speakup/spk_ttyio.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -227,7 +227,8 @@ static unsigned char spk_ttyio_in_nowait
 
 static void spk_ttyio_flush_buffer(void)
 {
-   speakup_tty->ops->flush_buffer(speakup_tty);
+   if (speakup_tty->ops->flush_buffer)
+   speakup_tty->ops->flush_buffer(speakup_tty);
 }
 
 int spk_ttyio_synth_probe(struct spk_synth *synth)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next 1/1] netvsc: Add #include's for csum_* function declarations

2017-05-31 Thread David Miller
From: Michael Kelley 
Date: Tue, 30 May 2017 10:43:04 -0700

> Add direct #include statements for declarations of csum_tcpudp_magic()
> and csum_ipv6_magic(). While the needed #include's are picked up
> indirectly for the x86 architecture, they aren't on other
> architectures, resulting in compile errors.
> 
> Signed-off-by: Michael Kelley 

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


Re: [PATCH v5 09/10] x86/hyper-v: support extended CPU ranges for TLB flush hypercalls

2017-05-31 Thread Vitaly Kuznetsov
Jork Loeser  writes:

>> -Original Message-
>> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
>> Sent: Tuesday, May 30, 2017 04:34
>> To: x...@kernel.org; de...@linuxdriverproject.org
>> Cc: linux-ker...@vger.kernel.org; KY Srinivasan ; Haiyang
>> Zhang ; Stephen Hemminger
>> ; Thomas Gleixner ; Ingo
>> Molnar ; H. Peter Anvin ; Steven
>> Rostedt ; Jork Loeser ;
>> Simon Xiao ; Andy Lutomirski ; Andy
>> Shevchenko 
>> Subject: [PATCH v5 09/10] x86/hyper-v: support extended CPU ranges for TLB
>> flush hypercalls
>> 
>> Hyper-V hosts may support more than 64 vCPUs, we need to use
>> HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX/LIST_EX hypercalls in this case.
>
>> +static inline int cpumask_to_vp_set(struct hv_flush_pcpu_ex *flush,
>> +const struct cpumask *cpus)
>> +{
>> +int cpu, vcpu, vcpu_bank, vcpu_offset, cur_bank, nr_bank = 0;
>> +bool has_cpus;
>> +
>> +/*
>> + * We can't be sure that translated vCPU numbers will always be
>> + * in ascending order, so iterate over all possible banks and
>> + * check all vCPUs in it instead.
>> + */
>> +for (cur_bank = 0; cur_bank < ms_hyperv.max_vp_index/64;
>> cur_bank++) {
>> +has_cpus = false;
>> +for_each_cpu(cpu, cpus) {
>> +vcpu = hv_cpu_number_to_vp_number(cpu);
>> +vcpu_bank = vcpu / 64;
>> +vcpu_offset = vcpu % 64;
>> +
>> +if (vcpu_bank != cur_bank)
>> +continue;
>> +__set_bit(vcpu_offset, (unsigned long *)
>> +  &flush->hv_vp_set.bank_contents[nr_bank]);
>> +if (!has_cpus) {
>> +__set_bit(vcpu_bank, (unsigned long *)
>> +  &flush->hv_vp_set.valid_bank_mask);
>> +has_cpus = true;
>> +}
>> +}
>> +if (has_cpus)
>> +nr_bank++;
>> +}
>> +
>> +return nr_bank;
>> +}
>
> Note that the HV_VP_SET may contain empty banks. As such, consider
> enabling all (5) bits in the valid_bank_mask, and a single
> for_each(cpu, cpus) pass - setting the bits as per
> hv_cpu_number_to_vp_number(cpu).
>

Oh, I didn't know that! I'll switch to doing a single
pass. Unfortunately I have no Hyper-V setup with > 64 vCPUs so I can't
really test if it works or not (I mean empty banks, *_EX hypercalls
work).

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


Re: [PATCH v5 01/10] x86/hyper-v: include hyperv/ only when CONFIG_HYPERV is set

2017-05-31 Thread Andy Shevchenko
On Wed, May 31, 2017 at 5:37 PM, Vitaly Kuznetsov  wrote:

>>>  # Hyper-V paravirtualization support
>>> -obj-$(CONFIG_HYPERVISOR_GUEST) += hyperv/
>>> +ifdef CONFIG_HYPERV
>>> +obj-y += hyperv/
>>> +endif
>>
>> Can
>> obj-$(CONFIG_HYPERV) += hyperv/
>> work for you instead?
>>
>
> CONFIG_HYPERV can be set to "m" but we want to include the contents of
> hyperv/ in vmlinux, not in vmbus module.

obj-$(subst m,y,$(CONFIG_HYPERV)) += hyperv/

should do the trick.

-- 
With Best Regards,
Andy Shevchenko
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 02/10] x86/hyper-v: stash the max number of virtual/logical processor

2017-05-31 Thread Vitaly Kuznetsov
Stephen Hemminger  writes:

> On Tue, 30 May 2017 13:34:16 +0200
> Vitaly Kuznetsov  wrote:
>
>> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
>> index 04cb8d3..bdcc433 100644
>> --- a/arch/x86/kernel/cpu/mshyperv.c
>> +++ b/arch/x86/kernel/cpu/mshyperv.c
>> @@ -175,9 +175,15 @@ static void __init ms_hyperv_init_platform(void)
>>  ms_hyperv.misc_features = cpuid_edx(HYPERV_CPUID_FEATURES);
>>  ms_hyperv.hints= cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO);
>>  
>> -pr_info("HyperV: features 0x%x, hints 0x%x\n",
>> +pr_info("Hyper-V: features 0x%x, hints 0x%x\n",
>>  ms_hyperv.features, ms_hyperv.hints);
>
>>  
>> +ms_hyperv.max_vp_index = cpuid_eax(HVCPUID_IMPLEMENTATION_LIMITS);
>> +ms_hyperv.max_lp_index = cpuid_ebx(HVCPUID_IMPLEMENTATION_LIMITS);
>> +
>> +pr_info("Hyper-V: max %u virtual processors, %u logical processors\n",
>> +ms_hyperv.max_vp_index, ms_hyperv.max_lp_index);
>> +
>
> I understand as developer why you may need to log stuff.
> Do we really need more logging here? Why not pr_debug()?

Agreed, lets do pr_debug() instead.

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


Re: [PATCH v5 01/10] x86/hyper-v: include hyperv/ only when CONFIG_HYPERV is set

2017-05-31 Thread Vitaly Kuznetsov
Andy Shevchenko  writes:

> On Tue, May 30, 2017 at 2:34 PM, Vitaly Kuznetsov  wrote:
>> Code is arch/x86/hyperv/ is only needed when CONFIG_HYPERV is set, the
>> 'basic' support and detection lives in arch/x86/kernel/cpu/mshyperv.c
>> which is included when CONFIG_HYPERVISOR_GUEST is set.
>>
>> Signed-off-by: Vitaly Kuznetsov 
>> Acked-by: K. Y. Srinivasan 
>> Tested-by: Simon Xiao 
>> Tested-by: Srikanth Myakam 
>> ---
>>  arch/x86/Kbuild |  4 +++-
>>  arch/x86/include/asm/mshyperv.h | 10 +-
>>  2 files changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
>> index 586b786..3fa0a3c 100644
>> --- a/arch/x86/Kbuild
>> +++ b/arch/x86/Kbuild
>> @@ -8,7 +8,9 @@ obj-$(CONFIG_KVM) += kvm/
>>  obj-$(CONFIG_XEN) += xen/
>>
>>  # Hyper-V paravirtualization support
>> -obj-$(CONFIG_HYPERVISOR_GUEST) += hyperv/
>> +ifdef CONFIG_HYPERV
>> +obj-y += hyperv/
>> +endif
>
> Can
> obj-$(CONFIG_HYPERV) += hyperv/
> work for you instead?
>

CONFIG_HYPERV can be set to "m" but we want to include the contents of
hyperv/ in vmlinux, not in vmbus module.

>> +#else /* CONFIG_HYPERV */
>> +static inline void hyperv_init(void) {}
>
>> +static inline bool hv_is_hypercall_page_setup(void)
>> +{
>> +   return false;
>> +}
>
> Can it be one line? (It's okay in this case if it goes ~83 characters,
> for example)

Sure, I'm just trying to avoid such things as later people come with
'fix checkpatch.pl warning' patches.

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


Re: [PATCH v5 00/10] Hyper-V: praravirtualized remote TLB flushing and hypercall improvements

2017-05-31 Thread Vitaly Kuznetsov
Andy Shevchenko  writes:

> On Tue, May 30, 2017 at 2:34 PM, Vitaly Kuznetsov  wrote:
>
>> K. Y., while all the changes are not groundbreaking I still have to drop
>> 'Tested-by' tags on affected patches. It would be great to have this
>> series retested.
>>
>> Thomas, Ingo, Peter, would you like to take this through x86 tree or should
>> we push it through Greg's char-misc tree?
>
> What does MAINTAINERS tell about?
>

MAINTAINERS says Hyper-V:

Hyper-V CORE AND DRIVERS
M:  "K. Y. Srinivasan" 
M:  Haiyang Zhang 
M:  Stephen Hemminger 
L:  de...@linuxdriverproject.org
S:  Maintained
F:  arch/x86/include/asm/mshyperv.h
F:  arch/x86/include/uapi/asm/hyperv.h
F:  arch/x86/kernel/cpu/mshyperv.c
F:  arch/x86/hyperv
...

But Andy L. was asking if we could push this through x86 as it clashes
with his PCID series.

>> Vitaly Kuznetsov (10):
>
> I have found number of small issues, after addressing them, FWIW,
> Reviewed-by: Andy Shevchenko 

Thanks for the review!

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


Re: [PATCH V2] libcfs: Fix a sleep-in-atomic bug in cfs_wi_exit

2017-05-31 Thread Oleg Drokin
Hello!

On May 31, 2017, at 4:00 AM, Jia-Ju Bai wrote:

> The driver may sleep under a spin lock, and the function call path is:
> cfs_wi_exit (acquire the lock by spin_lock)
>  LASSERT
>lbug_with_loc
>  libcfs_debug_dumplog
>schedule and kthread_run --> may sleep
> 
> To fix it, all "LASSERT" is placed out of the spin_lock and spin_unlock.
> 
> Signed-off-by: Jia-Ju Bai 
> ---
> drivers/staging/lustre/lnet/libcfs/workitem.c |   13 +++--
> 1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/libcfs/workitem.c 
> b/drivers/staging/lustre/lnet/libcfs/workitem.c
> index dbc2a9b..928d06d 100644
> --- a/drivers/staging/lustre/lnet/libcfs/workitem.c
> +++ b/drivers/staging/lustre/lnet/libcfs/workitem.c
> @@ -111,22 +111,23 @@ struct cfs_wi_sched {
> {
>   LASSERT(!in_interrupt()); /* because we use plain spinlock */
>   LASSERT(!sched->ws_stopping);
> + LASSERT(wi->wi_running);
> + if (wi->wi_scheduled) {
> + LASSERT(!list_empty(&wi->wi_list));
> + LASSERT(sched->ws_nscheduled > 0);
> + }

Similarly here and in all other patches about LASSERT calls under spinlocks() 
from you,
just think of them as a panic() call, no operations are expected to continue
after it triggers.

Thanks.

> 
>   spin_lock(&sched->ws_lock);
> 
> - LASSERT(wi->wi_running);
>   if (wi->wi_scheduled) { /* cancel pending schedules */
> - LASSERT(!list_empty(&wi->wi_list));
>   list_del_init(&wi->wi_list);
> -
> - LASSERT(sched->ws_nscheduled > 0);
>   sched->ws_nscheduled--;
>   }
> 
> - LASSERT(list_empty(&wi->wi_list));
> -
>   wi->wi_scheduled = 1; /* LBUG future schedule attempts */
>   spin_unlock(&sched->ws_lock);
> +
> + LASSERT(list_empty(&wi->wi_list));
> }
> EXPORT_SYMBOL(cfs_wi_exit);
> 
> -- 
> 1.7.9.5
> 

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


Re: [PATCH V2] libcfs: Fix a sleep-in-atomic bug in cfs_wi_deschedule

2017-05-31 Thread Oleg Drokin
Hello!

On May 31, 2017, at 3:57 AM, Jia-Ju Bai wrote:

> The driver may sleep under a spin lock, and the function call path is:
> cfs_wi_deschedule (acquire the lock by spin_lock)
>  LASSERT
>lbug_with_loc
>  libcfs_debug_dumplog
>schedule and kthread_run --> may sleep
> 
> To fix it, all "LASSERT" is placed out of the spin_lock and spin_unlock.
> 
> Signed-off-by: Jia-Ju Bai 
> ---
> drivers/staging/lustre/lnet/libcfs/workitem.c |   12 ++--
> 1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/libcfs/workitem.c 
> b/drivers/staging/lustre/lnet/libcfs/workitem.c
> index dbc2a9b..9c530cf 100644
> --- a/drivers/staging/lustre/lnet/libcfs/workitem.c
> +++ b/drivers/staging/lustre/lnet/libcfs/workitem.c
> @@ -140,6 +140,10 @@ struct cfs_wi_sched {
> 
>   LASSERT(!in_interrupt()); /* because we use plain spinlock */
>   LASSERT(!sched->ws_stopping);
> + if (wi->wi_scheduled) {
> + LASSERT(!list_empty(&wi->wi_list));
> + LASSERT(sched->ws_nscheduled > 0);
> + }

I don't think you can do this,
this was under spinlock because those values could change from a different 
thread
and we do need to look at them all together.

You are correct that LASSET/LBUG might schedule to dump a debug log
into a file and even if not it does sleep indefinitely after that.
But in reality the default option is "panic_on_lbug=1" which simply converts
LASSERT() into panic().

This is certainly not a normal condition and as such I think we can leave the 
code
as is.

Thanks.


> 
>   /*
>* return 0 if it's running already, otherwise return 1, which
> @@ -151,18 +155,14 @@ struct cfs_wi_sched {
>   rc = !(wi->wi_running);
> 
>   if (wi->wi_scheduled) { /* cancel pending schedules */
> - LASSERT(!list_empty(&wi->wi_list));
>   list_del_init(&wi->wi_list);
> -
> - LASSERT(sched->ws_nscheduled > 0);
>   sched->ws_nscheduled--;
> -
>   wi->wi_scheduled = 0;
>   }
> 
> - LASSERT(list_empty(&wi->wi_list));
> -
>   spin_unlock(&sched->ws_lock);
> +
> + LASSERT(list_empty(&wi->wi_list));
>   return rc;
> }
> EXPORT_SYMBOL(cfs_wi_deschedule);
> -- 
> 1.7.9.5
> 

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


[PATCH] Staging: ccree: cc_crypto_ctx.h: Fixed a comment coding style issue.

2017-05-31 Thread srishti sharma
Fixed a comment coding style issue that generated a warning stating that block 
comments should align the * on each line.

Signed-off-by: srishti sharma 
---
 drivers/staging/ccree/cc_crypto_ctx.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ccree/cc_crypto_ctx.h 
b/drivers/staging/ccree/cc_crypto_ctx.h
index c5784bc..38f6615 100644
--- a/drivers/staging/ccree/cc_crypto_ctx.h
+++ b/drivers/staging/ccree/cc_crypto_ctx.h
@@ -239,10 +239,10 @@ struct drv_ctx_cipher {
enum drv_crypto_padding_type padding_type;
u32 key_size; /* numeric value in bytes   */
u32 data_unit_size; /* required for XTS */
-   /* block_state is the AES engine block state.
-   *  It is used by the host to pass IV or counter at initialization.
-   *  It is used by SeP for intermediate block chaining state and for
-   *  returning MAC algorithms results.   */
+   /*  block_state is the AES engine block state.
+*  It is used by the host to pass IV or counter at initialization.
+*  It is used by SeP for intermediate block chaining state and for
+*  returning MAC algorithms results.   */
u8 block_state[CC_AES_BLOCK_SIZE];
u8 key[CC_AES_KEY_SIZE_MAX];
u8 xex_key[CC_AES_KEY_SIZE_MAX];
2.7.4

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


[PATCH] Staging: ccree: cc_crypto_ctx.h: Fixed a comment coding style issue.

2017-05-31 Thread srishti sharma
Fixed a comment coding style issue that generated a warning stating block 
comments use * on subsequent lines.

Signed-off-by: srishti sharma 
---
 drivers/staging/ccree/cc_crypto_ctx.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ccree/cc_crypto_ctx.h 
b/drivers/staging/ccree/cc_crypto_ctx.h
index ac39d34..c5784bc 100644
--- a/drivers/staging/ccree/cc_crypto_ctx.h
+++ b/drivers/staging/ccree/cc_crypto_ctx.h
@@ -279,9 +279,9 @@ struct drv_ctx_aead {
/* Get the address of a @member within a given @ctx address
-   @ctx: The context address
-   @type: Type of context structure
-   @member: Associated context field */
+ * @ctx: The context address
+ * @type: Type of context structure
+ * @member: Associated context field */
 #define GET_CTX_FIELD_ADDR(ctx, type, member) (ctx + offsetof(type, member))
 #endif /* _CC_CRYPTO_CTX_H_ */
2.7.4

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


Re: [PATCH v4 10/10] staging: fsl-mc: move bus driver out of staging

2017-05-31 Thread Laurentiu Tudor
Hi Marc,

On 05/31/2017 02:15 PM, Marc Zyngier wrote:
> On 31/05/17 11:58, laurentiu.tu...@nxp.com wrote:
>> From: Stuart Yoder 
>>
>> Move the source files out of staging into their final locations:
>>-include files in drivers/staging/fsl-mc/include go to include/linux/fsl
>>-irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
>>-source in drivers/staging/fsl-mc/bus goes to drivers/bus/fsl-mc
>>-README.txt, providing and overview of DPAA goes to
>> Documentation/dpaa2/overview.txt
>>
>> Update or delete other remaining staging files-- Makefile, Kconfig, TODO.
>> Update dpaa2_eth and dpio staging drivers.
>>
>> Signed-off-by: Stuart Yoder 
>> Signed-off-by: Laurentiu Tudor 
>> [Laurentiu: rebased, add dpaa2_eth and dpio #include updates]
>> Cc: Thomas Gleixner 
>> Cc: Jason Cooper 
>> Cc: Marc Zyngier 
>> ---
>>
>> Notes:
>>  -no changes since v4
>>  -v4
>>-rebased
>>-update existing dpaa2 drivers to work with the bus out of staging
>>  -v3
>>-no changes
>>  -v2
>>-updated MAINTAINERS with new location
>>
>>   .../README.txt => Documentation/dpaa2/overview.txt|  0
>
> I thought you had agreed to drop all references to the userspace
> interface (restool and co) which is completely absent from this code?
> I'm certainly not going to ack this until this is done.

That's in patch 08/10 [1] but i guess you didn't get to see it because, 
as you mention, i forgot to Cc you on the whole series.
My bad, sorry about it. :-(

[1] https://patchwork.kernel.org/patch/9756659/

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


Re: [PATCH v4 10/10] staging: fsl-mc: move bus driver out of staging

2017-05-31 Thread Marc Zyngier
On 31/05/17 11:58, laurentiu.tu...@nxp.com wrote:
> From: Stuart Yoder 
> 
> Move the source files out of staging into their final locations:
>   -include files in drivers/staging/fsl-mc/include go to include/linux/fsl
>   -irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
>   -source in drivers/staging/fsl-mc/bus goes to drivers/bus/fsl-mc
>   -README.txt, providing and overview of DPAA goes to
>Documentation/dpaa2/overview.txt
> 
> Update or delete other remaining staging files-- Makefile, Kconfig, TODO.
> Update dpaa2_eth and dpio staging drivers.
> 
> Signed-off-by: Stuart Yoder 
> Signed-off-by: Laurentiu Tudor 
> [Laurentiu: rebased, add dpaa2_eth and dpio #include updates]
> Cc: Thomas Gleixner 
> Cc: Jason Cooper 
> Cc: Marc Zyngier 
> ---
> 
> Notes:
> -no changes since v4
> -v4
>   -rebased
>   -update existing dpaa2 drivers to work with the bus out of staging
> -v3
>   -no changes
> -v2
>   -updated MAINTAINERS with new location
> 
>  .../README.txt => Documentation/dpaa2/overview.txt|  0

I thought you had agreed to drop all references to the userspace
interface (restool and co) which is completely absent from this code?
I'm certainly not going to ack this until this is done.

Also, please CC me on the whole series, as I'd really like to see things
in context, and not a patch that just moves things around.

Thanks,

M.
-- 
Jazz is not dead. It just smells funny...
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 07/10] staging: fsl-mc: add binding path to MAINTAINERS

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

The mc bus device tree binding is maintained but
not mentioned in the MAINTAINERS file. This patch
adds it.

Signed-off-by: Laurentiu Tudor 
---

Notes:
  -v2
   -added commit description

 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9e98464..ffac090 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10545,6 +10545,7 @@ M:  Laurentiu Tudor 
 L: linux-ker...@vger.kernel.org
 S: Maintained
 F: drivers/staging/fsl-mc/
+F: Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
 
 QT1010 MEDIA DRIVER
 M: Antti Palosaari 
-- 
2.9.4

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


[PATCH v4 10/10] staging: fsl-mc: move bus driver out of staging

2017-05-31 Thread laurentiu.tudor
From: Stuart Yoder 

Move the source files out of staging into their final locations:
  -include files in drivers/staging/fsl-mc/include go to include/linux/fsl
  -irq-gic-v3-its-fsl-mc-msi.c goes to drivers/irqchip
  -source in drivers/staging/fsl-mc/bus goes to drivers/bus/fsl-mc
  -README.txt, providing and overview of DPAA goes to
   Documentation/dpaa2/overview.txt

Update or delete other remaining staging files-- Makefile, Kconfig, TODO.
Update dpaa2_eth and dpio staging drivers.

Signed-off-by: Stuart Yoder 
Signed-off-by: Laurentiu Tudor 
[Laurentiu: rebased, add dpaa2_eth and dpio #include updates]
Cc: Thomas Gleixner 
Cc: Jason Cooper 
Cc: Marc Zyngier 
---

Notes:
-no changes since v4
-v4
  -rebased
  -update existing dpaa2 drivers to work with the bus out of staging
-v3
  -no changes
-v2
  -updated MAINTAINERS with new location

 .../README.txt => Documentation/dpaa2/overview.txt|  0
 MAINTAINERS   |  2 +-
 drivers/bus/Kconfig   |  2 ++
 drivers/bus/Makefile  |  3 +++
 drivers/bus/fsl-mc/Kconfig| 17 +
 drivers/bus/fsl-mc/Makefile   | 19 +++
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h |  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  6 +++---
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h|  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c|  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h|  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h|  0
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c|  6 +++---
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h |  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c  |  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c |  6 +++---
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c  |  6 +++---
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c   |  6 +++---
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c   |  5 +++--
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h|  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c|  5 +++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c   |  6 +++---
 drivers/irqchip/Makefile  |  1 +
 .../bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c   |  3 +--
 drivers/staging/fsl-dpaa2/ethernet/README |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c|  4 ++--
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c |  4 ++--
 drivers/staging/fsl-mc/TODO   | 18 --
 drivers/staging/fsl-mc/bus/Kconfig| 10 --
 drivers/staging/fsl-mc/bus/Makefile   | 15 +--
 drivers/staging/fsl-mc/bus/dpcon.c|  8 
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.c |  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio-service.c|  2 +-
 drivers/staging/fsl-mc/bus/dpio/dpio.c|  4 ++--
 .../fsl-mc/include => include/linux/fsl}/dpbp.h   |  0
 .../fsl-mc/bus => include/linux/fsl}/dpcon-cmd.h  |  0
 .../fsl-mc/include => include/linux/fsl}/dpmng.h  |  0
 .../fsl-mc/include => include/linux/fsl}/dprc.h   |  1 -
 .../fsl-mc/include => include/linux/fsl}/mc-bus.h |  2 +-
 .../fsl-mc/include => include/linux/fsl}/mc-cmd.h |  0
 .../fsl-mc/include => include/linux/fsl}/mc-sys.h |  0
 .../staging/fsl-mc/include => include/linux/fsl}/mc.h |  2 +-
 43 files changed, 90 insertions(+), 89 deletions(-)
 rename drivers/staging/fsl-mc/README.txt => Documentation/dpaa2/overview.txt 
(100%)
 create mode 100644 drivers/bus/fsl-mc/Kconfig
 create mode 100644 drivers/bus/fsl-mc/Makefile
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c (96%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h (100%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h (98%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c (99%)
 rename drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c (

[PATCH 09/10] staging: fsl-mc: add reference to mc-bus DT binding

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

Update README to reference the mc-bus device tree node
binding.

Signed-off-by: Laurentiu Tudor 
---

Notes:
  -no changes

 drivers/staging/fsl-mc/README.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
index d7cd70a..524eda1 100644
--- a/drivers/staging/fsl-mc/README.txt
+++ b/drivers/staging/fsl-mc/README.txt
@@ -320,6 +320,8 @@ A brief description of each driver is provided below.
-creates an MSI IRQ domain
-doing a 'device add' to expose the 'root' DPRC, in turn triggering
 a bind of the root DPRC to the DPRC driver
+The binding for the MC-bus device-tree node can be consulted here:
+Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
 
 DPRC driver
 ---
-- 
2.9.4

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


[PATCH 08/10] staging: fsl-mc: drop reference to restool

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

Drop reference to user space restool utility from the README.
It will be added back together with the actual support in the
bus driver.

Signed-off-by: Laurentiu Tudor 
---

Notes:
  -no changes

 drivers/staging/fsl-mc/README.txt | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/fsl-mc/README.txt 
b/drivers/staging/fsl-mc/README.txt
index 179536a..d7cd70a 100644
--- a/drivers/staging/fsl-mc/README.txt
+++ b/drivers/staging/fsl-mc/README.txt
@@ -131,9 +131,7 @@ in creating a network interfaces.
 
 DPRCs can be defined statically and populated with objects
 via a config file passed to the MC when firmware starts
-it.  There is also a Linux user space tool called "restool"
-that can be used to create/destroy containers and objects
-dynamically.
+it.
 
 -DPAA2 Objects for an Ethernet Network Interface
 
-- 
2.9.4

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


[PATCH 05/10] staging: fsl-mc: remove extra blank line

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

Remove extra blank line reported by checkpatch.pl.

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/include/dprc.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/include/dprc.h 
b/drivers/staging/fsl-mc/include/dprc.h
index 8498a5e..2f4a7a7 100644
--- a/drivers/staging/fsl-mc/include/dprc.h
+++ b/drivers/staging/fsl-mc/include/dprc.h
@@ -49,7 +49,6 @@ int dprc_close(struct fsl_mc_io *mc_io,
   u32 cmd_flags,
   u16 token);
 
-
 /* IRQ */
 
 /* IRQ index */
-- 
2.9.4

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


[PATCH 06/10] staging: fsl-mc: drop unused forward declaration

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

This forward declaration of "struct fsl_mc_resource"
is of no use so drop it.

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/include/mc-sys.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/include/mc-sys.h 
b/drivers/staging/fsl-mc/include/mc-sys.h
index dca7f90..b520370 100644
--- a/drivers/staging/fsl-mc/include/mc-sys.h
+++ b/drivers/staging/fsl-mc/include/mc-sys.h
@@ -46,7 +46,6 @@
  */
 #define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL0x0001
 
-struct fsl_mc_resource;
 struct mc_command;
 
 /**
-- 
2.9.4

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


[PATCH 03/10] staging: fsl-mc: simplify couple of deallocations

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

Simplify a couple of deallocations code paths. This also
fixes these checkpatch.pl false positives:
  "WARNING: kfree(NULL) is safe and this check is
   probably not required"

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 50eb415..7b48ade 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -420,15 +420,11 @@ bool fsl_mc_is_root_dprc(struct device *dev)
 static void fsl_mc_device_release(struct device *dev)
 {
struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
-   struct fsl_mc_bus *mc_bus = NULL;
 
kfree(mc_dev->regions);
 
if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
-   mc_bus = to_fsl_mc_bus(mc_dev);
-
-   if (mc_bus)
-   kfree(mc_bus);
+   kfree(to_fsl_mc_bus(mc_dev));
else
kfree(mc_dev);
 }
@@ -559,10 +555,8 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
 
 error_cleanup_dev:
kfree(mc_dev->regions);
-   if (mc_bus)
-   kfree(mc_bus);
-   else
-   kfree(mc_dev);
+   kfree(mc_bus);
+   kfree(mc_dev);
 
return error;
 }
-- 
2.9.4

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


[PATCH 02/10] staging: fsl-mc: fix macros with possible side effects

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

Several macros were triggering this checkpatch.pl warning:
  "Macro argument reuse '$arg' - possible side-effects?"
Fix the warning by avoiding multiple macro argument use.

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dprc-driver.c  | 10 +++---
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 11 +++
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index d723c69..39c9a3b 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -21,9 +21,13 @@
 
 #define FSL_MC_DPRC_DRIVER_NAME"fsl_mc_dprc"
 
-#define FSL_MC_DEVICE_MATCH(_mc_dev, _obj_desc) \
-   (strcmp((_mc_dev)->obj_desc.type, (_obj_desc)->type) == 0 && \
-(_mc_dev)->obj_desc.id == (_obj_desc)->id)
+#define FSL_MC_DEVICE_MATCH(_mc_dev, _obj_desc)
\
+({ \
+   struct fsl_mc_device *__mc_dev = _mc_dev;   \
+   struct dprc_obj_desc *__obj_desc = _obj_desc;   \
+   (strcmp(__mc_dev->obj_desc.type, __obj_desc->type) == 0 &&  \
+   __mc_dev->obj_desc.id == __obj_desc->id);   \
+})
 
 struct dprc_child_objs {
int child_count;
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
index ce07096..d3def40 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c
@@ -17,10 +17,13 @@
 #include "dpcon-cmd.h"
 #include "fsl-mc-private.h"
 
-#define FSL_MC_IS_ALLOCATABLE(_obj_type) \
-   (strcmp(_obj_type, "dpbp") == 0 || \
-strcmp(_obj_type, "dpmcp") == 0 || \
-strcmp(_obj_type, "dpcon") == 0)
+#define FSL_MC_IS_ALLOCATABLE(_obj_type)   \
+({ \
+   const char *__obj_type = _obj_type; \
+   (strcmp(__obj_type, "dpbp") == 0 || \
+strcmp(__obj_type, "dpmcp") == 0 ||\
+strcmp(__obj_type, "dpcon") == 0); \
+})
 
 /**
  * fsl_mc_resource_pool_add_device - add allocatable object to a resource
-- 
2.9.4

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


[PATCH 04/10] staging: fsl-mc: drop a few useless #includes

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

Some #includes were needlessly done from header files.
Drop them from there and update the only .c file that
implicitly needed one of those #includes.

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 1 +
 drivers/staging/fsl-mc/bus/fsl-mc-private.h | 1 -
 drivers/staging/fsl-mc/include/dprc.h   | 2 --
 3 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
index b8b2c86..a92fa5a 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include "../include/mc-bus.h"
+#include "../include/mc-cmd.h"
 #include "fsl-mc-private.h"
 
 /*
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-private.h 
b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
index 5c49c9d..01ef9329 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h
@@ -11,7 +11,6 @@
 #define _FSL_MC_PRIVATE_H_
 
 #include "../include/mc.h"
-#include "../include/mc-bus.h"
 
 int __must_check fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
   struct fsl_mc_io *mc_io,
diff --git a/drivers/staging/fsl-mc/include/dprc.h 
b/drivers/staging/fsl-mc/include/dprc.h
index dc985cc..8498a5e 100644
--- a/drivers/staging/fsl-mc/include/dprc.h
+++ b/drivers/staging/fsl-mc/include/dprc.h
@@ -33,8 +33,6 @@
 #ifndef _FSL_DPRC_H
 #define _FSL_DPRC_H
 
-#include "mc-cmd.h"
-
 /*
  * Data Path Resource Container API
  * Contains DPRC API for managing and querying DPAA resources
-- 
2.9.4

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


[PATCH 01/10] staging: fsl-mc: enclose macro params in parens

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

Several macros didn't had macro params enclosed
in parens. Fix them to avoid precedence issues.

Found with checkpatch.pl who was issuing this
message:
  "Macro argument 'id' may be better as '(id)'
   to avoid precedence issues"

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dpbp-cmd.h  | 2 +-
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h | 2 +-
 drivers/staging/fsl-mc/bus/dpmng-cmd.h | 2 +-
 drivers/staging/fsl-mc/bus/dprc-cmd.h  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 8aa6545..5904836 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -40,7 +40,7 @@
 #define DPBP_CMD_BASE_VERSION  1
 #define DPBP_CMD_ID_OFFSET 4
 
-#define DPBP_CMD(id)   ((id << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
+#define DPBP_CMD(id)   (((id) << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
 
 /* Command IDs */
 #define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index 384a13d..861b2a7 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -40,7 +40,7 @@
 #define DPMCP_CMD_BASE_VERSION 1
 #define DPMCP_CMD_ID_OFFSET4
 
-#define DPMCP_CMD(id)  ((id << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
+#define DPMCP_CMD(id)  (((id) << DPMCP_CMD_ID_OFFSET) | DPMCP_CMD_BASE_VERSION)
 
 /* Command IDs */
 #define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
diff --git a/drivers/staging/fsl-mc/bus/dpmng-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmng-cmd.h
index cdddfb8..d1f04ac 100644
--- a/drivers/staging/fsl-mc/bus/dpmng-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmng-cmd.h
@@ -44,7 +44,7 @@
 #define DPMNG_CMD_BASE_VERSION 1
 #define DPMNG_CMD_ID_OFFSET4
 
-#define DPMNG_CMD(id)  ((id << DPMNG_CMD_ID_OFFSET) | DPMNG_CMD_BASE_VERSION)
+#define DPMNG_CMD(id)  (((id) << DPMNG_CMD_ID_OFFSET) | DPMNG_CMD_BASE_VERSION)
 
 /* Command IDs */
 #define DPMNG_CMDID_GET_VERSIONDPMNG_CMD(0x831)
diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h 
b/drivers/staging/fsl-mc/bus/dprc-cmd.h
index e9fdca4..d9b2dcd 100644
--- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
@@ -48,7 +48,7 @@
 #define DPRC_CMD_BASE_VERSION  1
 #define DPRC_CMD_ID_OFFSET 4
 
-#define DPRC_CMD(id)   ((id << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
+#define DPRC_CMD(id)   (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
 
 /* Command IDs */
 #define DPRC_CMDID_CLOSEDPRC_CMD(0x800)
-- 
2.9.4

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


[PATCH v6 00/10] staging: fsl-mc: move bus driver out of staging

2017-05-31 Thread laurentiu.tudor
From: Laurentiu Tudor 

Now that there is a functional ethernet driver probed on the
mc bus this patch series requests that the fsl-mc bus driver
be moved out of staging.

The proposed destination for the bus driver is drivers/bus.
Proposed location for global header files for fsl-mc and dpaa2
is the already existing include/linux/fsl.

First couple of patches fix several checkpatch.pl and README issues
and the last patch moves the bus out of staging, updating all
the users (e.g. #include paths).

Based on:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git, staging-next

Link to previous version:
https://lkml.org/lkml/2017/5/22/327

Link to last round of driver model fixes & cleanups:
https://lkml.org/lkml/2017/2/1/235

version 6 changes
 - split patch containing multiple checkpatch.pl fixes into distinct patches 
(GregKH)
 - fix couple submission issues (GregKH)
   - reverted version bump on patches that weren't actually changed
   - fix version prefix

version 5 changes
 - drop restool utility reference from README (Marc Zyngier)
 - add binding path in README (Marc Zyngier)

version 4 changes
 - rebased on latest staging-next
 - dpio was submitted separately so dropped from the series
 - several checkpatch.pl --strict fixes (first 2 patches)
 - update existing dpaa2 drivers to match the new fsl-mc bus location

version 3 changes
   -zero memory allocated for a dpio store
   -replace hardcoded dequeue token with a #define and look for
that token when checking for a new result

version 2 changes (mostly feedback from Ioana Radulescu)
   -removed unused structs and defines in dpio command definitions
   -added setter/getter for the FD ctrl field
   -corrected comment for SG format_offset field description
   -added support for short length field in FD
   -fix bug in buffer release command, by setting bpid field
   -handle error (NULL) return value from qbman_swp_mc_complete()
   -fix bug in sending management commands where the verb was
properly initialized
   -use service_select_by_cpu() for re-arming DPIO interrupts
   -replace use of NR_CPUS with num_possible_cpus()
   -handle error case where number of DPIOs exceeds number of possible
CPUs
   -error message cleanup
   -updated MAINTAINERS file with proper location for both fsl-mc bus
driver and dpio driver
Laurentiu Tudor (9):
  staging: fsl-mc: enclose macro params in parens
  staging: fsl-mc: fix macros with possible side effects
  staging: fsl-mc: simplify couple of deallocations
  staging: fsl-mc: drop a few useless #includes
  staging: fsl-mc: remove extra blank line
  staging: fsl-mc: drop unused forward declaration
  staging: fsl-mc: add binding path to MAINTAINERS
  staging: fsl-mc: drop reference to restool
  staging: fsl-mc: add reference to mc-bus DT binding

Stuart Yoder (1):
  staging: fsl-mc: move bus driver out of staging

 .../README.txt => Documentation/dpaa2/overview.txt|  6 +++---
 MAINTAINERS   |  3 ++-
 drivers/bus/Kconfig   |  2 ++
 drivers/bus/Makefile  |  3 +++
 drivers/bus/fsl-mc/Kconfig| 17 +
 drivers/bus/fsl-mc/Makefile   | 19 +++
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp-cmd.h |  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpbp.c |  6 +++---
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp-cmd.h|  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.c|  4 ++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmcp.h|  0
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dpmng-cmd.h|  2 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dpmng.c|  6 +++---
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc-cmd.h |  2 +-
 .../{staging/fsl-mc/bus => bus/fsl-mc}/dprc-driver.c  | 14 +-
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/dprc.c |  6 +++---
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-allocator.c  | 17 ++---
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-bus.c   | 18 ++
 .../{staging/fsl-mc/bus => bus/fsl-mc}/fsl-mc-msi.c   |  4 +++-
 .../fsl-mc/bus => bus/fsl-mc}/fsl-mc-private.h|  3 +--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-io.c|  5 +++--
 drivers/{staging/fsl-mc/bus => bus/fsl-mc}/mc-sys.c   |  6 +++---
 drivers/irqchip/Makefile  |  1 +
 .../bus => irqchip}/irq-gic-v3-its-fsl-mc-msi.c   |  3 +--
 drivers/staging/fsl-dpaa2/ethernet/README |  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c|  4 ++--
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h|  2 +-
 drivers/staging/fsl-dpaa2/ethernet/dpni.c |  4 ++--
 drivers/staging/fsl-mc/TODO   | 18 --
 drivers/staging/fsl-mc/bus/Kconfig| 10 --
 drivers/staging/fsl-mc/bus/Makefile   | 15 +--
 drivers/staging/fsl-mc/bus/dp

[PATCH] libcfs: Fix a sleep-in-atomic bug in cfs_percpt_lock and cfs_percpt_unlock

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is:
cfs_percpt_lock/cfs_percpt_unlock (acquire the lock by spin_lock)
  LASSERT
lbug_with_loc
  libcfs_debug_dumplog
schedule and kthread_run --> may sleep

To fix it, all "LASSERT" is placed out of the spin_lock and spin_unlock.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/lustre/lnet/libcfs/libcfs_lock.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_lock.c 
b/drivers/staging/lustre/lnet/libcfs/libcfs_lock.c
index 1967b97c..a2ce092f 100644
--- a/drivers/staging/lustre/lnet/libcfs/libcfs_lock.c
+++ b/drivers/staging/lustre/lnet/libcfs/libcfs_lock.c
@@ -113,9 +113,10 @@ struct cfs_percpt_lock *
 
/* exclusive lock request */
for (i = 0; i < ncpt; i++) {
+   if (!i)
+   LASSERT(!pcl->pcl_locked);
spin_lock(pcl->pcl_locks[i]);
if (!i) {
-   LASSERT(!pcl->pcl_locked);
/* nobody should take private lock after this
 * so I wouldn't starve for too long time
 */
@@ -141,11 +142,11 @@ struct cfs_percpt_lock *
}
 
for (i = ncpt - 1; i >= 0; i--) {
-   if (!i) {
-   LASSERT(pcl->pcl_locked);
+   if (!i)
pcl->pcl_locked = 0;
-   }
spin_unlock(pcl->pcl_locks[i]);
+   if (!i)
+   LASSERT(pcl->pcl_locked);
}
 }
 EXPORT_SYMBOL(cfs_percpt_unlock);
-- 
1.7.9.5


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


[PATCH] libcfs: Fix a sleep-in-atomic bug in cfs_wi_scheduler

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is:
cfs_wi_scheduler (acquire the lock by spin_lock)
  LASSERT
lbug_with_loc
  libcfs_debug_dumplog
schedule and kthread_run --> may sleep

To fix it, all "LASSERT" is placed out of the spin_lock and spin_unlock.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/lustre/lnet/libcfs/workitem.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/workitem.c 
b/drivers/staging/lustre/lnet/libcfs/workitem.c
index dbc2a9b..9f7832e 100644
--- a/drivers/staging/lustre/lnet/libcfs/workitem.c
+++ b/drivers/staging/lustre/lnet/libcfs/workitem.c
@@ -212,9 +212,9 @@ static int cfs_wi_scheduler(void *arg)
CWARN("Unable to bind %s on CPU partition %d\n",
  sched->ws_name, sched->ws_cpt);
 
+   LASSERT(sched->ws_starting == 1);
spin_lock(&cfs_wi_data.wi_glock);
 
-   LASSERT(sched->ws_starting == 1);
sched->ws_starting--;
sched->ws_nthreads++;
 
@@ -231,11 +231,14 @@ static int cfs_wi_scheduler(void *arg)
   nloops < CFS_WI_RESCHED) {
wi = list_entry(sched->ws_runq.next,
struct cfs_workitem, wi_list);
+
+   spin_unlock(&sched->ws_lock);
LASSERT(wi->wi_scheduled && !wi->wi_running);
+   LASSERT(sched->ws_nscheduled > 0);
+   spin_lock(&sched->ws_lock);
 
list_del_init(&wi->wi_list);
 
-   LASSERT(sched->ws_nscheduled > 0);
sched->ws_nscheduled--;
 
wi->wi_running = 1;
@@ -254,7 +257,10 @@ static int cfs_wi_scheduler(void *arg)
if (list_empty(&wi->wi_list))
continue;
 
+   spin_unlock(&sched->ws_lock);
LASSERT(wi->wi_scheduled);
+   spin_lock(&sched->ws_lock);
+
/* wi is rescheduled, should be on rerunq now, we
 * move it to runq so it can run action now
 */
-- 
1.7.9.5


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


[PATCH V2] libcfs: Fix a sleep-in-atomic bug in cfs_wi_deschedule

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is:
cfs_wi_deschedule (acquire the lock by spin_lock)
  LASSERT
lbug_with_loc
  libcfs_debug_dumplog
schedule and kthread_run --> may sleep

To fix it, all "LASSERT" is placed out of the spin_lock and spin_unlock.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/lustre/lnet/libcfs/workitem.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/workitem.c 
b/drivers/staging/lustre/lnet/libcfs/workitem.c
index dbc2a9b..9c530cf 100644
--- a/drivers/staging/lustre/lnet/libcfs/workitem.c
+++ b/drivers/staging/lustre/lnet/libcfs/workitem.c
@@ -140,6 +140,10 @@ struct cfs_wi_sched {
 
LASSERT(!in_interrupt()); /* because we use plain spinlock */
LASSERT(!sched->ws_stopping);
+   if (wi->wi_scheduled) {
+   LASSERT(!list_empty(&wi->wi_list));
+   LASSERT(sched->ws_nscheduled > 0);
+   }
 
/*
 * return 0 if it's running already, otherwise return 1, which
@@ -151,18 +155,14 @@ struct cfs_wi_sched {
rc = !(wi->wi_running);
 
if (wi->wi_scheduled) { /* cancel pending schedules */
-   LASSERT(!list_empty(&wi->wi_list));
list_del_init(&wi->wi_list);
-
-   LASSERT(sched->ws_nscheduled > 0);
sched->ws_nscheduled--;
-
wi->wi_scheduled = 0;
}
 
-   LASSERT(list_empty(&wi->wi_list));
-
spin_unlock(&sched->ws_lock);
+
+   LASSERT(list_empty(&wi->wi_list));
return rc;
 }
 EXPORT_SYMBOL(cfs_wi_deschedule);
-- 
1.7.9.5


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


[PATCH] libcfs: Fix a sleep-in-atomic bug in cfs_wi_schedule

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is:
cfs_wi_schedule (acquire the lock by spin_lock)
  LASSERT
lbug_with_loc
  libcfs_debug_dumplog
schedule and kthread_run --> may sleep

To fix it, all "LASSERT" is placed out of the spin_lock and spin_unlock.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/lustre/lnet/libcfs/workitem.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/workitem.c 
b/drivers/staging/lustre/lnet/libcfs/workitem.c
index dbc2a9b..30d28cd 100644
--- a/drivers/staging/lustre/lnet/libcfs/workitem.c
+++ b/drivers/staging/lustre/lnet/libcfs/workitem.c
@@ -179,12 +179,12 @@ struct cfs_wi_sched {
 {
LASSERT(!in_interrupt()); /* because we use plain spinlock */
LASSERT(!sched->ws_stopping);
+   if (!wi->wi_scheduled)
+   LASSERT(list_empty(&wi->wi_list));
 
spin_lock(&sched->ws_lock);
 
if (!wi->wi_scheduled) {
-   LASSERT(list_empty(&wi->wi_list));
-
wi->wi_scheduled = 1;
sched->ws_nscheduled++;
if (!wi->wi_running) {
@@ -195,8 +195,8 @@ struct cfs_wi_sched {
}
}
 
-   LASSERT(!list_empty(&wi->wi_list));
spin_unlock(&sched->ws_lock);
+   LASSERT(!list_empty(&wi->wi_list));
 }
 EXPORT_SYMBOL(cfs_wi_schedule);
 
-- 
1.7.9.5


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


[PATCH] libcfs: Fix a sleep-in-atomic bug in cfs_wi_sched_destroy

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is:
cfs_wi_sched_destroy (acquire the lock by spin_lock)
  LASSERT
lbug_with_loc
  libcfs_debug_dumplog
schedule and kthread_run --> may sleep

To fix it, all "LASSERT" is placed out of the spin_lock and spin_unlock.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/lustre/lnet/libcfs/workitem.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/workitem.c 
b/drivers/staging/lustre/lnet/libcfs/workitem.c
index dbc2a9b..e0424f6 100644
--- a/drivers/staging/lustre/lnet/libcfs/workitem.c
+++ b/drivers/staging/lustre/lnet/libcfs/workitem.c
@@ -302,11 +302,12 @@ static int cfs_wi_scheduler(void *arg)
return;
}
 
-   LASSERT(!list_empty(&sched->ws_list));
sched->ws_stopping = 1;
 
spin_unlock(&cfs_wi_data.wi_glock);
 
+   LASSERT(!list_empty(&sched->ws_list));
+
i = 2;
wake_up_all(&sched->ws_waitq);
 
-- 
1.7.9.5


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


[PATCH V2] libcfs: Fix a sleep-in-atomic bug in cfs_wi_exit

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is:
cfs_wi_exit (acquire the lock by spin_lock)
  LASSERT
lbug_with_loc
  libcfs_debug_dumplog
schedule and kthread_run --> may sleep

To fix it, all "LASSERT" is placed out of the spin_lock and spin_unlock.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/lustre/lnet/libcfs/workitem.c |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/workitem.c 
b/drivers/staging/lustre/lnet/libcfs/workitem.c
index dbc2a9b..928d06d 100644
--- a/drivers/staging/lustre/lnet/libcfs/workitem.c
+++ b/drivers/staging/lustre/lnet/libcfs/workitem.c
@@ -111,22 +111,23 @@ struct cfs_wi_sched {
 {
LASSERT(!in_interrupt()); /* because we use plain spinlock */
LASSERT(!sched->ws_stopping);
+   LASSERT(wi->wi_running);
+   if (wi->wi_scheduled) {
+   LASSERT(!list_empty(&wi->wi_list));
+   LASSERT(sched->ws_nscheduled > 0);
+   }
 
spin_lock(&sched->ws_lock);
 
-   LASSERT(wi->wi_running);
if (wi->wi_scheduled) { /* cancel pending schedules */
-   LASSERT(!list_empty(&wi->wi_list));
list_del_init(&wi->wi_list);
-
-   LASSERT(sched->ws_nscheduled > 0);
sched->ws_nscheduled--;
}
 
-   LASSERT(list_empty(&wi->wi_list));
-
wi->wi_scheduled = 1; /* LBUG future schedule attempts */
spin_unlock(&sched->ws_lock);
+
+   LASSERT(list_empty(&wi->wi_list));
 }
 EXPORT_SYMBOL(cfs_wi_exit);
 
-- 
1.7.9.5


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


[PATCH] libcfs: Fix a sleep-in-atomic bug in cfs_wi_deschedule

2017-05-31 Thread Jia-Ju Bai
The driver may sleep under a spin lock, and the function call path is:
cfs_wi_deschedule (acquire the lock by spin_lock)
  LASSERT
lbug_with_loc
  libcfs_debug_dumplog
schedule and kthread_run --> may sleep

To fix it, all "LASSERT" is placed out of the spin_lock and spin_unlock.

Signed-off-by: Jia-Ju Bai 
---
 drivers/staging/lustre/lnet/libcfs/workitem.c |   11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/workitem.c 
b/drivers/staging/lustre/lnet/libcfs/workitem.c
index dbc2a9b..7e25eb9 100644
--- a/drivers/staging/lustre/lnet/libcfs/workitem.c
+++ b/drivers/staging/lustre/lnet/libcfs/workitem.c
@@ -140,6 +140,11 @@ struct cfs_wi_sched {
 
LASSERT(!in_interrupt()); /* because we use plain spinlock */
LASSERT(!sched->ws_stopping);
+   if (wi->wi_scheduled) {
+   LASSERT(!list_empty(&wi->wi_list));
+   LASSERT(sched->ws_nscheduled > 0);
+   }
+   LASSERT(list_empty(&wi->wi_list));
 
/*
 * return 0 if it's running already, otherwise return 1, which
@@ -151,17 +156,11 @@ struct cfs_wi_sched {
rc = !(wi->wi_running);
 
if (wi->wi_scheduled) { /* cancel pending schedules */
-   LASSERT(!list_empty(&wi->wi_list));
list_del_init(&wi->wi_list);
-
-   LASSERT(sched->ws_nscheduled > 0);
sched->ws_nscheduled--;
-
wi->wi_scheduled = 0;
}
 
-   LASSERT(list_empty(&wi->wi_list));
-
spin_unlock(&sched->ws_lock);
return rc;
 }
-- 
1.7.9.5


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