RE: [PATCH] dma-buf/reservation: shouldn't kfree staged when slot available

2018-03-04 Thread Liu, Monk
Hi Christian

You are right on that part of obj-staged is set to NULL in add_fence, 
So my following question will be why we kfree(obj->staged) in reserve_shared() 
if staged is always NULL in that point ?

Thanks 
/Monk

-Original Message-
From: Christian König [mailto:ckoenig.leichtzumer...@gmail.com] 
Sent: 2018年2月28日 16:27
To: Liu, Monk ; dri-de...@lists.freedesktop.org; 
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-buf/reservation: shouldn't kfree staged when slot 
available

Am 28.02.2018 um 07:44 schrieb Monk Liu:
> under below scenario the obj->fence would refer to a wild pointer:
>
> 1,call reservation_object_reserved_shared
> 2,call reservation_object_add_shared_fence
> 3,call reservation_object_reserved_shared
> 4,call reservation_object_add_shared_fence
>
> in step 1, staged is allocated,
>
> in step 2, code path will go reservation_object_add_shared_replace()
> and obj->fence would be assigned as staged (through RCU_INIT_POINTER)
>
> in step 3, obj->staged will be freed(by simple kfree), which make 
> obj->fence point to a wild pointer...


Well that explanation is still nonsense. See
reservation_object_add_shared_fence:
>     obj->staged = NULL;

Among the first things reservation_object_add_shared_fence() does is it 
sets obj->staged to NULL.

So step 3 will not free anything and we never have a wild pointer.

Regards,
Christian.

>
> in step 4, code path will go reservation_object_add_shared_inplace()
> and inside it the @fobj (which equals to @obj->staged, set by above steps)
> is already a wild pointer
>
> should remov the kfree on staged in reservation_object_reserve_shared()
>
> Change-Id: If7c01f1b4be3d3d8a81efa90216841f79ab1fc1c
> Signed-off-by: Monk Liu 
> ---
>   drivers/dma-buf/reservation.c | 7 ++-
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index 375de41..b473ccc 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -74,12 +74,9 @@ int reservation_object_reserve_shared(struct 
> reservation_object *obj)
>   old = reservation_object_get_list(obj);
>   
>   if (old && old->shared_max) {
> - if (old->shared_count < old->shared_max) {
> - /* perform an in-place update */
> - kfree(obj->staged);
> - obj->staged = NULL;
> + if (old->shared_count < old->shared_max)
>   return 0;
> - } else
> + else
>   max = old->shared_max * 2;
>   } else
>   max = 4;



RE: [PATCH] dma-buf/reservation: shouldn't kfree staged when slot available

2018-03-04 Thread Liu, Monk
Hi Christian

You are right on that part of obj-staged is set to NULL in add_fence, 
So my following question will be why we kfree(obj->staged) in reserve_shared() 
if staged is always NULL in that point ?

Thanks 
/Monk

-Original Message-
From: Christian König [mailto:ckoenig.leichtzumer...@gmail.com] 
Sent: 2018年2月28日 16:27
To: Liu, Monk ; dri-de...@lists.freedesktop.org; 
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-buf/reservation: shouldn't kfree staged when slot 
available

Am 28.02.2018 um 07:44 schrieb Monk Liu:
> under below scenario the obj->fence would refer to a wild pointer:
>
> 1,call reservation_object_reserved_shared
> 2,call reservation_object_add_shared_fence
> 3,call reservation_object_reserved_shared
> 4,call reservation_object_add_shared_fence
>
> in step 1, staged is allocated,
>
> in step 2, code path will go reservation_object_add_shared_replace()
> and obj->fence would be assigned as staged (through RCU_INIT_POINTER)
>
> in step 3, obj->staged will be freed(by simple kfree), which make 
> obj->fence point to a wild pointer...


Well that explanation is still nonsense. See
reservation_object_add_shared_fence:
>     obj->staged = NULL;

Among the first things reservation_object_add_shared_fence() does is it 
sets obj->staged to NULL.

So step 3 will not free anything and we never have a wild pointer.

Regards,
Christian.

>
> in step 4, code path will go reservation_object_add_shared_inplace()
> and inside it the @fobj (which equals to @obj->staged, set by above steps)
> is already a wild pointer
>
> should remov the kfree on staged in reservation_object_reserve_shared()
>
> Change-Id: If7c01f1b4be3d3d8a81efa90216841f79ab1fc1c
> Signed-off-by: Monk Liu 
> ---
>   drivers/dma-buf/reservation.c | 7 ++-
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index 375de41..b473ccc 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -74,12 +74,9 @@ int reservation_object_reserve_shared(struct 
> reservation_object *obj)
>   old = reservation_object_get_list(obj);
>   
>   if (old && old->shared_max) {
> - if (old->shared_count < old->shared_max) {
> - /* perform an in-place update */
> - kfree(obj->staged);
> - obj->staged = NULL;
> + if (old->shared_count < old->shared_max)
>   return 0;
> - } else
> + else
>   max = old->shared_max * 2;
>   } else
>   max = 4;



Re: [PATCH v2 2/4] rtc: isl1208: switch to rtc_register_device

2018-03-04 Thread Denis OSTERLAND
Hi,

an obvious mistake by me.
isl1208 is introduced in patch 3/4.
I will send v3.
Sorry for that.

Regards Denis

Am Samstag, den 03.03.2018, 10:35 +0800 schrieb kbuild test robot:
> Hi Denis,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on abelloni/rtc-next]
> [also build test ERROR on v4.16-rc3 next-20180302]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
> 
> url:
> https://github.com/0day-ci/linux/commits/Denis-OSTERLAND/rtc-isl1208-fixes-documentation-and-isl1219-support/20180303-093405
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git 
> rtc-next
> config: x86_64-randconfig-x017-201808 (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64 
> 
> Note: the 
> linux-review/Denis-OSTERLAND/rtc-isl1208-fixes-documentation-and-isl1219-support/20180303-093405
>  HEAD 1d3cf882ecd061847968da1511ec956b9bf70d33 builds fine.
>   It only hurts bisectibility.
> 
> All error/warnings (new ones prefixed by >>):
> 
>    In file included from drivers/rtc/rtc-isl1208.c:16:0:
>    drivers/rtc/rtc-isl1208.c: In function 'isl1208_probe':
> > 
> > > 
> > > drivers/rtc/rtc-isl1208.c:677:29: error: 'isl1208' undeclared (first use 
> > > in this function)
>  return rtc_register_device(isl1208->rtc);
> ^
>    include/linux/rtc.h:261:37: note: in definition of macro 
> 'rtc_register_device'
>  __rtc_register_device(THIS_MODULE, device)
> ^~
>    drivers/rtc/rtc-isl1208.c:677:29: note: each undeclared identifier is 
> reported only once for each function it appears in
>  return rtc_register_device(isl1208->rtc);
> ^
>    include/linux/rtc.h:261:37: note: in definition of macro 
> 'rtc_register_device'
>  __rtc_register_device(THIS_MODULE, device)
> ^~
> > 
> > > 
> > > drivers/rtc/rtc-isl1208.c:678:1: warning: control reaches end of non-void 
> > > function [-Wreturn-type]
> }
> ^
> 
> vim +/isl1208 +677 drivers/rtc/rtc-isl1208.c
> 
>    625
>    626static int
>    627isl1208_probe(struct i2c_client *client, const struct 
> i2c_device_id *id)
>    628{
>    629int rc = 0;
>    630struct rtc_device *rtc;
>    631
>    632if (!i2c_check_functionality(client->adapter, 
> I2C_FUNC_I2C))
>    633return -ENODEV;
>    634
>    635if (isl1208_i2c_validate_client(client) < 0)
>    636return -ENODEV;
>    637
>    638rtc = devm_rtc_allocate_device(>dev);
>    639if (IS_ERR(rtc))
>    640return PTR_ERR(rtc);
>    641
>    642rtc->ops = _rtc_ops;
>    643
>    644i2c_set_clientdata(client, rtc);
>    645
>    646rc = isl1208_i2c_get_sr(client);
>    647if (rc < 0) {
>    648dev_err(>dev, "reading status 
> failed\n");
>    649return rc;
>    650}
>    651
>    652if (rc & ISL1208_REG_SR_RTCF)
>    653dev_warn(>dev, "rtc power failure 
> detected, "
>    654 "please set clock.\n");
>    655
>    656rc = sysfs_create_group(>dev.kobj, 
> _rtc_sysfs_files);
>    657if (rc)
>    658return rc;
>    659
>    660if (client->irq > 0) {
>    661rc = devm_request_threaded_irq(>dev, 
> client->irq, NULL,
>    662   
> isl1208_rtc_interrupt,
>    663   IRQF_SHARED | 
> IRQF_ONESHOT,
>    664   
> isl1208_driver.driver.name,
>    665   client);
>    666if (!rc) {
>    667device_init_wakeup(>dev, 1);
>    668enable_irq_wake(client->irq);
>    669} else {
>    670dev_err(>dev,
>    671"Unable to request irq %d, no 
> alarm support\n",
>    672client->irq);
>    673client->irq = 0;
>    674}
>    675}
>    676
>  > 677return rtc_register_device(isl1208->rtc);
>  > 678}
>    679
> 
> ---
> 0-DAY kernel test infrastructureOpen Source Technology 

Re: [PATCH v2 2/4] rtc: isl1208: switch to rtc_register_device

2018-03-04 Thread Denis OSTERLAND
Hi,

an obvious mistake by me.
isl1208 is introduced in patch 3/4.
I will send v3.
Sorry for that.

Regards Denis

Am Samstag, den 03.03.2018, 10:35 +0800 schrieb kbuild test robot:
> Hi Denis,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on abelloni/rtc-next]
> [also build test ERROR on v4.16-rc3 next-20180302]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]
> 
> url:
> https://github.com/0day-ci/linux/commits/Denis-OSTERLAND/rtc-isl1208-fixes-documentation-and-isl1219-support/20180303-093405
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git 
> rtc-next
> config: x86_64-randconfig-x017-201808 (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=x86_64 
> 
> Note: the 
> linux-review/Denis-OSTERLAND/rtc-isl1208-fixes-documentation-and-isl1219-support/20180303-093405
>  HEAD 1d3cf882ecd061847968da1511ec956b9bf70d33 builds fine.
>   It only hurts bisectibility.
> 
> All error/warnings (new ones prefixed by >>):
> 
>    In file included from drivers/rtc/rtc-isl1208.c:16:0:
>    drivers/rtc/rtc-isl1208.c: In function 'isl1208_probe':
> > 
> > > 
> > > drivers/rtc/rtc-isl1208.c:677:29: error: 'isl1208' undeclared (first use 
> > > in this function)
>  return rtc_register_device(isl1208->rtc);
> ^
>    include/linux/rtc.h:261:37: note: in definition of macro 
> 'rtc_register_device'
>  __rtc_register_device(THIS_MODULE, device)
> ^~
>    drivers/rtc/rtc-isl1208.c:677:29: note: each undeclared identifier is 
> reported only once for each function it appears in
>  return rtc_register_device(isl1208->rtc);
> ^
>    include/linux/rtc.h:261:37: note: in definition of macro 
> 'rtc_register_device'
>  __rtc_register_device(THIS_MODULE, device)
> ^~
> > 
> > > 
> > > drivers/rtc/rtc-isl1208.c:678:1: warning: control reaches end of non-void 
> > > function [-Wreturn-type]
> }
> ^
> 
> vim +/isl1208 +677 drivers/rtc/rtc-isl1208.c
> 
>    625
>    626static int
>    627isl1208_probe(struct i2c_client *client, const struct 
> i2c_device_id *id)
>    628{
>    629int rc = 0;
>    630struct rtc_device *rtc;
>    631
>    632if (!i2c_check_functionality(client->adapter, 
> I2C_FUNC_I2C))
>    633return -ENODEV;
>    634
>    635if (isl1208_i2c_validate_client(client) < 0)
>    636return -ENODEV;
>    637
>    638rtc = devm_rtc_allocate_device(>dev);
>    639if (IS_ERR(rtc))
>    640return PTR_ERR(rtc);
>    641
>    642rtc->ops = _rtc_ops;
>    643
>    644i2c_set_clientdata(client, rtc);
>    645
>    646rc = isl1208_i2c_get_sr(client);
>    647if (rc < 0) {
>    648dev_err(>dev, "reading status 
> failed\n");
>    649return rc;
>    650}
>    651
>    652if (rc & ISL1208_REG_SR_RTCF)
>    653dev_warn(>dev, "rtc power failure 
> detected, "
>    654 "please set clock.\n");
>    655
>    656rc = sysfs_create_group(>dev.kobj, 
> _rtc_sysfs_files);
>    657if (rc)
>    658return rc;
>    659
>    660if (client->irq > 0) {
>    661rc = devm_request_threaded_irq(>dev, 
> client->irq, NULL,
>    662   
> isl1208_rtc_interrupt,
>    663   IRQF_SHARED | 
> IRQF_ONESHOT,
>    664   
> isl1208_driver.driver.name,
>    665   client);
>    666if (!rc) {
>    667device_init_wakeup(>dev, 1);
>    668enable_irq_wake(client->irq);
>    669} else {
>    670dev_err(>dev,
>    671"Unable to request irq %d, no 
> alarm support\n",
>    672client->irq);
>    673client->irq = 0;
>    674}
>    675}
>    676
>  > 677return rtc_register_device(isl1208->rtc);
>  > 678}
>    679
> 
> ---
> 0-DAY kernel test infrastructureOpen Source Technology 

Re: [PATCH v2] mmc: Export host capabilities to debugfs.

2018-03-04 Thread Shawn Lin

On 2018/3/5 12:24, Harish Jenny K N wrote:

From: Abbas Raza 

This patch exports the host capabilities to debugfs

Signed-off-by: Abbas Raza 
Signed-off-by: Andrew Gabbasov 
Signed-off-by: Harish Jenny K N 
---

Changes in v2:
- Changed Author

  drivers/mmc/core/debugfs.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index c51e0c0..fa2df7f 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -289,6 +289,9 @@ void mmc_add_card_debugfs(struct mmc_card *card)
  
  	card->debugfs_root = root;
  
+	if (!debugfs_create_x32("host_caps", S_IRUSR, root, (u32 *)>caps))


Perhaps you don't need cast, and '>caps' should be fine?
And you don't need to export host->caps2?


+   goto err;
+
if (!debugfs_create_x32("state", S_IRUSR, root, >state))
goto err;
  





Re: [PATCH v2] mmc: Export host capabilities to debugfs.

2018-03-04 Thread Shawn Lin

On 2018/3/5 12:24, Harish Jenny K N wrote:

From: Abbas Raza 

This patch exports the host capabilities to debugfs

Signed-off-by: Abbas Raza 
Signed-off-by: Andrew Gabbasov 
Signed-off-by: Harish Jenny K N 
---

Changes in v2:
- Changed Author

  drivers/mmc/core/debugfs.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index c51e0c0..fa2df7f 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -289,6 +289,9 @@ void mmc_add_card_debugfs(struct mmc_card *card)
  
  	card->debugfs_root = root;
  
+	if (!debugfs_create_x32("host_caps", S_IRUSR, root, (u32 *)>caps))


Perhaps you don't need cast, and '>caps' should be fine?
And you don't need to export host->caps2?


+   goto err;
+
if (!debugfs_create_x32("state", S_IRUSR, root, >state))
goto err;
  





[PATCH 03/11] Staging: iio: accel: Remove unnecessary comments

2018-03-04 Thread Himanshu Jha
Remove unnecessary comments since the definitions are pretty clear
with their macro names.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 82 +--
 1 file changed, 10 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 0fae8aa..59c1166 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -20,87 +20,42 @@
 #include 
 #include 
 
-#define ADIS16201_STARTUP_DELAY220 /* ms */
+#define ADIS16201_STARTUP_DELAY220
 
-/* Flash memory write count */
 #define ADIS16201_FLASH_CNT  0x00
 
-/* Output, power supply */
+/* Data Output Register Information */
 #define ADIS16201_SUPPLY_OUT 0x02
-
-/* Output, x-axis accelerometer */
 #define ADIS16201_XACCL_OUT  0x04
-
-/* Output, y-axis accelerometer */
 #define ADIS16201_YACCL_OUT  0x06
-
-/* Output, auxiliary ADC input */
 #define ADIS16201_AUX_ADC0x08
-
-/* Output, temperature */
 #define ADIS16201_TEMP_OUT   0x0A
-
-/* Output, x-axis inclination */
 #define ADIS16201_XINCL_OUT  0x0C
-
-/* Output, y-axis inclination */
 #define ADIS16201_YINCL_OUT  0x0E
 
-/* Calibration, x-axis acceleration offset */
+/* Calibration Register Definition */
 #define ADIS16201_XACCL_OFFS 0x10
-
-/* Calibration, y-axis acceleration offset */
 #define ADIS16201_YACCL_OFFS 0x12
-
-/* x-axis acceleration scale factor */
 #define ADIS16201_XACCL_SCALE0x14
-
-/* y-axis acceleration scale factor */
 #define ADIS16201_YACCL_SCALE0x16
-
-/* Calibration, x-axis inclination offset */
 #define ADIS16201_XINCL_OFFS 0x18
-
-/* Calibration, y-axis inclination offset */
 #define ADIS16201_YINCL_OFFS 0x1A
-
-/* x-axis inclination scale factor */
 #define ADIS16201_XINCL_SCALE0x1C
-
-/* y-axis inclination scale factor */
 #define ADIS16201_YINCL_SCALE0x1E
 
-/* Alarm 1 amplitude threshold */
+/* Alarm Register Definition */
 #define ADIS16201_ALM_MAG1   0x20
-
-/* Alarm 2 amplitude threshold */
 #define ADIS16201_ALM_MAG2   0x22
-
-/* Alarm 1, sample period */
 #define ADIS16201_ALM_SMPL1  0x24
-
-/* Alarm 2, sample period */
 #define ADIS16201_ALM_SMPL2  0x26
-
-/* Alarm control */
 #define ADIS16201_ALM_CTRL   0x28
 
-/* Auxiliary DAC data */
 #define ADIS16201_AUX_DAC0x30
-
-/* General-purpose digital input/output control */
 #define ADIS16201_GPIO_CTRL  0x32
-
-/* Miscellaneous control */
 #define ADIS16201_MSC_CTRL   0x34
 
-/* Internal sample period (rate) control */
 #define ADIS16201_SMPL_PRD   0x36
-
-/* Operation, filter configuration */
 #define ADIS16201_AVG_CNT0x38
-
-/* Operation, sleep mode control */
 #define ADIS16201_SLP_CNT0x3A
 
 /* Diagnostics, system status register */
@@ -109,42 +64,28 @@
 /* Operation, system command register */
 #define ADIS16201_GLOB_CMD   0x3E
 
-/* MSC_CTRL */
 
-/* Self-test enable */
 #define ADIS16201_MSC_CTRL_SELF_TEST_ENBIT(8)
 
-/* Data-ready enable: 1 = enabled, 0 = disabled */
 #define ADIS16201_MSC_CTRL_DATA_RDY_EN BIT(2)
 
-/* Data-ready polarity: 1 = active high, 0 = active low */
 #define ADIS16201_MSC_CTRL_ACTIVE_HIGH BIT(1)
 
-/* Data-ready line selection: 1 = DIO1, 0 = DIO0 */
 #define ADIS16201_MSC_CTRL_DATA_RDY_DIO1   BIT(0)
 
-/* DIAG_STAT */
 
-/* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */
 #define ADIS16201_DIAG_STAT_ALARM2BIT(9)
 
-/* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */
 #define ADIS16201_DIAG_STAT_ALARM1BIT(8)
 
-/* SPI communications failure */
 #define ADIS16201_DIAG_STAT_SPI_FAIL_BIT   3
 
-/* Flash update failure */
 #define ADIS16201_DIAG_STAT_FLASH_UPT_BIT  2
 
-/* Power supply above 3.625 V */
 #define ADIS16201_DIAG_STAT_POWER_HIGH_BIT 1
 
-/* Power supply below 3.15 V */
 #define ADIS16201_DIAG_STAT_POWER_LOW_BIT  0
 
-/* GLOB_CMD */
-
 #define ADIS16201_GLOB_CMD_SW_RESETBIT(7)
 #define ADIS16201_GLOB_CMD_FACTORY_CAL BIT(1)
 
@@ -187,30 +128,30 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
case IIO_VOLTAGE:
if (chan->channel == 0) {
*val = 1;
-   *val2 = 22; /* 1.22 mV */
+   *val2 = 22;
} else {
*val = 0;
-   *val2 = 61; /* 0.610 mV */
+   *val2 = 61;
}
return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP:
-   *val = -470; /* 0.47 C */
+   *val = -470;
*val2 = 0;
return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL:
*val = 0;
-   

[PATCH 03/11] Staging: iio: accel: Remove unnecessary comments

2018-03-04 Thread Himanshu Jha
Remove unnecessary comments since the definitions are pretty clear
with their macro names.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 82 +--
 1 file changed, 10 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 0fae8aa..59c1166 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -20,87 +20,42 @@
 #include 
 #include 
 
-#define ADIS16201_STARTUP_DELAY220 /* ms */
+#define ADIS16201_STARTUP_DELAY220
 
-/* Flash memory write count */
 #define ADIS16201_FLASH_CNT  0x00
 
-/* Output, power supply */
+/* Data Output Register Information */
 #define ADIS16201_SUPPLY_OUT 0x02
-
-/* Output, x-axis accelerometer */
 #define ADIS16201_XACCL_OUT  0x04
-
-/* Output, y-axis accelerometer */
 #define ADIS16201_YACCL_OUT  0x06
-
-/* Output, auxiliary ADC input */
 #define ADIS16201_AUX_ADC0x08
-
-/* Output, temperature */
 #define ADIS16201_TEMP_OUT   0x0A
-
-/* Output, x-axis inclination */
 #define ADIS16201_XINCL_OUT  0x0C
-
-/* Output, y-axis inclination */
 #define ADIS16201_YINCL_OUT  0x0E
 
-/* Calibration, x-axis acceleration offset */
+/* Calibration Register Definition */
 #define ADIS16201_XACCL_OFFS 0x10
-
-/* Calibration, y-axis acceleration offset */
 #define ADIS16201_YACCL_OFFS 0x12
-
-/* x-axis acceleration scale factor */
 #define ADIS16201_XACCL_SCALE0x14
-
-/* y-axis acceleration scale factor */
 #define ADIS16201_YACCL_SCALE0x16
-
-/* Calibration, x-axis inclination offset */
 #define ADIS16201_XINCL_OFFS 0x18
-
-/* Calibration, y-axis inclination offset */
 #define ADIS16201_YINCL_OFFS 0x1A
-
-/* x-axis inclination scale factor */
 #define ADIS16201_XINCL_SCALE0x1C
-
-/* y-axis inclination scale factor */
 #define ADIS16201_YINCL_SCALE0x1E
 
-/* Alarm 1 amplitude threshold */
+/* Alarm Register Definition */
 #define ADIS16201_ALM_MAG1   0x20
-
-/* Alarm 2 amplitude threshold */
 #define ADIS16201_ALM_MAG2   0x22
-
-/* Alarm 1, sample period */
 #define ADIS16201_ALM_SMPL1  0x24
-
-/* Alarm 2, sample period */
 #define ADIS16201_ALM_SMPL2  0x26
-
-/* Alarm control */
 #define ADIS16201_ALM_CTRL   0x28
 
-/* Auxiliary DAC data */
 #define ADIS16201_AUX_DAC0x30
-
-/* General-purpose digital input/output control */
 #define ADIS16201_GPIO_CTRL  0x32
-
-/* Miscellaneous control */
 #define ADIS16201_MSC_CTRL   0x34
 
-/* Internal sample period (rate) control */
 #define ADIS16201_SMPL_PRD   0x36
-
-/* Operation, filter configuration */
 #define ADIS16201_AVG_CNT0x38
-
-/* Operation, sleep mode control */
 #define ADIS16201_SLP_CNT0x3A
 
 /* Diagnostics, system status register */
@@ -109,42 +64,28 @@
 /* Operation, system command register */
 #define ADIS16201_GLOB_CMD   0x3E
 
-/* MSC_CTRL */
 
-/* Self-test enable */
 #define ADIS16201_MSC_CTRL_SELF_TEST_ENBIT(8)
 
-/* Data-ready enable: 1 = enabled, 0 = disabled */
 #define ADIS16201_MSC_CTRL_DATA_RDY_EN BIT(2)
 
-/* Data-ready polarity: 1 = active high, 0 = active low */
 #define ADIS16201_MSC_CTRL_ACTIVE_HIGH BIT(1)
 
-/* Data-ready line selection: 1 = DIO1, 0 = DIO0 */
 #define ADIS16201_MSC_CTRL_DATA_RDY_DIO1   BIT(0)
 
-/* DIAG_STAT */
 
-/* Alarm 2 status: 1 = alarm active, 0 = alarm inactive */
 #define ADIS16201_DIAG_STAT_ALARM2BIT(9)
 
-/* Alarm 1 status: 1 = alarm active, 0 = alarm inactive */
 #define ADIS16201_DIAG_STAT_ALARM1BIT(8)
 
-/* SPI communications failure */
 #define ADIS16201_DIAG_STAT_SPI_FAIL_BIT   3
 
-/* Flash update failure */
 #define ADIS16201_DIAG_STAT_FLASH_UPT_BIT  2
 
-/* Power supply above 3.625 V */
 #define ADIS16201_DIAG_STAT_POWER_HIGH_BIT 1
 
-/* Power supply below 3.15 V */
 #define ADIS16201_DIAG_STAT_POWER_LOW_BIT  0
 
-/* GLOB_CMD */
-
 #define ADIS16201_GLOB_CMD_SW_RESETBIT(7)
 #define ADIS16201_GLOB_CMD_FACTORY_CAL BIT(1)
 
@@ -187,30 +128,30 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
case IIO_VOLTAGE:
if (chan->channel == 0) {
*val = 1;
-   *val2 = 22; /* 1.22 mV */
+   *val2 = 22;
} else {
*val = 0;
-   *val2 = 61; /* 0.610 mV */
+   *val2 = 61;
}
return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP:
-   *val = -470; /* 0.47 C */
+   *val = -470;
*val2 = 0;
return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL:
*val = 0;
-   *val2 = 

[PATCH 06/11] Staging: iio: accel: Reverse christmas tree

2018-03-04 Thread Himanshu Jha
Prefer reverse christmas tree ordering of declarations to improve
readability.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 476b1c3..907fb85 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -243,9 +243,9 @@ static const struct adis_data adis16201_data = {
 
 static int adis16201_probe(struct spi_device *spi)
 {
-   int ret;
-   struct adis *st;
struct iio_dev *indio_dev;
+   struct adis *st;
+   int ret;
 
indio_dev = devm_iio_device_alloc(>dev, sizeof(*st));
if (!indio_dev)
-- 
2.7.4



[PATCH 06/11] Staging: iio: accel: Reverse christmas tree

2018-03-04 Thread Himanshu Jha
Prefer reverse christmas tree ordering of declarations to improve
readability.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 476b1c3..907fb85 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -243,9 +243,9 @@ static const struct adis_data adis16201_data = {
 
 static int adis16201_probe(struct spi_device *spi)
 {
-   int ret;
-   struct adis *st;
struct iio_dev *indio_dev;
+   struct adis *st;
+   int ret;
 
indio_dev = devm_iio_device_alloc(>dev, sizeof(*st));
if (!indio_dev)
-- 
2.7.4



Re: [PATCH v4 10/10] ARM: sunxi: smp: Add initialization of CNTVOFF

2018-03-04 Thread Mylène Josserand
Hello,

On Mon, 26 Feb 2018 18:25:10 +0800
Chen-Yu Tsai  wrote:

> On Mon, Feb 26, 2018 at 6:12 PM, Maxime Ripard
>  wrote:
> > On Sat, Feb 24, 2018 at 12:17:13AM +0800, Chen-Yu Tsai wrote:  
> >> On Fri, Feb 23, 2018 at 9:37 PM, Mylène Josserand
> >>  wrote:  
> >> > On Cortex-A7, the CNTVOFF register from arch timer is uninitialized.
> >> > It should be done by the bootloader but it is currently not the case,
> >> > even for boot CPU because this SoC is booting in secure mode.
> >> > It leads to an random offset value meaning that each CPU will have a
> >> > different time, which isn't working very well.
> >> >
> >> > Add assembly code used for boot CPU and secondary CPU cores to make
> >> > sure that the CNTVOFF register is initialized.
> >> >
> >> > Signed-off-by: Mylène Josserand 
> >> > ---
> >> >  arch/arm/mach-sunxi/headsmp.S | 21 +
> >> >  arch/arm/mach-sunxi/sunxi.c   |  4 
> >> >  2 files changed, 25 insertions(+)
> >> >
> >> > diff --git a/arch/arm/mach-sunxi/headsmp.S 
> >> > b/arch/arm/mach-sunxi/headsmp.S
> >> > index d5c97e945e69..605896251927 100644
> >> > --- a/arch/arm/mach-sunxi/headsmp.S
> >> > +++ b/arch/arm/mach-sunxi/headsmp.S
> >> > @@ -65,9 +65,30 @@ ENTRY(sunxi_mc_smp_cluster_cache_enable)
> >> > first: .word sunxi_mc_smp_first_comer - .
> >> >  ENDPROC(sunxi_mc_smp_cluster_cache_enable)
> >> >
> >> > +ENTRY(sunxi_init_cntvoff)
> >> > +   /*
> >> > +* CNTVOFF has to be initialized either from non-secure 
> >> > Hypervisor
> >> > +* mode or secure Monitor mode with SCR.NS==1. If TrustZone is 
> >> > enabled
> >> > +* then it should be handled by the secure code
> >> > +*/
> >> > +   cps #MON_MODE
> >> > +   mrc p15, 0, r1, c1, c1, 0   /* Get Secure Config */
> >> > +   orr r0, r1, #1
> >> > +   mcr p15, 0, r0, c1, c1, 0   /* Set Non Secure bit */
> >> > +   instr_sync
> >> > +   mov r0, #0
> >> > +   mcrrp15, 4, r0, r0, c14 /* CNTVOFF = 0 */
> >> > +   instr_sync
> >> > +   mcr p15, 0, r1, c1, c1, 0   /* Set Secure bit */
> >> > +   instr_sync
> >> > +   cps #SVC_MODE
> >> > +   ret lr
> >> > +ENDPROC(sunxi_init_cntvoff)  
> >>
> >> There is no need to move all the assembly into a separate file, just
> >> to add this function. Everything can be inlined as a naked function.
> >> The "instr_sync" macro can be replaced with "isb", which is what it
> >> expands to anyway.
> >>
> >> I really want to keep everything self-contained without global symbols,
> >> and in C files if possible.  
> >
> > What is the rationale for keeping it in C files (beside the global
> > symbols)? Because the syntax is quite ugly, and it's much easier to
> > read, review and amend using a separate file.  
> 
> Global symbols and keeping everything in one place I guess.
> This symbol would be used in a few places, so I suppose having it
> in a separate assembly file would be OK.

Okay so I will keep it in a separate file.

> 
> >> >  #ifdef CONFIG_SMP
> >> >  ENTRY(sunxi_boot)
> >> > bl  sunxi_mc_smp_cluster_cache_enable
> >> > +   bl  sunxi_init_cntvoff
> >> > b   secondary_startup
> >> >  ENDPROC(sunxi_boot)
> >> >
> >> > diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
> >> > index 5e9602ce1573..4bb041492b54 100644
> >> > --- a/arch/arm/mach-sunxi/sunxi.c
> >> > +++ b/arch/arm/mach-sunxi/sunxi.c
> >> > @@ -37,8 +37,12 @@ static const char * const sun6i_board_dt_compat[] = {
> >> >  };
> >> >
> >> >  extern void __init sun6i_reset_init(void);
> >> > +extern void sunxi_init_cntvoff(void);
> >> > +
> >> >  static void __init sun6i_timer_init(void)
> >> >  {
> >> > +   sunxi_init_cntvoff();  
> >>
> >> You should check the enable-method to see if PSCI is set or not,
> >> as an indicator whether the kernel is booted secure or non-secure.  
> >
> > It's an indicator, but it's not really a perfect one. You could very
> > well have your kernel booted in non-secure, without PSCI. Or even with
> > PSCI, but without the SMP ops.
> >
> > We have a quite big number of these cases already, where, depending on
> > the configuration, we might not have access to the device we write to,
> > the number of hacks to just enable that device for non-secure is a
> > good example of that.  
> 
> I wouldn't consider them hacks though. The hardware gives the option
> to have control of many devices delegated solely to secure-only, or
> secure/non-secure. Our present model is to support everything we can
> in Linux directly, instead of through some firmware interface to a
> non-existent firmware.

I am not sure to understand what is the conclusion about it.
Should I use "psci"/enable-method or should I use another mechanism to
detect we are in secure/non-secure (if it exists)?

Otherwise, 

[PATCH 08/11] Staging: iio: accel: Use switch statement than if-else

2018-03-04 Thread Himanshu Jha
Use switch statement instead of if-else pair to explicitly match
the only two channels present.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 1737708..307d4ab 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -114,12 +114,15 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_VOLTAGE:
-   if (chan->channel == 0) {
+   switch (chan->channel) {
+   case 0:
*val = 1;
*val2 = 22;
-   } else {
+   break;
+   case 1:
*val = 0;
*val2 = 61;
+   break;
}
return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP:
-- 
2.7.4



[PATCH 10/11] Staging: iio: accel: Add comments about units in data read function

2018-03-04 Thread Himanshu Jha
Clarify the conversion and formation of resultant data in the
adis16201_read_raw() with sufficient comments.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 8d795e2..946c7b1 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -130,6 +130,11 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
*val2 = 0;
return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL:
+  /*
+   * IIO base unit for sensitivity of accelerometer
+   * is milli g.
+   * 1 LSB represents 0.244 mg.
+   */
*val = 0;
*val2 = IIO_G_TO_M_S_2(462400);
return IIO_VAL_INT_PLUS_NANO;
@@ -142,6 +147,11 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
}
break;
case IIO_CHAN_INFO_OFFSET:
+  /*
+   * The raw ADC value is 0x4FE when the temperature
+   * is 25 degrees and the scale factor per milli
+   * degree celcius is -470.
+   */
*val = 25000 / -470 - 1278;
return IIO_VAL_INT;
case IIO_CHAN_INFO_CALIBBIAS:
-- 
2.7.4



[PATCH 08/11] Staging: iio: accel: Use switch statement than if-else

2018-03-04 Thread Himanshu Jha
Use switch statement instead of if-else pair to explicitly match
the only two channels present.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 1737708..307d4ab 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -114,12 +114,15 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_VOLTAGE:
-   if (chan->channel == 0) {
+   switch (chan->channel) {
+   case 0:
*val = 1;
*val2 = 22;
-   } else {
+   break;
+   case 1:
*val = 0;
*val2 = 61;
+   break;
}
return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP:
-- 
2.7.4



[PATCH 10/11] Staging: iio: accel: Add comments about units in data read function

2018-03-04 Thread Himanshu Jha
Clarify the conversion and formation of resultant data in the
adis16201_read_raw() with sufficient comments.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 8d795e2..946c7b1 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -130,6 +130,11 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
*val2 = 0;
return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL:
+  /*
+   * IIO base unit for sensitivity of accelerometer
+   * is milli g.
+   * 1 LSB represents 0.244 mg.
+   */
*val = 0;
*val2 = IIO_G_TO_M_S_2(462400);
return IIO_VAL_INT_PLUS_NANO;
@@ -142,6 +147,11 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
}
break;
case IIO_CHAN_INFO_OFFSET:
+  /*
+   * The raw ADC value is 0x4FE when the temperature
+   * is 25 degrees and the scale factor per milli
+   * degree celcius is -470.
+   */
*val = 25000 / -470 - 1278;
return IIO_VAL_INT;
case IIO_CHAN_INFO_CALIBBIAS:
-- 
2.7.4



Re: [PATCH v4 10/10] ARM: sunxi: smp: Add initialization of CNTVOFF

2018-03-04 Thread Mylène Josserand
Hello,

On Mon, 26 Feb 2018 18:25:10 +0800
Chen-Yu Tsai  wrote:

> On Mon, Feb 26, 2018 at 6:12 PM, Maxime Ripard
>  wrote:
> > On Sat, Feb 24, 2018 at 12:17:13AM +0800, Chen-Yu Tsai wrote:  
> >> On Fri, Feb 23, 2018 at 9:37 PM, Mylène Josserand
> >>  wrote:  
> >> > On Cortex-A7, the CNTVOFF register from arch timer is uninitialized.
> >> > It should be done by the bootloader but it is currently not the case,
> >> > even for boot CPU because this SoC is booting in secure mode.
> >> > It leads to an random offset value meaning that each CPU will have a
> >> > different time, which isn't working very well.
> >> >
> >> > Add assembly code used for boot CPU and secondary CPU cores to make
> >> > sure that the CNTVOFF register is initialized.
> >> >
> >> > Signed-off-by: Mylène Josserand 
> >> > ---
> >> >  arch/arm/mach-sunxi/headsmp.S | 21 +
> >> >  arch/arm/mach-sunxi/sunxi.c   |  4 
> >> >  2 files changed, 25 insertions(+)
> >> >
> >> > diff --git a/arch/arm/mach-sunxi/headsmp.S 
> >> > b/arch/arm/mach-sunxi/headsmp.S
> >> > index d5c97e945e69..605896251927 100644
> >> > --- a/arch/arm/mach-sunxi/headsmp.S
> >> > +++ b/arch/arm/mach-sunxi/headsmp.S
> >> > @@ -65,9 +65,30 @@ ENTRY(sunxi_mc_smp_cluster_cache_enable)
> >> > first: .word sunxi_mc_smp_first_comer - .
> >> >  ENDPROC(sunxi_mc_smp_cluster_cache_enable)
> >> >
> >> > +ENTRY(sunxi_init_cntvoff)
> >> > +   /*
> >> > +* CNTVOFF has to be initialized either from non-secure 
> >> > Hypervisor
> >> > +* mode or secure Monitor mode with SCR.NS==1. If TrustZone is 
> >> > enabled
> >> > +* then it should be handled by the secure code
> >> > +*/
> >> > +   cps #MON_MODE
> >> > +   mrc p15, 0, r1, c1, c1, 0   /* Get Secure Config */
> >> > +   orr r0, r1, #1
> >> > +   mcr p15, 0, r0, c1, c1, 0   /* Set Non Secure bit */
> >> > +   instr_sync
> >> > +   mov r0, #0
> >> > +   mcrrp15, 4, r0, r0, c14 /* CNTVOFF = 0 */
> >> > +   instr_sync
> >> > +   mcr p15, 0, r1, c1, c1, 0   /* Set Secure bit */
> >> > +   instr_sync
> >> > +   cps #SVC_MODE
> >> > +   ret lr
> >> > +ENDPROC(sunxi_init_cntvoff)  
> >>
> >> There is no need to move all the assembly into a separate file, just
> >> to add this function. Everything can be inlined as a naked function.
> >> The "instr_sync" macro can be replaced with "isb", which is what it
> >> expands to anyway.
> >>
> >> I really want to keep everything self-contained without global symbols,
> >> and in C files if possible.  
> >
> > What is the rationale for keeping it in C files (beside the global
> > symbols)? Because the syntax is quite ugly, and it's much easier to
> > read, review and amend using a separate file.  
> 
> Global symbols and keeping everything in one place I guess.
> This symbol would be used in a few places, so I suppose having it
> in a separate assembly file would be OK.

Okay so I will keep it in a separate file.

> 
> >> >  #ifdef CONFIG_SMP
> >> >  ENTRY(sunxi_boot)
> >> > bl  sunxi_mc_smp_cluster_cache_enable
> >> > +   bl  sunxi_init_cntvoff
> >> > b   secondary_startup
> >> >  ENDPROC(sunxi_boot)
> >> >
> >> > diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
> >> > index 5e9602ce1573..4bb041492b54 100644
> >> > --- a/arch/arm/mach-sunxi/sunxi.c
> >> > +++ b/arch/arm/mach-sunxi/sunxi.c
> >> > @@ -37,8 +37,12 @@ static const char * const sun6i_board_dt_compat[] = {
> >> >  };
> >> >
> >> >  extern void __init sun6i_reset_init(void);
> >> > +extern void sunxi_init_cntvoff(void);
> >> > +
> >> >  static void __init sun6i_timer_init(void)
> >> >  {
> >> > +   sunxi_init_cntvoff();  
> >>
> >> You should check the enable-method to see if PSCI is set or not,
> >> as an indicator whether the kernel is booted secure or non-secure.  
> >
> > It's an indicator, but it's not really a perfect one. You could very
> > well have your kernel booted in non-secure, without PSCI. Or even with
> > PSCI, but without the SMP ops.
> >
> > We have a quite big number of these cases already, where, depending on
> > the configuration, we might not have access to the device we write to,
> > the number of hacks to just enable that device for non-secure is a
> > good example of that.  
> 
> I wouldn't consider them hacks though. The hardware gives the option
> to have control of many devices delegated solely to secure-only, or
> secure/non-secure. Our present model is to support everything we can
> in Linux directly, instead of through some firmware interface to a
> non-existent firmware.

I am not sure to understand what is the conclusion about it.
Should I use "psci"/enable-method or should I use another mechanism to
detect we are in secure/non-secure (if it exists)?

Otherwise, for the moment, I can use machine-compatible on sun8i-a83t
and we will see later how we can handle it in 

[PATCH 11/11] Staging: iio: accel: Move adis16201 driver out of staging subsystem

2018-03-04 Thread Himanshu Jha
Move the adis16201 driver out of staging directory and merge to the
mainline IIO subsystem.

Signed-off-by: Himanshu Jha 
---
 drivers/iio/accel/Kconfig |  12 ++
 drivers/iio/accel/Makefile|   1 +
 drivers/iio/accel/adis16201.c | 323 ++
 drivers/staging/iio/accel/Kconfig |  12 --
 drivers/staging/iio/accel/Makefile|   1 -
 drivers/staging/iio/accel/adis16201.c | 323 --
 6 files changed, 336 insertions(+), 336 deletions(-)
 create mode 100644 drivers/iio/accel/adis16201.c
 delete mode 100644 drivers/staging/iio/accel/adis16201.c

diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index c6d9517..9416c6f 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -5,6 +5,18 @@
 
 menu "Accelerometers"
 
+config ADIS16201
+tristate "Analog Devices ADIS16201 Dual-Axis Digital Inclinometer and 
Accelerometer"
+depends on SPI
+select IIO_ADIS_LIB
+select IIO_ADIS_LIB_BUFFER if IIO_BUFFER
+help
+  Say Y here to build support for Analog Devices adis16201 dual-axis
+  digital inclinometer and accelerometer.
+
+  To compile this driver as a module, say M here: the module will
+  be called adis16201.
+
 config ADXL345
tristate
 
diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
index 368aedb..7832ec9 100644
--- a/drivers/iio/accel/Makefile
+++ b/drivers/iio/accel/Makefile
@@ -4,6 +4,7 @@
 #
 
 # When adding new entries keep the list in alphabetical order
+obj-$(CONFIG_ADIS16201) += adis16201.o
 obj-$(CONFIG_ADXL345) += adxl345_core.o
 obj-$(CONFIG_ADXL345_I2C) += adxl345_i2c.o
 obj-$(CONFIG_ADXL345_SPI) += adxl345_spi.o
diff --git a/drivers/iio/accel/adis16201.c b/drivers/iio/accel/adis16201.c
new file mode 100644
index 000..946c7b1
--- /dev/null
+++ b/drivers/iio/accel/adis16201.c
@@ -0,0 +1,323 @@
+/*
+ * ADIS16201 Dual-Axis Digital Inclinometer and Accelerometer
+ *
+ * Copyright 2010 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define ADIS16201_STARTUP_DELAY_MS 220
+#define ADIS16201_FLASH_CNT0x00
+
+/* Data Output Register Information */
+#define ADIS16201_SUPPLY_OUT_REG   0x02
+#define ADIS16201_XACCL_OUT_REG0x04
+#define ADIS16201_YACCL_OUT_REG0x06
+#define ADIS16201_AUX_ADC_REG  0x08
+#define ADIS16201_TEMP_OUT_REG 0x0A
+#define ADIS16201_XINCL_OUT_REG0x0C
+#define ADIS16201_YINCL_OUT_REG0x0E
+
+/* Calibration Register Definition */
+#define ADIS16201_XACCL_OFFS_REG   0x10
+#define ADIS16201_YACCL_OFFS_REG   0x12
+#define ADIS16201_XACCL_SCALE_REG  0x14
+#define ADIS16201_YACCL_SCALE_REG  0x16
+#define ADIS16201_XINCL_OFFS_REG   0x18
+#define ADIS16201_YINCL_OFFS_REG   0x1A
+#define ADIS16201_XINCL_SCALE_REG  0x1C
+#define ADIS16201_YINCL_SCALE_REG  0x1E
+
+/* Alarm Register Definition */
+#define ADIS16201_ALM_MAG1_REG 0x20
+#define ADIS16201_ALM_MAG2_REG 0x22
+#define ADIS16201_ALM_SMPL1_REG0x24
+#define ADIS16201_ALM_SMPL2_REG0x26
+#define ADIS16201_ALM_CTRL_REG 0x28
+
+#define ADIS16201_AUX_DAC_REG  0x30
+#define ADIS16201_GPIO_CTRL_REG0x32
+#define ADIS16201_MSC_CTRL_REG 0x34
+#define ADIS16201_SMPL_PRD_REG 0x36
+#define ADIS16201_AVG_CNT_REG  0x38
+#define ADIS16201_SLP_CNT_REG  0x3A
+
+/* Miscellaneous Control Register Definition */
+#define ADIS16201_MSC_CTRL_REG 0x34
+#define  ADIS16201_MSC_CTRL_SELF_TEST_EN   BIT(8)
+#define  ADIS16201_MSC_CTRL_DATA_RDY_ENBIT(2)
+#define  ADIS16201_MSC_CTRL_ACTIVE_DATA_RDY_HIGH   BIT(1)
+#define  ADIS16201_MSC_CTRL_DATA_RDY_DIO1  BIT(0)
+
+/* Diagnostics, system status register */
+#define ADIS16201_DIAG_STAT_REG0x3C
+#define  ADIS16201_DIAG_STAT_ALARM2BIT(9)

[PATCH 11/11] Staging: iio: accel: Move adis16201 driver out of staging subsystem

2018-03-04 Thread Himanshu Jha
Move the adis16201 driver out of staging directory and merge to the
mainline IIO subsystem.

Signed-off-by: Himanshu Jha 
---
 drivers/iio/accel/Kconfig |  12 ++
 drivers/iio/accel/Makefile|   1 +
 drivers/iio/accel/adis16201.c | 323 ++
 drivers/staging/iio/accel/Kconfig |  12 --
 drivers/staging/iio/accel/Makefile|   1 -
 drivers/staging/iio/accel/adis16201.c | 323 --
 6 files changed, 336 insertions(+), 336 deletions(-)
 create mode 100644 drivers/iio/accel/adis16201.c
 delete mode 100644 drivers/staging/iio/accel/adis16201.c

diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index c6d9517..9416c6f 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -5,6 +5,18 @@
 
 menu "Accelerometers"
 
+config ADIS16201
+tristate "Analog Devices ADIS16201 Dual-Axis Digital Inclinometer and 
Accelerometer"
+depends on SPI
+select IIO_ADIS_LIB
+select IIO_ADIS_LIB_BUFFER if IIO_BUFFER
+help
+  Say Y here to build support for Analog Devices adis16201 dual-axis
+  digital inclinometer and accelerometer.
+
+  To compile this driver as a module, say M here: the module will
+  be called adis16201.
+
 config ADXL345
tristate
 
diff --git a/drivers/iio/accel/Makefile b/drivers/iio/accel/Makefile
index 368aedb..7832ec9 100644
--- a/drivers/iio/accel/Makefile
+++ b/drivers/iio/accel/Makefile
@@ -4,6 +4,7 @@
 #
 
 # When adding new entries keep the list in alphabetical order
+obj-$(CONFIG_ADIS16201) += adis16201.o
 obj-$(CONFIG_ADXL345) += adxl345_core.o
 obj-$(CONFIG_ADXL345_I2C) += adxl345_i2c.o
 obj-$(CONFIG_ADXL345_SPI) += adxl345_spi.o
diff --git a/drivers/iio/accel/adis16201.c b/drivers/iio/accel/adis16201.c
new file mode 100644
index 000..946c7b1
--- /dev/null
+++ b/drivers/iio/accel/adis16201.c
@@ -0,0 +1,323 @@
+/*
+ * ADIS16201 Dual-Axis Digital Inclinometer and Accelerometer
+ *
+ * Copyright 2010 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#define ADIS16201_STARTUP_DELAY_MS 220
+#define ADIS16201_FLASH_CNT0x00
+
+/* Data Output Register Information */
+#define ADIS16201_SUPPLY_OUT_REG   0x02
+#define ADIS16201_XACCL_OUT_REG0x04
+#define ADIS16201_YACCL_OUT_REG0x06
+#define ADIS16201_AUX_ADC_REG  0x08
+#define ADIS16201_TEMP_OUT_REG 0x0A
+#define ADIS16201_XINCL_OUT_REG0x0C
+#define ADIS16201_YINCL_OUT_REG0x0E
+
+/* Calibration Register Definition */
+#define ADIS16201_XACCL_OFFS_REG   0x10
+#define ADIS16201_YACCL_OFFS_REG   0x12
+#define ADIS16201_XACCL_SCALE_REG  0x14
+#define ADIS16201_YACCL_SCALE_REG  0x16
+#define ADIS16201_XINCL_OFFS_REG   0x18
+#define ADIS16201_YINCL_OFFS_REG   0x1A
+#define ADIS16201_XINCL_SCALE_REG  0x1C
+#define ADIS16201_YINCL_SCALE_REG  0x1E
+
+/* Alarm Register Definition */
+#define ADIS16201_ALM_MAG1_REG 0x20
+#define ADIS16201_ALM_MAG2_REG 0x22
+#define ADIS16201_ALM_SMPL1_REG0x24
+#define ADIS16201_ALM_SMPL2_REG0x26
+#define ADIS16201_ALM_CTRL_REG 0x28
+
+#define ADIS16201_AUX_DAC_REG  0x30
+#define ADIS16201_GPIO_CTRL_REG0x32
+#define ADIS16201_MSC_CTRL_REG 0x34
+#define ADIS16201_SMPL_PRD_REG 0x36
+#define ADIS16201_AVG_CNT_REG  0x38
+#define ADIS16201_SLP_CNT_REG  0x3A
+
+/* Miscellaneous Control Register Definition */
+#define ADIS16201_MSC_CTRL_REG 0x34
+#define  ADIS16201_MSC_CTRL_SELF_TEST_EN   BIT(8)
+#define  ADIS16201_MSC_CTRL_DATA_RDY_ENBIT(2)
+#define  ADIS16201_MSC_CTRL_ACTIVE_DATA_RDY_HIGH   BIT(1)
+#define  ADIS16201_MSC_CTRL_DATA_RDY_DIO1  BIT(0)
+
+/* Diagnostics, system status register */
+#define ADIS16201_DIAG_STAT_REG0x3C
+#define  ADIS16201_DIAG_STAT_ALARM2BIT(9)
+#define  ADIS16201_DIAG_STAT_ALARM1 

[PATCH 09/11] Staging: iio: accel: Use sign_extend32 function

2018-03-04 Thread Himanshu Jha
Use sign_extned32() for 32 bit sign extending rather than hard coding the
same.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 307d4ab..8d795e2 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -159,9 +159,8 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
ret = adis_read_reg_16(st, addr, );
if (ret)
return ret;
-   val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
-   *val = val16;
+
+   *val = sign_extend32(val16, bits - 1);
return IIO_VAL_INT;
}
 
-- 
2.7.4



[PATCH 09/11] Staging: iio: accel: Use sign_extend32 function

2018-03-04 Thread Himanshu Jha
Use sign_extned32() for 32 bit sign extending rather than hard coding the
same.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 307d4ab..8d795e2 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -159,9 +159,8 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
ret = adis_read_reg_16(st, addr, );
if (ret)
return ret;
-   val16 &= (1 << bits) - 1;
-   val16 = (s16)(val16 << (16 - bits)) >> (16 - bits);
-   *val = val16;
+
+   *val = sign_extend32(val16, bits - 1);
return IIO_VAL_INT;
}
 
-- 
2.7.4



[PATCH 04/11] Staging: iio: accel: Rename few macro definitions

2018-03-04 Thread Himanshu Jha
Rename few macros with appropriate names specifying their usage/function.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 59c1166..445cb56 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -20,9 +20,8 @@
 #include 
 #include 
 
-#define ADIS16201_STARTUP_DELAY220
-
-#define ADIS16201_FLASH_CNT  0x00
+#define ADIS16201_STARTUP_DELAY_MS 220
+#define ADIS16201_FLASH_CNT0x00
 
 /* Data Output Register Information */
 #define ADIS16201_SUPPLY_OUT 0x02
@@ -69,7 +68,7 @@
 
 #define ADIS16201_MSC_CTRL_DATA_RDY_EN BIT(2)
 
-#define ADIS16201_MSC_CTRL_ACTIVE_HIGH BIT(1)
+#define ADIS16201_MSC_CTRL_ACTIVE_DATA_RDY_HIGHBIT(1)
 
 #define ADIS16201_MSC_CTRL_DATA_RDY_DIO1   BIT(0)
 
@@ -80,14 +79,14 @@
 
 #define ADIS16201_DIAG_STAT_SPI_FAIL_BIT   3
 
-#define ADIS16201_DIAG_STAT_FLASH_UPT_BIT  2
+#define ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT  2
 
 #define ADIS16201_DIAG_STAT_POWER_HIGH_BIT 1
 
 #define ADIS16201_DIAG_STAT_POWER_LOW_BIT  0
 
 #define ADIS16201_GLOB_CMD_SW_RESETBIT(7)
-#define ADIS16201_GLOB_CMD_FACTORY_CAL BIT(1)
+#define ADIS16201_GLOB_CMD_FACTORY BIT(1)
 
 #define ADIS16201_ERROR_ACTIVE  BIT(14)
 
@@ -231,7 +230,7 @@ static const struct iio_info adis16201_info = {
 
 static const char * const adis16201_status_error_msgs[] = {
[ADIS16201_DIAG_STAT_SPI_FAIL_BIT] = "SPI failure",
-   [ADIS16201_DIAG_STAT_FLASH_UPT_BIT] = "Flash update failed",
+   [ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT] = "Flash update failed",
[ADIS16201_DIAG_STAT_POWER_HIGH_BIT] = "Power supply above 3.625V",
[ADIS16201_DIAG_STAT_POWER_LOW_BIT] = "Power supply below 3.15V",
 };
@@ -244,11 +243,11 @@ static const struct adis_data adis16201_data = {
 
.self_test_mask = ADIS16201_MSC_CTRL_SELF_TEST_EN,
.self_test_no_autoclear = true,
-   .startup_delay = ADIS16201_STARTUP_DELAY,
+   .startup_delay = ADIS16201_STARTUP_DELAY_MS,
 
.status_error_msgs = adis16201_status_error_msgs,
.status_error_mask = BIT(ADIS16201_DIAG_STAT_SPI_FAIL_BIT) |
-   BIT(ADIS16201_DIAG_STAT_FLASH_UPT_BIT) |
+   BIT(ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT) |
BIT(ADIS16201_DIAG_STAT_POWER_HIGH_BIT) |
BIT(ADIS16201_DIAG_STAT_POWER_LOW_BIT),
 };
-- 
2.7.4



[PATCH 05/11] Staging: iio: accel: Add _REG suffix to registers

2018-03-04 Thread Himanshu Jha
Addition of _REG suffix to the register definitions allows a distinction
between registers and register fields. The various registers and its field
bits are grouped together to improve readability and easy indentification.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 133 --
 1 file changed, 61 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 445cb56..476b1c3 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -20,75 +20,64 @@
 #include 
 #include 
 
-#define ADIS16201_STARTUP_DELAY_MS 220
-#define ADIS16201_FLASH_CNT0x00
+#define ADIS16201_STARTUP_DELAY_MS 220
+#define ADIS16201_FLASH_CNT0x00
 
 /* Data Output Register Information */
-#define ADIS16201_SUPPLY_OUT 0x02
-#define ADIS16201_XACCL_OUT  0x04
-#define ADIS16201_YACCL_OUT  0x06
-#define ADIS16201_AUX_ADC0x08
-#define ADIS16201_TEMP_OUT   0x0A
-#define ADIS16201_XINCL_OUT  0x0C
-#define ADIS16201_YINCL_OUT  0x0E
+#define ADIS16201_SUPPLY_OUT_REG   0x02
+#define ADIS16201_XACCL_OUT_REG0x04
+#define ADIS16201_YACCL_OUT_REG0x06
+#define ADIS16201_AUX_ADC_REG  0x08
+#define ADIS16201_TEMP_OUT_REG 0x0A
+#define ADIS16201_XINCL_OUT_REG0x0C
+#define ADIS16201_YINCL_OUT_REG0x0E
 
 /* Calibration Register Definition */
-#define ADIS16201_XACCL_OFFS 0x10
-#define ADIS16201_YACCL_OFFS 0x12
-#define ADIS16201_XACCL_SCALE0x14
-#define ADIS16201_YACCL_SCALE0x16
-#define ADIS16201_XINCL_OFFS 0x18
-#define ADIS16201_YINCL_OFFS 0x1A
-#define ADIS16201_XINCL_SCALE0x1C
-#define ADIS16201_YINCL_SCALE0x1E
+#define ADIS16201_XACCL_OFFS_REG   0x10
+#define ADIS16201_YACCL_OFFS_REG   0x12
+#define ADIS16201_XACCL_SCALE_REG  0x14
+#define ADIS16201_YACCL_SCALE_REG  0x16
+#define ADIS16201_XINCL_OFFS_REG   0x18
+#define ADIS16201_YINCL_OFFS_REG   0x1A
+#define ADIS16201_XINCL_SCALE_REG  0x1C
+#define ADIS16201_YINCL_SCALE_REG  0x1E
 
 /* Alarm Register Definition */
-#define ADIS16201_ALM_MAG1   0x20
-#define ADIS16201_ALM_MAG2   0x22
-#define ADIS16201_ALM_SMPL1  0x24
-#define ADIS16201_ALM_SMPL2  0x26
-#define ADIS16201_ALM_CTRL   0x28
-
-#define ADIS16201_AUX_DAC0x30
-#define ADIS16201_GPIO_CTRL  0x32
-#define ADIS16201_MSC_CTRL   0x34
-
-#define ADIS16201_SMPL_PRD   0x36
-#define ADIS16201_AVG_CNT0x38
-#define ADIS16201_SLP_CNT0x3A
+#define ADIS16201_ALM_MAG1_REG 0x20
+#define ADIS16201_ALM_MAG2_REG 0x22
+#define ADIS16201_ALM_SMPL1_REG0x24
+#define ADIS16201_ALM_SMPL2_REG0x26
+#define ADIS16201_ALM_CTRL_REG 0x28
+
+#define ADIS16201_AUX_DAC_REG  0x30
+#define ADIS16201_GPIO_CTRL_REG0x32
+#define ADIS16201_MSC_CTRL_REG 0x34
+#define ADIS16201_SMPL_PRD_REG 0x36
+#define ADIS16201_AVG_CNT_REG  0x38
+#define ADIS16201_SLP_CNT_REG  0x3A
+
+/* Miscellaneous Control Register Definition */
+#define ADIS16201_MSC_CTRL_REG 0x34
+#define  ADIS16201_MSC_CTRL_SELF_TEST_EN   BIT(8)
+#define  ADIS16201_MSC_CTRL_DATA_RDY_ENBIT(2)
+#define  ADIS16201_MSC_CTRL_ACTIVE_DATA_RDY_HIGH   BIT(1)
+#define  ADIS16201_MSC_CTRL_DATA_RDY_DIO1  BIT(0)
 
 /* Diagnostics, system status register */
-#define ADIS16201_DIAG_STAT  0x3C
+#define ADIS16201_DIAG_STAT_REG0x3C
+#define  ADIS16201_DIAG_STAT_ALARM2BIT(9)
+#define  ADIS16201_DIAG_STAT_ALARM1BIT(8)
+#define  ADIS16201_DIAG_STAT_SPI_FAIL_BIT  3
+#define  ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT2
+#define  ADIS16201_DIAG_STAT_POWER_HIGH_BIT1
+#define  ADIS16201_DIAG_STAT_POWER_LOW_BIT 0
 
 /* Operation, system command register */
-#define ADIS16201_GLOB_CMD   0x3E
-
-
-#define 

[PATCH 05/11] Staging: iio: accel: Add _REG suffix to registers

2018-03-04 Thread Himanshu Jha
Addition of _REG suffix to the register definitions allows a distinction
between registers and register fields. The various registers and its field
bits are grouped together to improve readability and easy indentification.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 133 --
 1 file changed, 61 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 445cb56..476b1c3 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -20,75 +20,64 @@
 #include 
 #include 
 
-#define ADIS16201_STARTUP_DELAY_MS 220
-#define ADIS16201_FLASH_CNT0x00
+#define ADIS16201_STARTUP_DELAY_MS 220
+#define ADIS16201_FLASH_CNT0x00
 
 /* Data Output Register Information */
-#define ADIS16201_SUPPLY_OUT 0x02
-#define ADIS16201_XACCL_OUT  0x04
-#define ADIS16201_YACCL_OUT  0x06
-#define ADIS16201_AUX_ADC0x08
-#define ADIS16201_TEMP_OUT   0x0A
-#define ADIS16201_XINCL_OUT  0x0C
-#define ADIS16201_YINCL_OUT  0x0E
+#define ADIS16201_SUPPLY_OUT_REG   0x02
+#define ADIS16201_XACCL_OUT_REG0x04
+#define ADIS16201_YACCL_OUT_REG0x06
+#define ADIS16201_AUX_ADC_REG  0x08
+#define ADIS16201_TEMP_OUT_REG 0x0A
+#define ADIS16201_XINCL_OUT_REG0x0C
+#define ADIS16201_YINCL_OUT_REG0x0E
 
 /* Calibration Register Definition */
-#define ADIS16201_XACCL_OFFS 0x10
-#define ADIS16201_YACCL_OFFS 0x12
-#define ADIS16201_XACCL_SCALE0x14
-#define ADIS16201_YACCL_SCALE0x16
-#define ADIS16201_XINCL_OFFS 0x18
-#define ADIS16201_YINCL_OFFS 0x1A
-#define ADIS16201_XINCL_SCALE0x1C
-#define ADIS16201_YINCL_SCALE0x1E
+#define ADIS16201_XACCL_OFFS_REG   0x10
+#define ADIS16201_YACCL_OFFS_REG   0x12
+#define ADIS16201_XACCL_SCALE_REG  0x14
+#define ADIS16201_YACCL_SCALE_REG  0x16
+#define ADIS16201_XINCL_OFFS_REG   0x18
+#define ADIS16201_YINCL_OFFS_REG   0x1A
+#define ADIS16201_XINCL_SCALE_REG  0x1C
+#define ADIS16201_YINCL_SCALE_REG  0x1E
 
 /* Alarm Register Definition */
-#define ADIS16201_ALM_MAG1   0x20
-#define ADIS16201_ALM_MAG2   0x22
-#define ADIS16201_ALM_SMPL1  0x24
-#define ADIS16201_ALM_SMPL2  0x26
-#define ADIS16201_ALM_CTRL   0x28
-
-#define ADIS16201_AUX_DAC0x30
-#define ADIS16201_GPIO_CTRL  0x32
-#define ADIS16201_MSC_CTRL   0x34
-
-#define ADIS16201_SMPL_PRD   0x36
-#define ADIS16201_AVG_CNT0x38
-#define ADIS16201_SLP_CNT0x3A
+#define ADIS16201_ALM_MAG1_REG 0x20
+#define ADIS16201_ALM_MAG2_REG 0x22
+#define ADIS16201_ALM_SMPL1_REG0x24
+#define ADIS16201_ALM_SMPL2_REG0x26
+#define ADIS16201_ALM_CTRL_REG 0x28
+
+#define ADIS16201_AUX_DAC_REG  0x30
+#define ADIS16201_GPIO_CTRL_REG0x32
+#define ADIS16201_MSC_CTRL_REG 0x34
+#define ADIS16201_SMPL_PRD_REG 0x36
+#define ADIS16201_AVG_CNT_REG  0x38
+#define ADIS16201_SLP_CNT_REG  0x3A
+
+/* Miscellaneous Control Register Definition */
+#define ADIS16201_MSC_CTRL_REG 0x34
+#define  ADIS16201_MSC_CTRL_SELF_TEST_EN   BIT(8)
+#define  ADIS16201_MSC_CTRL_DATA_RDY_ENBIT(2)
+#define  ADIS16201_MSC_CTRL_ACTIVE_DATA_RDY_HIGH   BIT(1)
+#define  ADIS16201_MSC_CTRL_DATA_RDY_DIO1  BIT(0)
 
 /* Diagnostics, system status register */
-#define ADIS16201_DIAG_STAT  0x3C
+#define ADIS16201_DIAG_STAT_REG0x3C
+#define  ADIS16201_DIAG_STAT_ALARM2BIT(9)
+#define  ADIS16201_DIAG_STAT_ALARM1BIT(8)
+#define  ADIS16201_DIAG_STAT_SPI_FAIL_BIT  3
+#define  ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT2
+#define  ADIS16201_DIAG_STAT_POWER_HIGH_BIT1
+#define  ADIS16201_DIAG_STAT_POWER_LOW_BIT 0
 
 /* Operation, system command register */
-#define ADIS16201_GLOB_CMD   0x3E
-
-
-#define ADIS16201_MSC_CTRL_SELF_TEST_ENBIT(8)
-

[PATCH 04/11] Staging: iio: accel: Rename few macro definitions

2018-03-04 Thread Himanshu Jha
Rename few macros with appropriate names specifying their usage/function.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 59c1166..445cb56 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -20,9 +20,8 @@
 #include 
 #include 
 
-#define ADIS16201_STARTUP_DELAY220
-
-#define ADIS16201_FLASH_CNT  0x00
+#define ADIS16201_STARTUP_DELAY_MS 220
+#define ADIS16201_FLASH_CNT0x00
 
 /* Data Output Register Information */
 #define ADIS16201_SUPPLY_OUT 0x02
@@ -69,7 +68,7 @@
 
 #define ADIS16201_MSC_CTRL_DATA_RDY_EN BIT(2)
 
-#define ADIS16201_MSC_CTRL_ACTIVE_HIGH BIT(1)
+#define ADIS16201_MSC_CTRL_ACTIVE_DATA_RDY_HIGHBIT(1)
 
 #define ADIS16201_MSC_CTRL_DATA_RDY_DIO1   BIT(0)
 
@@ -80,14 +79,14 @@
 
 #define ADIS16201_DIAG_STAT_SPI_FAIL_BIT   3
 
-#define ADIS16201_DIAG_STAT_FLASH_UPT_BIT  2
+#define ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT  2
 
 #define ADIS16201_DIAG_STAT_POWER_HIGH_BIT 1
 
 #define ADIS16201_DIAG_STAT_POWER_LOW_BIT  0
 
 #define ADIS16201_GLOB_CMD_SW_RESETBIT(7)
-#define ADIS16201_GLOB_CMD_FACTORY_CAL BIT(1)
+#define ADIS16201_GLOB_CMD_FACTORY BIT(1)
 
 #define ADIS16201_ERROR_ACTIVE  BIT(14)
 
@@ -231,7 +230,7 @@ static const struct iio_info adis16201_info = {
 
 static const char * const adis16201_status_error_msgs[] = {
[ADIS16201_DIAG_STAT_SPI_FAIL_BIT] = "SPI failure",
-   [ADIS16201_DIAG_STAT_FLASH_UPT_BIT] = "Flash update failed",
+   [ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT] = "Flash update failed",
[ADIS16201_DIAG_STAT_POWER_HIGH_BIT] = "Power supply above 3.625V",
[ADIS16201_DIAG_STAT_POWER_LOW_BIT] = "Power supply below 3.15V",
 };
@@ -244,11 +243,11 @@ static const struct adis_data adis16201_data = {
 
.self_test_mask = ADIS16201_MSC_CTRL_SELF_TEST_EN,
.self_test_no_autoclear = true,
-   .startup_delay = ADIS16201_STARTUP_DELAY,
+   .startup_delay = ADIS16201_STARTUP_DELAY_MS,
 
.status_error_msgs = adis16201_status_error_msgs,
.status_error_mask = BIT(ADIS16201_DIAG_STAT_SPI_FAIL_BIT) |
-   BIT(ADIS16201_DIAG_STAT_FLASH_UPT_BIT) |
+   BIT(ADIS16201_DIAG_STAT_FLASH_UPT_FAIL_BIT) |
BIT(ADIS16201_DIAG_STAT_POWER_HIGH_BIT) |
BIT(ADIS16201_DIAG_STAT_POWER_LOW_BIT),
 };
-- 
2.7.4



[PATCH 07/11] Staging: iio: accel: Adjust arguments to match open parentheses

2018-03-04 Thread Himanshu Jha
In adis16201_read_raw() adjust an argument to match an open parentheses
using tabs.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 907fb85..1737708 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -110,7 +110,7 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
switch (mask) {
case IIO_CHAN_INFO_RAW:
return adis_single_conversion(indio_dev, chan,
-   ADIS16201_ERROR_ACTIVE, val);
+   ADIS16201_ERROR_ACTIVE, val);
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_VOLTAGE:
-- 
2.7.4



[PATCH 07/11] Staging: iio: accel: Adjust arguments to match open parentheses

2018-03-04 Thread Himanshu Jha
In adis16201_read_raw() adjust an argument to match an open parentheses
using tabs.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 907fb85..1737708 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -110,7 +110,7 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
switch (mask) {
case IIO_CHAN_INFO_RAW:
return adis_single_conversion(indio_dev, chan,
-   ADIS16201_ERROR_ACTIVE, val);
+   ADIS16201_ERROR_ACTIVE, val);
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_VOLTAGE:
-- 
2.7.4



[PATCH 02/11] Staging: iio: accel: Add a blank space before returns

2018-03-04 Thread Himanshu Jha
Adding a blank space before/after some returns improves readability.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 0f6a204..0fae8aa 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -232,6 +232,7 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
*val = val16;
return IIO_VAL_INT;
}
+
return -EINVAL;
 }
 
@@ -262,6 +263,7 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
addr = adis16201_addresses[chan->scan_index];
return adis_write_reg_16(st, addr, val16);
}
+
return -EINVAL;
 }
 
@@ -336,6 +338,7 @@ static int adis16201_probe(struct spi_device *spi)
ret = adis_init(st, indio_dev, spi, _data);
if (ret)
return ret;
+
ret = adis_setup_buffer_and_trigger(st, indio_dev, NULL);
if (ret)
return ret;
@@ -348,6 +351,7 @@ static int adis16201_probe(struct spi_device *spi)
ret = iio_device_register(indio_dev);
if (ret < 0)
goto error_cleanup_buffer_trigger;
+
return 0;
 
 error_cleanup_buffer_trigger:
-- 
2.7.4



[PATCH 02/11] Staging: iio: accel: Add a blank space before returns

2018-03-04 Thread Himanshu Jha
Adding a blank space before/after some returns improves readability.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 0f6a204..0fae8aa 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -232,6 +232,7 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
*val = val16;
return IIO_VAL_INT;
}
+
return -EINVAL;
 }
 
@@ -262,6 +263,7 @@ static int adis16201_write_raw(struct iio_dev *indio_dev,
addr = adis16201_addresses[chan->scan_index];
return adis_write_reg_16(st, addr, val16);
}
+
return -EINVAL;
 }
 
@@ -336,6 +338,7 @@ static int adis16201_probe(struct spi_device *spi)
ret = adis_init(st, indio_dev, spi, _data);
if (ret)
return ret;
+
ret = adis_setup_buffer_and_trigger(st, indio_dev, NULL);
if (ret)
return ret;
@@ -348,6 +351,7 @@ static int adis16201_probe(struct spi_device *spi)
ret = iio_device_register(indio_dev);
if (ret < 0)
goto error_cleanup_buffer_trigger;
+
return 0;
 
 error_cleanup_buffer_trigger:
-- 
2.7.4



[PATCH 01/11] Staging: iio: accel: Prefer alphabetical sequence of header files

2018-03-04 Thread Himanshu Jha
Arrange header files in alphabetical sequence to improve readability.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 2ebd275..0f6a204 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -7,13 +7,13 @@
  */
 
 #include 
-#include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
-#include 
 
 #include 
 #include 
-- 
2.7.4



[PATCH 00/11] staging: iio: accel: adis16201 driver cleanup

2018-03-04 Thread Himanshu Jha
The following patch series cleans up miscellaneous code fragments and
then the driver is moved from staging to mainline IIO subsytem directory.
Note that the last patch to move driver is *not* generated using '-M' flag,
which is used for detecting renames, since it may help reviewers to
suggest more cleanups/fix while pointing inline to the patch, the
necessary changes. The framing of patch is made consistent with the datasheet
naming where possible.

For all the patches:
Suggested-by: Jonathan Cameron 
https://marc.info/?l=linux-iio=151775804702998=2

All the patches have been tested using 0-day test service with success.

Himanshu Jha (11):
  Staging: iio: accel: Prefer alphabetical sequence of header files
  Staging: iio: accel: Add a blank space before returns
  Staging: iio: accel: Remove unnecessary comments
  Staging: iio: accel: Rename few macro definitions
  Staging: iio: accel: Add _REG suffix to registers
  Staging: iio: accel: Reverse christmas tree
  Staging: iio: accel: Adjust arguments to match open parentheses
  Staging: iio: accel: Use switch statement than if-else
  Staging: iio: accel: Use sign_extend32 function
  Staging: iio: accel: Add comments about units in data read function
  Staging: iio: accel: Move adis16201 driver out of staging subsystem

 drivers/iio/accel/Kconfig |  12 ++
 drivers/iio/accel/Makefile|   1 +
 drivers/iio/accel/adis16201.c | 323 
 drivers/staging/iio/accel/Kconfig |  12 --
 drivers/staging/iio/accel/Makefile|   1 -
 drivers/staging/iio/accel/adis16201.c | 381 --
 6 files changed, 336 insertions(+), 394 deletions(-)
 create mode 100644 drivers/iio/accel/adis16201.c
 delete mode 100644 drivers/staging/iio/accel/adis16201.c

-- 
2.7.4



[PATCH 01/11] Staging: iio: accel: Prefer alphabetical sequence of header files

2018-03-04 Thread Himanshu Jha
Arrange header files in alphabetical sequence to improve readability.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/iio/accel/adis16201.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/accel/adis16201.c 
b/drivers/staging/iio/accel/adis16201.c
index 2ebd275..0f6a204 100644
--- a/drivers/staging/iio/accel/adis16201.c
+++ b/drivers/staging/iio/accel/adis16201.c
@@ -7,13 +7,13 @@
  */
 
 #include 
-#include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
-#include 
 
 #include 
 #include 
-- 
2.7.4



[PATCH 00/11] staging: iio: accel: adis16201 driver cleanup

2018-03-04 Thread Himanshu Jha
The following patch series cleans up miscellaneous code fragments and
then the driver is moved from staging to mainline IIO subsytem directory.
Note that the last patch to move driver is *not* generated using '-M' flag,
which is used for detecting renames, since it may help reviewers to
suggest more cleanups/fix while pointing inline to the patch, the
necessary changes. The framing of patch is made consistent with the datasheet
naming where possible.

For all the patches:
Suggested-by: Jonathan Cameron 
https://marc.info/?l=linux-iio=151775804702998=2

All the patches have been tested using 0-day test service with success.

Himanshu Jha (11):
  Staging: iio: accel: Prefer alphabetical sequence of header files
  Staging: iio: accel: Add a blank space before returns
  Staging: iio: accel: Remove unnecessary comments
  Staging: iio: accel: Rename few macro definitions
  Staging: iio: accel: Add _REG suffix to registers
  Staging: iio: accel: Reverse christmas tree
  Staging: iio: accel: Adjust arguments to match open parentheses
  Staging: iio: accel: Use switch statement than if-else
  Staging: iio: accel: Use sign_extend32 function
  Staging: iio: accel: Add comments about units in data read function
  Staging: iio: accel: Move adis16201 driver out of staging subsystem

 drivers/iio/accel/Kconfig |  12 ++
 drivers/iio/accel/Makefile|   1 +
 drivers/iio/accel/adis16201.c | 323 
 drivers/staging/iio/accel/Kconfig |  12 --
 drivers/staging/iio/accel/Makefile|   1 -
 drivers/staging/iio/accel/adis16201.c | 381 --
 6 files changed, 336 insertions(+), 394 deletions(-)
 create mode 100644 drivers/iio/accel/adis16201.c
 delete mode 100644 drivers/staging/iio/accel/adis16201.c

-- 
2.7.4



[no subject]

2018-03-04 Thread Alfred Chow




Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing
Chong Hing Bank, Hong Kong, Chong Hing Bank Centre, 24 Des Voeux Road
Central, Hong Kong. I have a business proposal of  $38,980,369.00.

All confirmable documents to back up the claims will be made available
to you prior to your acceptance and as soon as I receive your return
mail.

Email me for more details:

Best Regards,







[no subject]

2018-03-04 Thread Alfred Chow




Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing
Chong Hing Bank, Hong Kong, Chong Hing Bank Centre, 24 Des Voeux Road
Central, Hong Kong. I have a business proposal of  $38,980,369.00.

All confirmable documents to back up the claims will be made available
to you prior to your acceptance and as soon as I receive your return
mail.

Email me for more details:

Best Regards,







[PATCH] drm/bridge/synopsys: dw-hdmi: Fix memleak in __dw_hdmi_remove

2018-03-04 Thread Jeffy Chen
The platform_device_register_full() will allocate dma_mask for
hdmi->audio, so we should free before platform_device_unregister().

Reported by kmemleak:
unreferenced object 0xffc0ef70ff00 (size 128):
  comm "kworker/4:1", pid 123, jiffies 4294670080 (age 189.604s)
  hex dump (first 32 bytes):
ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00  
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[<21946f44>] kmemleak_alloc+0x58/0x8c
[<9c43890d>] kmem_cache_alloc_memcg_trace+0x18c/0x25c
[<0e17cd06>] platform_device_register_full+0x64/0x108
[<418a0882>] __dw_hdmi_probe+0xb9c/0xcc0
[] dw_hdmi_bind+0x30/0x88
[<9af347f6>] dw_hdmi_rockchip_bind+0x260/0x2e8

Signed-off-by: Jeffy Chen 
---

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index f9802399cc0d..d9afdc59d4f4 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2567,8 +2567,10 @@ __dw_hdmi_probe(struct platform_device *pdev,
 
 static void __dw_hdmi_remove(struct dw_hdmi *hdmi)
 {
-   if (hdmi->audio && !IS_ERR(hdmi->audio))
+   if (hdmi->audio && !IS_ERR(hdmi->audio)) {
+   kfree(hdmi->audio->dev.dma_mask);
platform_device_unregister(hdmi->audio);
+   }
if (!IS_ERR(hdmi->cec))
platform_device_unregister(hdmi->cec);
 
-- 
2.11.0




[PATCH] drm/bridge/synopsys: dw-hdmi: Fix memleak in __dw_hdmi_remove

2018-03-04 Thread Jeffy Chen
The platform_device_register_full() will allocate dma_mask for
hdmi->audio, so we should free before platform_device_unregister().

Reported by kmemleak:
unreferenced object 0xffc0ef70ff00 (size 128):
  comm "kworker/4:1", pid 123, jiffies 4294670080 (age 189.604s)
  hex dump (first 32 bytes):
ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00  
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[<21946f44>] kmemleak_alloc+0x58/0x8c
[<9c43890d>] kmem_cache_alloc_memcg_trace+0x18c/0x25c
[<0e17cd06>] platform_device_register_full+0x64/0x108
[<418a0882>] __dw_hdmi_probe+0xb9c/0xcc0
[] dw_hdmi_bind+0x30/0x88
[<9af347f6>] dw_hdmi_rockchip_bind+0x260/0x2e8

Signed-off-by: Jeffy Chen 
---

 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index f9802399cc0d..d9afdc59d4f4 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2567,8 +2567,10 @@ __dw_hdmi_probe(struct platform_device *pdev,
 
 static void __dw_hdmi_remove(struct dw_hdmi *hdmi)
 {
-   if (hdmi->audio && !IS_ERR(hdmi->audio))
+   if (hdmi->audio && !IS_ERR(hdmi->audio)) {
+   kfree(hdmi->audio->dev.dma_mask);
platform_device_unregister(hdmi->audio);
+   }
if (!IS_ERR(hdmi->cec))
platform_device_unregister(hdmi->cec);
 
-- 
2.11.0




Re: inconsistent lock state with usbnet/asix usb ethernet and xhci

2018-03-04 Thread Marek Szyprowski

Hi Oliver,

On 2018-02-27 17:07, Oliver Neukum wrote:

Am Dienstag, den 27.02.2018, 07:13 -0800 schrieb Eric Dumazet:

On Tue, 2018-02-27 at 07:09 -0800, Eric Dumazet wrote:


Note that for this one, it seems we also could perform stats updates in
BH context, since skb is queued via defer_bh()

But simplicity wins I guess.

Thinking more about this, I am not sure we have any guarantee that TX
and RX can not run on multiple cpus.

Using an unique syncp is not going to be safe, even if we make lockdep
happy enough with the local_irq save/restore.

Unfortunately you are right. It is not guaranteed for some hardware.


Does it mean that the fix proposed by Eric is not the proper solution?

Best regards
--
Marek Szyprowski, PhD
Samsung R Institute Poland



Re: inconsistent lock state with usbnet/asix usb ethernet and xhci

2018-03-04 Thread Marek Szyprowski

Hi Oliver,

On 2018-02-27 17:07, Oliver Neukum wrote:

Am Dienstag, den 27.02.2018, 07:13 -0800 schrieb Eric Dumazet:

On Tue, 2018-02-27 at 07:09 -0800, Eric Dumazet wrote:


Note that for this one, it seems we also could perform stats updates in
BH context, since skb is queued via defer_bh()

But simplicity wins I guess.

Thinking more about this, I am not sure we have any guarantee that TX
and RX can not run on multiple cpus.

Using an unique syncp is not going to be safe, even if we make lockdep
happy enough with the local_irq save/restore.

Unfortunately you are right. It is not guaranteed for some hardware.


Does it mean that the fix proposed by Eric is not the proper solution?

Best regards
--
Marek Szyprowski, PhD
Samsung R Institute Poland



Re: [Outreachy kernel] [PATCH v2] staging: rtl8192u: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Julia Lawall


On Mon, 5 Mar 2018, Arushi Singhal wrote:

> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.

I asked several questions about the above two lines, which as far as I can
see haven't been answered. Please excuse me if I missed the answers, but I
would still like to know what they are.

Namely, why did you choose to change to rate limited output, and what does
the "device name as a prefix" comment mean?

julia

> Indentation is also changed, to fix the  checkpatch issue if line is not
> exceding 80 characters.
>
> Signed-off-by: Arushi Singhal 
> ---
> changes in v2
> *change the subject line, in v1 driver name was wrong.
>
>  .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 
> +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
> b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> index e6648f7..200fe5f 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> @@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
>
>   priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
>   if (IS_ERR(priv->tfm)) {
> - printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
> crypto API aes\n");
> + net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
> crypto API aes\n");
>   priv->tfm = NULL;
>   goto fail;
>   }
> @@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
> int hdr_len, void *priv)
>   keyidx = pos[3];
>   if (!(keyidx & (1 << 5))) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: received packet without ExtIV 
> flag from %pM\n",
> - hdr->addr2);
> + net_dbg_ratelimited("CCMP: received packet without 
> ExtIV flag from %pM\n",
> + hdr->addr2);
>   }
>   key->dot11RSNAStatsCCMPFormatErrors++;
>   return -2;
>   }
>   keyidx >>= 6;
>   if (key->key_idx != keyidx) {
> - printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
> priv=%p\n",
> - key->key_idx, keyidx, priv);
> + net_dbg_ratelimited("CCMP: RX tkey->key_idx=%d frame keyidx=%d 
> priv=%p\n",
> + key->key_idx, keyidx, priv);
>   return -6;
>   }
>   if (!key->key_set) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: received packet from %pM with 
> keyid=%d that does not have a configured key\n",
> - hdr->addr2, keyidx);
> + net_dbg_ratelimited("CCMP: received packet from %pM 
> with keyid=%d that does not have a configured key\n",
> + hdr->addr2, keyidx);
>   }
>   return -3;
>   }
> @@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
> int hdr_len, void *priv)
>
>   if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
> previous PN %pm received PN %pm\n",
> -hdr->addr2, key->rx_pn, pn);
> + net_dbg_ratelimited("CCMP: replay detected: STA=%pM 
> previous PN %pm received PN %pm\n",
> + hdr->addr2, key->rx_pn, pn);
>   }
>   key->dot11RSNAStatsCCMPReplays++;
>   return -4;
> @@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
> int hdr_len, void *priv)
>
>   if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: decrypt failed: 
> STA=%pM\n",
> - hdr->addr2);
> + net_dbg_ratelimited("CCMP: decrypt failed: 
> STA=%pM\n",
> + hdr->addr2);
>   }
>   key->dot11RSNAStatsCCMPDecryptErrors++;
>   return -5;
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20180305073256.GA4347%40seema-Inspiron-15-3567.
> For more options, visit 

Re: [Outreachy kernel] [PATCH v2] staging: rtl8192u: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Julia Lawall


On Mon, 5 Mar 2018, Arushi Singhal wrote:

> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.

I asked several questions about the above two lines, which as far as I can
see haven't been answered. Please excuse me if I missed the answers, but I
would still like to know what they are.

Namely, why did you choose to change to rate limited output, and what does
the "device name as a prefix" comment mean?

julia

> Indentation is also changed, to fix the  checkpatch issue if line is not
> exceding 80 characters.
>
> Signed-off-by: Arushi Singhal 
> ---
> changes in v2
> *change the subject line, in v1 driver name was wrong.
>
>  .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 
> +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
> b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> index e6648f7..200fe5f 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> @@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
>
>   priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
>   if (IS_ERR(priv->tfm)) {
> - printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
> crypto API aes\n");
> + net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
> crypto API aes\n");
>   priv->tfm = NULL;
>   goto fail;
>   }
> @@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
> int hdr_len, void *priv)
>   keyidx = pos[3];
>   if (!(keyidx & (1 << 5))) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: received packet without ExtIV 
> flag from %pM\n",
> - hdr->addr2);
> + net_dbg_ratelimited("CCMP: received packet without 
> ExtIV flag from %pM\n",
> + hdr->addr2);
>   }
>   key->dot11RSNAStatsCCMPFormatErrors++;
>   return -2;
>   }
>   keyidx >>= 6;
>   if (key->key_idx != keyidx) {
> - printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
> priv=%p\n",
> - key->key_idx, keyidx, priv);
> + net_dbg_ratelimited("CCMP: RX tkey->key_idx=%d frame keyidx=%d 
> priv=%p\n",
> + key->key_idx, keyidx, priv);
>   return -6;
>   }
>   if (!key->key_set) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: received packet from %pM with 
> keyid=%d that does not have a configured key\n",
> - hdr->addr2, keyidx);
> + net_dbg_ratelimited("CCMP: received packet from %pM 
> with keyid=%d that does not have a configured key\n",
> + hdr->addr2, keyidx);
>   }
>   return -3;
>   }
> @@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
> int hdr_len, void *priv)
>
>   if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
> previous PN %pm received PN %pm\n",
> -hdr->addr2, key->rx_pn, pn);
> + net_dbg_ratelimited("CCMP: replay detected: STA=%pM 
> previous PN %pm received PN %pm\n",
> + hdr->addr2, key->rx_pn, pn);
>   }
>   key->dot11RSNAStatsCCMPReplays++;
>   return -4;
> @@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
> int hdr_len, void *priv)
>
>   if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: decrypt failed: 
> STA=%pM\n",
> - hdr->addr2);
> + net_dbg_ratelimited("CCMP: decrypt failed: 
> STA=%pM\n",
> + hdr->addr2);
>   }
>   key->dot11RSNAStatsCCMPDecryptErrors++;
>   return -5;
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20180305073256.GA4347%40seema-Inspiron-15-3567.
> For more options, visit https://groups.google.com/d/optout.
>


[PATCH v2] staging: rtl8192u: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.
Indentation is also changed, to fix the  checkpatch issue if line is not
exceding 80 characters.

Signed-off-by: Arushi Singhal 
---
changes in v2
*change the subject line, in v1 driver name was wrong.

 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
index e6648f7..200fe5f 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
@@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
 
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
-   printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
+   net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
priv->tfm = NULL;
goto fail;
}
@@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
int hdr_len, void *priv)
keyidx = pos[3];
if (!(keyidx & (1 << 5))) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet without ExtIV 
flag from %pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: received packet without 
ExtIV flag from %pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPFormatErrors++;
return -2;
}
keyidx >>= 6;
if (key->key_idx != keyidx) {
-   printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
-   key->key_idx, keyidx, priv);
+   net_dbg_ratelimited("CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
+   key->key_idx, keyidx, priv);
return -6;
}
if (!key->key_set) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet from %pM with 
keyid=%d that does not have a configured key\n",
-   hdr->addr2, keyidx);
+   net_dbg_ratelimited("CCMP: received packet from %pM 
with keyid=%d that does not have a configured key\n",
+   hdr->addr2, keyidx);
}
return -3;
}
@@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
-  hdr->addr2, key->rx_pn, pn);
+   net_dbg_ratelimited("CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
+   hdr->addr2, key->rx_pn, pn);
}
key->dot11RSNAStatsCCMPReplays++;
return -4;
@@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: decrypt failed: 
STA=%pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: decrypt failed: 
STA=%pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPDecryptErrors++;
return -5;
-- 
2.7.4



[PATCH v2] staging: rtl8192u: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Arushi Singhal
Replace printk having a log level with the appropriate
net_*macro_ratelimited.
It's better to use actual device name as a prefix in error messages.
Indentation is also changed, to fix the  checkpatch issue if line is not
exceding 80 characters.

Signed-off-by: Arushi Singhal 
---
changes in v2
*change the subject line, in v1 driver name was wrong.

 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
index e6648f7..200fe5f 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
@@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
 
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
-   printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
+   net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
crypto API aes\n");
priv->tfm = NULL;
goto fail;
}
@@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
int hdr_len, void *priv)
keyidx = pos[3];
if (!(keyidx & (1 << 5))) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet without ExtIV 
flag from %pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: received packet without 
ExtIV flag from %pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPFormatErrors++;
return -2;
}
keyidx >>= 6;
if (key->key_idx != keyidx) {
-   printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
-   key->key_idx, keyidx, priv);
+   net_dbg_ratelimited("CCMP: RX tkey->key_idx=%d frame keyidx=%d 
priv=%p\n",
+   key->key_idx, keyidx, priv);
return -6;
}
if (!key->key_set) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: received packet from %pM with 
keyid=%d that does not have a configured key\n",
-   hdr->addr2, keyidx);
+   net_dbg_ratelimited("CCMP: received packet from %pM 
with keyid=%d that does not have a configured key\n",
+   hdr->addr2, keyidx);
}
return -3;
}
@@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
-  hdr->addr2, key->rx_pn, pn);
+   net_dbg_ratelimited("CCMP: replay detected: STA=%pM 
previous PN %pm received PN %pm\n",
+   hdr->addr2, key->rx_pn, pn);
}
key->dot11RSNAStatsCCMPReplays++;
return -4;
@@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
 
if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
if (net_ratelimit()) {
-   printk(KERN_DEBUG "CCMP: decrypt failed: 
STA=%pM\n",
-   hdr->addr2);
+   net_dbg_ratelimited("CCMP: decrypt failed: 
STA=%pM\n",
+   hdr->addr2);
}
key->dot11RSNAStatsCCMPDecryptErrors++;
return -5;
-- 
2.7.4



Re: [PATCH] drm/sun4i: move rgb mode_valid from connector to encoder

2018-03-04 Thread Maxime Ripard


On Sun, Mar 04, 2018 at 11:37:50AM +0100, Giulio Benetti wrote:
> mode_valid function must be connected to encoder, not connector.
> Otherwise it doesn't get called by drm.

That's not true, or rather, that's a big oversimplification. It
doesn't get called by DRM if you have a bridge instead of a panel
attached to the encoder.

> Move mode_valid function pointer to encoder helper functions,
> changing its prototype according to encoder helper function pointer.
> 
> Signed-off-by: Giulio Benetti 
> ---
>  drivers/gpu/drm/sun4i/sun4i_rgb.c | 102 
> +++---
>  1 file changed, 51 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
> b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> index b8da5a5..6539dcc 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> @@ -52,11 +52,59 @@ static int sun4i_rgb_get_modes(struct drm_connector 
> *connector)
>   return drm_panel_get_modes(tcon->panel);
>  }
>  
> -static int sun4i_rgb_mode_valid(struct drm_connector *connector,
> - struct drm_display_mode *mode)
> +static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
> + .get_modes  = sun4i_rgb_get_modes,
> +};
> +
> +static void
> +sun4i_rgb_connector_destroy(struct drm_connector *connector)
>  {
>   struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
>   struct sun4i_tcon *tcon = rgb->tcon;
> +
> + drm_panel_detach(tcon->panel);
> + drm_connector_cleanup(connector);
> +}
> +
> +static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
> + .fill_modes = drm_helper_probe_single_connector_modes,
> + .destroy= sun4i_rgb_connector_destroy,
> + .reset  = drm_atomic_helper_connector_reset,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> + .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
> +};
> +
> +static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
> +{
> + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> + struct sun4i_tcon *tcon = rgb->tcon;
> +
> + DRM_DEBUG_DRIVER("Enabling RGB output\n");
> +
> + if (!IS_ERR(tcon->panel)) {
> + drm_panel_prepare(tcon->panel);
> + drm_panel_enable(tcon->panel);
> + }
> +}
> +
> +static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
> +{
> + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> + struct sun4i_tcon *tcon = rgb->tcon;
> +
> + DRM_DEBUG_DRIVER("Disabling RGB output\n");
> +
> + if (!IS_ERR(tcon->panel)) {
> + drm_panel_disable(tcon->panel);
> + drm_panel_unprepare(tcon->panel);
> + }
> +}
> +
> +static enum drm_mode_status sun4i_rgb_encoder_mode_valid(struct drm_encoder 
> *crtc,
> +  const struct 
> drm_display_mode *mode)
> +{
> + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(crtc);
> + struct sun4i_tcon *tcon = rgb->tcon;
>   u32 hsync = mode->hsync_end - mode->hsync_start;
>   u32 vsync = mode->vsync_end - mode->vsync_start;
>   unsigned long rate = mode->clock * 1000;
> @@ -106,58 +154,10 @@ static int sun4i_rgb_mode_valid(struct drm_connector 
> *connector,
>   return MODE_OK;
>  }
>  
> -static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
> - .get_modes  = sun4i_rgb_get_modes,
> - .mode_valid = sun4i_rgb_mode_valid,
> -};
> -
> -static void
> -sun4i_rgb_connector_destroy(struct drm_connector *connector)
> -{
> - struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
> - struct sun4i_tcon *tcon = rgb->tcon;
> -
> - drm_panel_detach(tcon->panel);
> - drm_connector_cleanup(connector);
> -}
> -
> -static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
> - .fill_modes = drm_helper_probe_single_connector_modes,
> - .destroy= sun4i_rgb_connector_destroy,
> - .reset  = drm_atomic_helper_connector_reset,
> - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> - .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
> -};
> -
> -static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
> -{
> - struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> - struct sun4i_tcon *tcon = rgb->tcon;
> -
> - DRM_DEBUG_DRIVER("Enabling RGB output\n");
> -
> - if (!IS_ERR(tcon->panel)) {
> - drm_panel_prepare(tcon->panel);
> - drm_panel_enable(tcon->panel);
> - }
> -}
> -
> -static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
> -{
> - struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> - struct sun4i_tcon *tcon = rgb->tcon;
> -
> - DRM_DEBUG_DRIVER("Disabling RGB output\n");
> -
> - if 

Re: [PATCH] drm/sun4i: move rgb mode_valid from connector to encoder

2018-03-04 Thread Maxime Ripard


On Sun, Mar 04, 2018 at 11:37:50AM +0100, Giulio Benetti wrote:
> mode_valid function must be connected to encoder, not connector.
> Otherwise it doesn't get called by drm.

That's not true, or rather, that's a big oversimplification. It
doesn't get called by DRM if you have a bridge instead of a panel
attached to the encoder.

> Move mode_valid function pointer to encoder helper functions,
> changing its prototype according to encoder helper function pointer.
> 
> Signed-off-by: Giulio Benetti 
> ---
>  drivers/gpu/drm/sun4i/sun4i_rgb.c | 102 
> +++---
>  1 file changed, 51 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c 
> b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> index b8da5a5..6539dcc 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c
> @@ -52,11 +52,59 @@ static int sun4i_rgb_get_modes(struct drm_connector 
> *connector)
>   return drm_panel_get_modes(tcon->panel);
>  }
>  
> -static int sun4i_rgb_mode_valid(struct drm_connector *connector,
> - struct drm_display_mode *mode)
> +static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
> + .get_modes  = sun4i_rgb_get_modes,
> +};
> +
> +static void
> +sun4i_rgb_connector_destroy(struct drm_connector *connector)
>  {
>   struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
>   struct sun4i_tcon *tcon = rgb->tcon;
> +
> + drm_panel_detach(tcon->panel);
> + drm_connector_cleanup(connector);
> +}
> +
> +static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
> + .fill_modes = drm_helper_probe_single_connector_modes,
> + .destroy= sun4i_rgb_connector_destroy,
> + .reset  = drm_atomic_helper_connector_reset,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> + .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
> +};
> +
> +static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
> +{
> + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> + struct sun4i_tcon *tcon = rgb->tcon;
> +
> + DRM_DEBUG_DRIVER("Enabling RGB output\n");
> +
> + if (!IS_ERR(tcon->panel)) {
> + drm_panel_prepare(tcon->panel);
> + drm_panel_enable(tcon->panel);
> + }
> +}
> +
> +static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
> +{
> + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> + struct sun4i_tcon *tcon = rgb->tcon;
> +
> + DRM_DEBUG_DRIVER("Disabling RGB output\n");
> +
> + if (!IS_ERR(tcon->panel)) {
> + drm_panel_disable(tcon->panel);
> + drm_panel_unprepare(tcon->panel);
> + }
> +}
> +
> +static enum drm_mode_status sun4i_rgb_encoder_mode_valid(struct drm_encoder 
> *crtc,
> +  const struct 
> drm_display_mode *mode)
> +{
> + struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(crtc);
> + struct sun4i_tcon *tcon = rgb->tcon;
>   u32 hsync = mode->hsync_end - mode->hsync_start;
>   u32 vsync = mode->vsync_end - mode->vsync_start;
>   unsigned long rate = mode->clock * 1000;
> @@ -106,58 +154,10 @@ static int sun4i_rgb_mode_valid(struct drm_connector 
> *connector,
>   return MODE_OK;
>  }
>  
> -static struct drm_connector_helper_funcs sun4i_rgb_con_helper_funcs = {
> - .get_modes  = sun4i_rgb_get_modes,
> - .mode_valid = sun4i_rgb_mode_valid,
> -};
> -
> -static void
> -sun4i_rgb_connector_destroy(struct drm_connector *connector)
> -{
> - struct sun4i_rgb *rgb = drm_connector_to_sun4i_rgb(connector);
> - struct sun4i_tcon *tcon = rgb->tcon;
> -
> - drm_panel_detach(tcon->panel);
> - drm_connector_cleanup(connector);
> -}
> -
> -static const struct drm_connector_funcs sun4i_rgb_con_funcs = {
> - .fill_modes = drm_helper_probe_single_connector_modes,
> - .destroy= sun4i_rgb_connector_destroy,
> - .reset  = drm_atomic_helper_connector_reset,
> - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> - .atomic_destroy_state   = drm_atomic_helper_connector_destroy_state,
> -};
> -
> -static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
> -{
> - struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> - struct sun4i_tcon *tcon = rgb->tcon;
> -
> - DRM_DEBUG_DRIVER("Enabling RGB output\n");
> -
> - if (!IS_ERR(tcon->panel)) {
> - drm_panel_prepare(tcon->panel);
> - drm_panel_enable(tcon->panel);
> - }
> -}
> -
> -static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
> -{
> - struct sun4i_rgb *rgb = drm_encoder_to_sun4i_rgb(encoder);
> - struct sun4i_tcon *tcon = rgb->tcon;
> -
> - DRM_DEBUG_DRIVER("Disabling RGB output\n");
> -
> - if (!IS_ERR(tcon->panel)) {
> - 

Re: [RESEND PATCH] perf sched map: re-annotate shortname if thread comm changed

2018-03-04 Thread Du, Changbin
On Fri, Mar 02, 2018 at 11:43:12AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Feb 23, 2018 at 07:40:40PM +0800, changbin...@intel.com escreveu:
> > From: Changbin Du 
> > 
> > This is to show the real name of thread that created via fork-exec.
> > See below example for shortname *A0*.
> 
> Can you ellaborate a bit more and perhaps provide before and after
> outputs?
> 
> - Arnaldo
>
Arnaldo, please see below diff stat.
  *A0   80393.050639 secs A0 => perf:22368
  *.   A0   80393.050748 secs .  => swapper:0
   .  *.80393.050887 secs
  *B0  .   .80393.052735 secs B0 => rcu_sched:8
  *.   .   .80393.052743 secs
   .  *C0  .80393.056264 secs C0 => kworker/2:1H:287
   .  *A0  .80393.056270 secs
   .  *D0  .80393.056769 secs D0 => ksoftirqd/2:22
-  .  *A0  .80393.056804 secs
+  .  *A0  .80393.056804 secs A0 => pi:22368
   .  *.   .80393.056854 secs


> > $ sudo ./perf sched map
> >   *A0   80393.050639 secs A0 => perf:22368
> >   *.   A0   80393.050748 secs .  => swapper:0
> >.  *.80393.050887 secs
> >   *B0  .   .80393.052735 secs B0 => rcu_sched:8
> >   *.   .   .80393.052743 secs
> >.  *C0  .80393.056264 secs C0 => kworker/2:1H:287
> >.  *A0  .80393.056270 secs
> >.  *D0  .80393.056769 secs D0 => ksoftirqd/2:22
> >.  *A0  .80393.056804 secs A0 => pi:22368
> >.  *.   .80393.056854 secs
> >   *B0  .   .80393.060727 secs
> >   ...
> > 
> > Signed-off-by: Changbin Du 
> > ---
> >  tools/perf/builtin-sched.c | 4 +++-
> >  tools/perf/util/thread.c   | 1 +
> >  tools/perf/util/thread.h   | 1 +
> >  3 files changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> > index 83283fe..53bb8df 100644
> > --- a/tools/perf/builtin-sched.c
> > +++ b/tools/perf/builtin-sched.c
> > @@ -1580,7 +1580,7 @@ static int map_switch_event(struct perf_sched *sched, 
> > struct perf_evsel *evsel,
> >  
> > timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestamp));
> > color_fprintf(stdout, color, "  %12s secs ", stimestamp);
> > -   if (new_shortname || (verbose > 0 && sched_in->tid)) {
> > +   if (new_shortname || sched_in->comm_changed || (verbose > 0 && 
> > sched_in->tid)) {
> > const char *pid_color = color;
> >  
> > if (thread__has_color(sched_in))
> > @@ -1588,6 +1588,8 @@ static int map_switch_event(struct perf_sched *sched, 
> > struct perf_evsel *evsel,
> >  
> > color_fprintf(stdout, pid_color, "%s => %s:%d",
> >sched_in->shortname, thread__comm_str(sched_in), 
> > sched_in->tid);
> > +
> > +   sched_in->comm_changed = false;
> > }
> >  
> > if (sched->map.comp && new_cpu)
> > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
> > index 68b65b1..c660fe6 100644
> > --- a/tools/perf/util/thread.c
> > +++ b/tools/perf/util/thread.c
> > @@ -212,6 +212,7 @@ static int thread__set_comm(struct thread *thread, 
> > const char *str,
> > unwind__flush_access(thread);
> > }
> >  
> > +   thread->comm_changed = true;
> > thread->comm_set = true;
> >  
> > return 0;
> > diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
> > index 40cfa36..b9a328b 100644
> > --- a/tools/perf/util/thread.h
> > +++ b/tools/perf/util/thread.h
> > @@ -27,6 +27,7 @@ struct thread {
> > int cpu;
> > refcount_t  refcnt;
> > charshortname[3];
> > +   boolcomm_changed;
> > boolcomm_set;
> > int comm_len;
> > booldead; /* if set thread has exited */
> > -- 
> > 2.7.4

-- 
Thanks,
Changbin Du


Re: [RESEND PATCH] perf sched map: re-annotate shortname if thread comm changed

2018-03-04 Thread Du, Changbin
On Fri, Mar 02, 2018 at 11:43:12AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Fri, Feb 23, 2018 at 07:40:40PM +0800, changbin...@intel.com escreveu:
> > From: Changbin Du 
> > 
> > This is to show the real name of thread that created via fork-exec.
> > See below example for shortname *A0*.
> 
> Can you ellaborate a bit more and perhaps provide before and after
> outputs?
> 
> - Arnaldo
>
Arnaldo, please see below diff stat.
  *A0   80393.050639 secs A0 => perf:22368
  *.   A0   80393.050748 secs .  => swapper:0
   .  *.80393.050887 secs
  *B0  .   .80393.052735 secs B0 => rcu_sched:8
  *.   .   .80393.052743 secs
   .  *C0  .80393.056264 secs C0 => kworker/2:1H:287
   .  *A0  .80393.056270 secs
   .  *D0  .80393.056769 secs D0 => ksoftirqd/2:22
-  .  *A0  .80393.056804 secs
+  .  *A0  .80393.056804 secs A0 => pi:22368
   .  *.   .80393.056854 secs


> > $ sudo ./perf sched map
> >   *A0   80393.050639 secs A0 => perf:22368
> >   *.   A0   80393.050748 secs .  => swapper:0
> >.  *.80393.050887 secs
> >   *B0  .   .80393.052735 secs B0 => rcu_sched:8
> >   *.   .   .80393.052743 secs
> >.  *C0  .80393.056264 secs C0 => kworker/2:1H:287
> >.  *A0  .80393.056270 secs
> >.  *D0  .80393.056769 secs D0 => ksoftirqd/2:22
> >.  *A0  .80393.056804 secs A0 => pi:22368
> >.  *.   .80393.056854 secs
> >   *B0  .   .80393.060727 secs
> >   ...
> > 
> > Signed-off-by: Changbin Du 
> > ---
> >  tools/perf/builtin-sched.c | 4 +++-
> >  tools/perf/util/thread.c   | 1 +
> >  tools/perf/util/thread.h   | 1 +
> >  3 files changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> > index 83283fe..53bb8df 100644
> > --- a/tools/perf/builtin-sched.c
> > +++ b/tools/perf/builtin-sched.c
> > @@ -1580,7 +1580,7 @@ static int map_switch_event(struct perf_sched *sched, 
> > struct perf_evsel *evsel,
> >  
> > timestamp__scnprintf_usec(timestamp, stimestamp, sizeof(stimestamp));
> > color_fprintf(stdout, color, "  %12s secs ", stimestamp);
> > -   if (new_shortname || (verbose > 0 && sched_in->tid)) {
> > +   if (new_shortname || sched_in->comm_changed || (verbose > 0 && 
> > sched_in->tid)) {
> > const char *pid_color = color;
> >  
> > if (thread__has_color(sched_in))
> > @@ -1588,6 +1588,8 @@ static int map_switch_event(struct perf_sched *sched, 
> > struct perf_evsel *evsel,
> >  
> > color_fprintf(stdout, pid_color, "%s => %s:%d",
> >sched_in->shortname, thread__comm_str(sched_in), 
> > sched_in->tid);
> > +
> > +   sched_in->comm_changed = false;
> > }
> >  
> > if (sched->map.comp && new_cpu)
> > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
> > index 68b65b1..c660fe6 100644
> > --- a/tools/perf/util/thread.c
> > +++ b/tools/perf/util/thread.c
> > @@ -212,6 +212,7 @@ static int thread__set_comm(struct thread *thread, 
> > const char *str,
> > unwind__flush_access(thread);
> > }
> >  
> > +   thread->comm_changed = true;
> > thread->comm_set = true;
> >  
> > return 0;
> > diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
> > index 40cfa36..b9a328b 100644
> > --- a/tools/perf/util/thread.h
> > +++ b/tools/perf/util/thread.h
> > @@ -27,6 +27,7 @@ struct thread {
> > int cpu;
> > refcount_t  refcnt;
> > charshortname[3];
> > +   boolcomm_changed;
> > boolcomm_set;
> > int comm_len;
> > booldead; /* if set thread has exited */
> > -- 
> > 2.7.4

-- 
Thanks,
Changbin Du


Re: [Outreachy kernel] [PATCH v2] staging: comedi: Replace "dont" with "don't

2018-03-04 Thread Julia Lawall


On Mon, 5 Mar 2018, Arushi Singhal wrote:

> Replace "dont" with "don't".
> "Dont" is not same as "Do not" or "Don't".
>
> Signed-off-by: Arushi Singhal 

Acked-by: Julia Lawall 

> ---
> changes in v2
> *Commit log is rewrite in the imperative.
>
>  drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +-
>  drivers/staging/comedi/drivers/das16.c   | 2 +-
>  drivers/staging/comedi/drivers/das16m1.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
> b/drivers/staging/comedi/drivers/cb_pcidas64.c
> index c007500..ceef905 100644
> --- a/drivers/staging/comedi/drivers/cb_pcidas64.c
> +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
> @@ -1700,7 +1700,7 @@ static void i2c_write(struct comedi_device *dev, 
> unsigned int address,
>* eeprom and i2c bus
>*/
>
> - /* make sure we dont send anything to eeprom */
> + /* make sure we don't send anything to eeprom */
>   devpriv->plx_control_bits &= ~PLX_CNTRL_EECS;
>
>   i2c_stop(dev);
> diff --git a/drivers/staging/comedi/drivers/das16.c 
> b/drivers/staging/comedi/drivers/das16.c
> index 74ff204..81eb51b 100644
> --- a/drivers/staging/comedi/drivers/das16.c
> +++ b/drivers/staging/comedi/drivers/das16.c
> @@ -619,7 +619,7 @@ static int das16_cmd_test(struct comedi_device *dev, 
> struct comedi_subdevice *s,
>
>   /* Step 2b : and mutually compatible */
>
> - /*  make sure scan_begin_src and convert_src dont conflict */
> + /*  make sure scan_begin_src and convert_src don't conflict */
>   if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW)
>   err |= -EINVAL;
>   if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_NOW)
> diff --git a/drivers/staging/comedi/drivers/das16m1.c 
> b/drivers/staging/comedi/drivers/das16m1.c
> index 72f8ed2..4e36377 100644
> --- a/drivers/staging/comedi/drivers/das16m1.c
> +++ b/drivers/staging/comedi/drivers/das16m1.c
> @@ -407,7 +407,7 @@ static void das16m1_handler(struct comedi_device *dev, 
> unsigned int status)
>   if (num_samples > cmd->stop_arg * cmd->chanlist_len)
>   num_samples = cmd->stop_arg * cmd->chanlist_len;
>   }
> - /*  make sure we dont try to get too many points if fifo has overrun */
> + /*  make sure we don't try to get too many points if fifo has overrun */
>   if (num_samples > DAS16M1_AI_FIFO_SZ)
>   num_samples = DAS16M1_AI_FIFO_SZ;
>   insw(dev->iobase, devpriv->ai_buffer, num_samples);
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20180305042808.GA24032%40seema-Inspiron-15-3567.
> For more options, visit https://groups.google.com/d/optout.
>


Re: [Outreachy kernel] [PATCH v2] staging: comedi: Replace "dont" with "don't

2018-03-04 Thread Julia Lawall


On Mon, 5 Mar 2018, Arushi Singhal wrote:

> Replace "dont" with "don't".
> "Dont" is not same as "Do not" or "Don't".
>
> Signed-off-by: Arushi Singhal 

Acked-by: Julia Lawall 

> ---
> changes in v2
> *Commit log is rewrite in the imperative.
>
>  drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +-
>  drivers/staging/comedi/drivers/das16.c   | 2 +-
>  drivers/staging/comedi/drivers/das16m1.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
> b/drivers/staging/comedi/drivers/cb_pcidas64.c
> index c007500..ceef905 100644
> --- a/drivers/staging/comedi/drivers/cb_pcidas64.c
> +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
> @@ -1700,7 +1700,7 @@ static void i2c_write(struct comedi_device *dev, 
> unsigned int address,
>* eeprom and i2c bus
>*/
>
> - /* make sure we dont send anything to eeprom */
> + /* make sure we don't send anything to eeprom */
>   devpriv->plx_control_bits &= ~PLX_CNTRL_EECS;
>
>   i2c_stop(dev);
> diff --git a/drivers/staging/comedi/drivers/das16.c 
> b/drivers/staging/comedi/drivers/das16.c
> index 74ff204..81eb51b 100644
> --- a/drivers/staging/comedi/drivers/das16.c
> +++ b/drivers/staging/comedi/drivers/das16.c
> @@ -619,7 +619,7 @@ static int das16_cmd_test(struct comedi_device *dev, 
> struct comedi_subdevice *s,
>
>   /* Step 2b : and mutually compatible */
>
> - /*  make sure scan_begin_src and convert_src dont conflict */
> + /*  make sure scan_begin_src and convert_src don't conflict */
>   if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW)
>   err |= -EINVAL;
>   if (cmd->scan_begin_src != TRIG_FOLLOW && cmd->convert_src != TRIG_NOW)
> diff --git a/drivers/staging/comedi/drivers/das16m1.c 
> b/drivers/staging/comedi/drivers/das16m1.c
> index 72f8ed2..4e36377 100644
> --- a/drivers/staging/comedi/drivers/das16m1.c
> +++ b/drivers/staging/comedi/drivers/das16m1.c
> @@ -407,7 +407,7 @@ static void das16m1_handler(struct comedi_device *dev, 
> unsigned int status)
>   if (num_samples > cmd->stop_arg * cmd->chanlist_len)
>   num_samples = cmd->stop_arg * cmd->chanlist_len;
>   }
> - /*  make sure we dont try to get too many points if fifo has overrun */
> + /*  make sure we don't try to get too many points if fifo has overrun */
>   if (num_samples > DAS16M1_AI_FIFO_SZ)
>   num_samples = DAS16M1_AI_FIFO_SZ;
>   insw(dev->iobase, devpriv->ai_buffer, num_samples);
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20180305042808.GA24032%40seema-Inspiron-15-3567.
> For more options, visit https://groups.google.com/d/optout.
>


[PATCH] mtd: rawnand: vf610_nfc: fix returnvar.cocci warnings

2018-03-04 Thread Julia Lawall
From: Fengguang Wu 

 Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

CC: Stefan Agner 
Signed-off-by: Fengguang Wu 
Signed-off-by: Julia Lawall 
---

Not a big deal, but the code can be a tiny bit simpler.

 vf610_nfc.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -870,7 +870,6 @@ static int vf610_nfc_write_page(struct m
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
int trfr_sz = mtd->writesize + mtd->oobsize;
u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0;
-   int ret = 0;

cmd2 |= NAND_CMD_SEQIN << CMD_BYTE1_SHIFT;
code |= COMMAND_CMD_BYTE1 | COMMAND_CAR_BYTE1 | COMMAND_CAR_BYTE2;
@@ -894,7 +893,7 @@ static int vf610_nfc_write_page(struct m
vf610_nfc_run(nfc, 0, row, cmd1, cmd2, trfr_sz);
vf610_nfc_ecc_mode(nfc, ECC_BYPASS);

-   return ret;
+   return 0;
 }

 static int vf610_nfc_read_page_raw(struct mtd_info *mtd,


[PATCH] mtd: rawnand: vf610_nfc: fix returnvar.cocci warnings

2018-03-04 Thread Julia Lawall
From: Fengguang Wu 

 Remove unneeded variable used to store return value.

Generated by: scripts/coccinelle/misc/returnvar.cocci

CC: Stefan Agner 
Signed-off-by: Fengguang Wu 
Signed-off-by: Julia Lawall 
---

Not a big deal, but the code can be a tiny bit simpler.

 vf610_nfc.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -870,7 +870,6 @@ static int vf610_nfc_write_page(struct m
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
int trfr_sz = mtd->writesize + mtd->oobsize;
u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0;
-   int ret = 0;

cmd2 |= NAND_CMD_SEQIN << CMD_BYTE1_SHIFT;
code |= COMMAND_CMD_BYTE1 | COMMAND_CAR_BYTE1 | COMMAND_CAR_BYTE2;
@@ -894,7 +893,7 @@ static int vf610_nfc_write_page(struct m
vf610_nfc_run(nfc, 0, row, cmd1, cmd2, trfr_sz);
vf610_nfc_ecc_mode(nfc, ECC_BYPASS);

-   return ret;
+   return 0;
 }

 static int vf610_nfc_read_page_raw(struct mtd_info *mtd,


Re: [RESEND PATCH] perf sched map: re-annotate shortname if thread comm changed

2018-03-04 Thread Du, Changbin
Hi,
On Fri, Mar 02, 2018 at 11:47:32PM +0900, Namhyung Kim wrote:
> Hi,
> 
> On Fri, Mar 02, 2018 at 12:38:45PM +0100, Jiri Olsa wrote:
> > On Fri, Mar 02, 2018 at 06:52:54PM +0800, Du, Changbin wrote:
> > > Hello, any comment?
> > 
> > sry, overlooked this one
> > 
> > SNIP
> > 
> > > > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
> > > > index 68b65b1..c660fe6 100644
> > > > --- a/tools/perf/util/thread.c
> > > > +++ b/tools/perf/util/thread.c
> > > > @@ -212,6 +212,7 @@ static int thread__set_comm(struct thread 
> > > > *thread, const char *str,
> > > > unwind__flush_access(thread);
> > > > }
> > > >  
> > > > +   thread->comm_changed = true;
> > > > thread->comm_set = true;
> > > >  
> > > > return 0;
> > > > diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
> > > > index 40cfa36..b9a328b 100644
> > > > --- a/tools/perf/util/thread.h
> > > > +++ b/tools/perf/util/thread.h
> > > > @@ -27,6 +27,7 @@ struct thread {
> > > > int cpu;
> > > > refcount_t  refcnt;
> > > > charshortname[3];
> > > > +   boolcomm_changed;
> > 
> > I don't like that it's in struct thread and set by generic function,
> > and just one command (sched) checks/sets it back.. I'd rather see it
> > in thread::priv area..
> 
> 100% agreed.
> 
> 
> > on the other hand it's simple enough and looks
> > like generic solution would be more tricky
> 
> What about adding perf_sched__process_comm() to set it in the
> thread::priv?
>
I can be done, then thread->comm_changed moves to thread_runtime->comm_changed.
Draft code as below. It is also a little tricky.

+int perf_sched__process_comm(struct perf_tool *tool __maybe_unused,
+union perf_event *event,
+struct perf_sample *sample,
+struct machine *machine)
+{
+   struct thread *thread;
+   struct thread_runtime *r;
+
+   perf_event__process_comm(tool, event, sample, machine);
+
+   thread = machine__findnew_thread(machine, pid, tid);
+   if (thread) {
+   r = thread__priv(thread);
+   if (r)
+   r->comm_changed = true;
+   thread__put(thread);
+   }
+}
+
 static int perf_sched__read_events(struct perf_sched *sched)
 {
const struct perf_evsel_str_handler handlers[] = {
@@ -3291,7 +3311,7 @@ int cmd_sched(int argc, const char **argv)
struct perf_sched sched = {
.tool = {
.sample  = 
perf_sched__process_tracepoint_sample,
-   .comm= perf_event__process_comm,
+   .comm= perf_sched__process_comm,


But I'd keep 'comm_changed' where 'shortname' is defined. I think they should 
appears
togother. And 'shortname' is only used by sched command, too.

So I still prefer my privous simpler change. Thanks!

> Thanks,
> Namhyung

-- 
Thanks,
Changbin Du


Re: [RESEND PATCH] perf sched map: re-annotate shortname if thread comm changed

2018-03-04 Thread Du, Changbin
Hi,
On Fri, Mar 02, 2018 at 11:47:32PM +0900, Namhyung Kim wrote:
> Hi,
> 
> On Fri, Mar 02, 2018 at 12:38:45PM +0100, Jiri Olsa wrote:
> > On Fri, Mar 02, 2018 at 06:52:54PM +0800, Du, Changbin wrote:
> > > Hello, any comment?
> > 
> > sry, overlooked this one
> > 
> > SNIP
> > 
> > > > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
> > > > index 68b65b1..c660fe6 100644
> > > > --- a/tools/perf/util/thread.c
> > > > +++ b/tools/perf/util/thread.c
> > > > @@ -212,6 +212,7 @@ static int thread__set_comm(struct thread 
> > > > *thread, const char *str,
> > > > unwind__flush_access(thread);
> > > > }
> > > >  
> > > > +   thread->comm_changed = true;
> > > > thread->comm_set = true;
> > > >  
> > > > return 0;
> > > > diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h
> > > > index 40cfa36..b9a328b 100644
> > > > --- a/tools/perf/util/thread.h
> > > > +++ b/tools/perf/util/thread.h
> > > > @@ -27,6 +27,7 @@ struct thread {
> > > > int cpu;
> > > > refcount_t  refcnt;
> > > > charshortname[3];
> > > > +   boolcomm_changed;
> > 
> > I don't like that it's in struct thread and set by generic function,
> > and just one command (sched) checks/sets it back.. I'd rather see it
> > in thread::priv area..
> 
> 100% agreed.
> 
> 
> > on the other hand it's simple enough and looks
> > like generic solution would be more tricky
> 
> What about adding perf_sched__process_comm() to set it in the
> thread::priv?
>
I can be done, then thread->comm_changed moves to thread_runtime->comm_changed.
Draft code as below. It is also a little tricky.

+int perf_sched__process_comm(struct perf_tool *tool __maybe_unused,
+union perf_event *event,
+struct perf_sample *sample,
+struct machine *machine)
+{
+   struct thread *thread;
+   struct thread_runtime *r;
+
+   perf_event__process_comm(tool, event, sample, machine);
+
+   thread = machine__findnew_thread(machine, pid, tid);
+   if (thread) {
+   r = thread__priv(thread);
+   if (r)
+   r->comm_changed = true;
+   thread__put(thread);
+   }
+}
+
 static int perf_sched__read_events(struct perf_sched *sched)
 {
const struct perf_evsel_str_handler handlers[] = {
@@ -3291,7 +3311,7 @@ int cmd_sched(int argc, const char **argv)
struct perf_sched sched = {
.tool = {
.sample  = 
perf_sched__process_tracepoint_sample,
-   .comm= perf_event__process_comm,
+   .comm= perf_sched__process_comm,


But I'd keep 'comm_changed' where 'shortname' is defined. I think they should 
appears
togother. And 'shortname' is only used by sched command, too.

So I still prefer my privous simpler change. Thanks!

> Thanks,
> Namhyung

-- 
Thanks,
Changbin Du


[PATCH] x86/tools/relocs: comments cleanup

2018-03-04 Thread Cao jin
1. typo fix: there -> their
2. remove superfluous "by"

Signed-off-by: Cao jin 
---
 arch/x86/tools/relocs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 5d73c443e778..fcf3fad01b08 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -37,7 +37,7 @@ static struct section *secs;
 
 static const char * const sym_regex_kernel[S_NSYMTYPES] = {
 /*
- * Following symbols have been audited. There values are constant and do
+ * Following symbols have been audited. Their values are constant and do
  * not change if bzImage is loaded at a different physical address than
  * the address for which it has been compiled. Don't warn user about
  * absolute relocations present w.r.t these symbols.
@@ -690,7 +690,7 @@ static void walk_relocs(int (*process)(struct section *sec, 
Elf_Rel *rel,
  * to the start of the per_cpu area that does not change).
  *
  * Relocations that apply to the per_cpu area need to have their
- * offset adjusted by by the value of __per_cpu_load to make them
+ * offset adjusted by the value of __per_cpu_load to make them
  * point to the correct place in the loaded image (because the
  * virtual address of .data..percpu is 0).
  *
-- 
2.14.3





[PATCH] x86/tools/relocs: comments cleanup

2018-03-04 Thread Cao jin
1. typo fix: there -> their
2. remove superfluous "by"

Signed-off-by: Cao jin 
---
 arch/x86/tools/relocs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
index 5d73c443e778..fcf3fad01b08 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -37,7 +37,7 @@ static struct section *secs;
 
 static const char * const sym_regex_kernel[S_NSYMTYPES] = {
 /*
- * Following symbols have been audited. There values are constant and do
+ * Following symbols have been audited. Their values are constant and do
  * not change if bzImage is loaded at a different physical address than
  * the address for which it has been compiled. Don't warn user about
  * absolute relocations present w.r.t these symbols.
@@ -690,7 +690,7 @@ static void walk_relocs(int (*process)(struct section *sec, 
Elf_Rel *rel,
  * to the start of the per_cpu area that does not change).
  *
  * Relocations that apply to the per_cpu area need to have their
- * offset adjusted by by the value of __per_cpu_load to make them
+ * offset adjusted by the value of __per_cpu_load to make them
  * point to the correct place in the loaded image (because the
  * virtual address of .data..percpu is 0).
  *
-- 
2.14.3





Re: [Outreachy kernel] [PATCH v3] staging: ipx: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Julia Lawall


On Mon, 5 Mar 2018, Arushi Singhal wrote:

> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.
>
> Signed-off-by: Arushi Singhal 
> ---
> changes in v2
> *In v1 printk was changed to pr_*macro(), which is used
> in kernel instead of calling printk() directly. And for drivers,
> dev_*macro() or net_*macro_ratelimited() should be used for calling
> printk() directly.
>
> changes in v3
> *Indentation is not changed, as line is exceeding 80 characters limit.

Put the v3 changes on top of the v2 changes, so that one can see
immediately what has changed most recently.

julia

>
>  drivers/staging/ipx/af_ipx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/ipx/af_ipx.c b/drivers/staging/ipx/af_ipx.c
> index d21a9d1..5ec6591 100644
> --- a/drivers/staging/ipx/af_ipx.c
> +++ b/drivers/staging/ipx/af_ipx.c
> @@ -744,7 +744,7 @@ static void ipxitf_discover_netnum(struct ipx_interface 
> *intrfc,
>   intrfc->if_netnum = cb->ipx_source_net;
>   ipxitf_add_local_route(intrfc);
>   } else {
> - printk(KERN_WARNING "IPX: Network number collision "
> + net_warn_ratelimited("IPX: Network number collision "
>   "%lx\n%s %s and %s %s\n",
>   (unsigned long) ntohl(cb->ipx_source_net),
>   ipx_device_name(i),
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20180305041740.GA23378%40seema-Inspiron-15-3567.
> For more options, visit https://groups.google.com/d/optout.
>


Re: [Outreachy kernel] [PATCH v3] staging: ipx: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Julia Lawall


On Mon, 5 Mar 2018, Arushi Singhal wrote:

> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.
>
> Signed-off-by: Arushi Singhal 
> ---
> changes in v2
> *In v1 printk was changed to pr_*macro(), which is used
> in kernel instead of calling printk() directly. And for drivers,
> dev_*macro() or net_*macro_ratelimited() should be used for calling
> printk() directly.
>
> changes in v3
> *Indentation is not changed, as line is exceeding 80 characters limit.

Put the v3 changes on top of the v2 changes, so that one can see
immediately what has changed most recently.

julia

>
>  drivers/staging/ipx/af_ipx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/ipx/af_ipx.c b/drivers/staging/ipx/af_ipx.c
> index d21a9d1..5ec6591 100644
> --- a/drivers/staging/ipx/af_ipx.c
> +++ b/drivers/staging/ipx/af_ipx.c
> @@ -744,7 +744,7 @@ static void ipxitf_discover_netnum(struct ipx_interface 
> *intrfc,
>   intrfc->if_netnum = cb->ipx_source_net;
>   ipxitf_add_local_route(intrfc);
>   } else {
> - printk(KERN_WARNING "IPX: Network number collision "
> + net_warn_ratelimited("IPX: Network number collision "
>   "%lx\n%s %s and %s %s\n",
>   (unsigned long) ntohl(cb->ipx_source_net),
>   ipx_device_name(i),
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20180305041740.GA23378%40seema-Inspiron-15-3567.
> For more options, visit https://groups.google.com/d/optout.
>


Re: [tip:WIP.sched/core 19/22] kernel/sched/core.c:2836:18: error: passing argument 1 of 'mips_install_watch_registers' from incompatible pointer type

2018-03-04 Thread Ingo Molnar

* Randy Dunlap  wrote:

> >kernel//sched/core.c:2836:2: note: in expansion of macro 'switch_to'
> >  switch_to(prev, next, prev);
> >  ^
> >arch/mips/include/asm/watch.h:15:6: note: expected 'struct task_struct 
> > *' but argument is of type 'struct task_struct *'
> > void mips_install_watch_registers(struct task_struct *t);
> >  ^~~~
> >cc1: some warnings being treated as errors
> 
> I don't have a tip git repo, but it looks like this would fix it (based on 
> most
> recent -next):
> 
> --- linux-next-20180302.orig/arch/mips/include/asm/watch.h
> +++ linux-next-20180302/arch/mips/include/asm/watch.h
> @@ -12,6 +12,8 @@
>  
>  #include 
>  
> +struct task_struct;
> +
>  void mips_install_watch_registers(struct task_struct *t);
>  void mips_read_watch_registers(void);
>  void mips_clear_watch_registers(void);

Yeah, so MIPS wasn't the only arch affected - so I fixed it by restoring the 
original header order.

Thanks,

Ingo


Re: [tip:WIP.sched/core 19/22] kernel/sched/core.c:2836:18: error: passing argument 1 of 'mips_install_watch_registers' from incompatible pointer type

2018-03-04 Thread Ingo Molnar

* Randy Dunlap  wrote:

> >kernel//sched/core.c:2836:2: note: in expansion of macro 'switch_to'
> >  switch_to(prev, next, prev);
> >  ^
> >arch/mips/include/asm/watch.h:15:6: note: expected 'struct task_struct 
> > *' but argument is of type 'struct task_struct *'
> > void mips_install_watch_registers(struct task_struct *t);
> >  ^~~~
> >cc1: some warnings being treated as errors
> 
> I don't have a tip git repo, but it looks like this would fix it (based on 
> most
> recent -next):
> 
> --- linux-next-20180302.orig/arch/mips/include/asm/watch.h
> +++ linux-next-20180302/arch/mips/include/asm/watch.h
> @@ -12,6 +12,8 @@
>  
>  #include 
>  
> +struct task_struct;
> +
>  void mips_install_watch_registers(struct task_struct *t);
>  void mips_read_watch_registers(void);
>  void mips_clear_watch_registers(void);

Yeah, so MIPS wasn't the only arch affected - so I fixed it by restoring the 
original header order.

Thanks,

Ingo


Re: [PATCH] x86/kconfig: Remove residual "no-hlt" boot parameter reference

2018-03-04 Thread Ingo Molnar

* zhenwei.pi  wrote:

> The "no-hlt" boot parameter has been removed ~5 years ago :
>   The commit 27be457000211a6903968dfce06d5f73f051a217
>   ("x86 idle: remove 32-bit-only "no-hlt" parameter, hlt_works_ok flag")
> 
> Remove a stale reference from the documentation as well.
> 
> Signed-off-by: zhenwei.pi 
> ---
>  arch/x86/Kconfig | 21 ++---
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index eb7f43f..bdb17b7 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2494,19 +2494,18 @@ menuconfig APM
>  
> 1) make sure that you have enough swap space and that it is
> enabled.
> -   2) pass the "no-hlt" option to the kernel
> -   3) switch on floating point emulation in the kernel and pass
> +   2) switch on floating point emulation in the kernel and pass
> the "no387" option to the kernel
> -   4) pass the "floppy=nodma" option to the kernel
> -   5) pass the "mem=4M" option to the kernel (thereby disabling
> +   3) pass the "floppy=nodma" option to the kernel
> +   4) pass the "mem=4M" option to the kernel (thereby disabling
> all but the first 4 MB of RAM)
> -   6) make sure that the CPU is not over clocked.
> -   7) read the sig11 FAQ at 
> -   8) disable the cache from your BIOS settings
> -   9) install a fan for the video card or exchange video RAM
> -   10) install a better fan for the CPU
> -   11) exchange RAM chips
> -   12) exchange the motherboard.
> +   5) make sure that the CPU is not over clocked.
> +   6) read the sig11 FAQ at 
> +   7) disable the cache from your BIOS settings
> +   8) install a fan for the video card or exchange video RAM
> +   9) install a better fan for the CPU
> +   10) exchange RAM chips
> +   11) exchange the motherboard.

That description is stale in other ways as well (nobody uses floppies anymore), 
I'd just remove it altogether, starting with this:

If you get
  random kernel OOPSes or reboots that don't seem to be related to
  anything, try disabling/enabling this option (or disabling/enabling
  APM in your BIOS).
  [...]

Thanks,

Ingo


Re: [PATCH] x86/kconfig: Remove residual "no-hlt" boot parameter reference

2018-03-04 Thread Ingo Molnar

* zhenwei.pi  wrote:

> The "no-hlt" boot parameter has been removed ~5 years ago :
>   The commit 27be457000211a6903968dfce06d5f73f051a217
>   ("x86 idle: remove 32-bit-only "no-hlt" parameter, hlt_works_ok flag")
> 
> Remove a stale reference from the documentation as well.
> 
> Signed-off-by: zhenwei.pi 
> ---
>  arch/x86/Kconfig | 21 ++---
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index eb7f43f..bdb17b7 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -2494,19 +2494,18 @@ menuconfig APM
>  
> 1) make sure that you have enough swap space and that it is
> enabled.
> -   2) pass the "no-hlt" option to the kernel
> -   3) switch on floating point emulation in the kernel and pass
> +   2) switch on floating point emulation in the kernel and pass
> the "no387" option to the kernel
> -   4) pass the "floppy=nodma" option to the kernel
> -   5) pass the "mem=4M" option to the kernel (thereby disabling
> +   3) pass the "floppy=nodma" option to the kernel
> +   4) pass the "mem=4M" option to the kernel (thereby disabling
> all but the first 4 MB of RAM)
> -   6) make sure that the CPU is not over clocked.
> -   7) read the sig11 FAQ at 
> -   8) disable the cache from your BIOS settings
> -   9) install a fan for the video card or exchange video RAM
> -   10) install a better fan for the CPU
> -   11) exchange RAM chips
> -   12) exchange the motherboard.
> +   5) make sure that the CPU is not over clocked.
> +   6) read the sig11 FAQ at 
> +   7) disable the cache from your BIOS settings
> +   8) install a fan for the video card or exchange video RAM
> +   9) install a better fan for the CPU
> +   10) exchange RAM chips
> +   11) exchange the motherboard.

That description is stale in other ways as well (nobody uses floppies anymore), 
I'd just remove it altogether, starting with this:

If you get
  random kernel OOPSes or reboots that don't seem to be related to
  anything, try disabling/enabling this option (or disabling/enabling
  APM in your BIOS).
  [...]

Thanks,

Ingo


[PATCH 2/6] staging: pi433: fix CamelCase for flag enum

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/pi433_if.c  |  4 ++--
 drivers/staging/pi433/rf69.c  | 18 +-
 drivers/staging/pi433/rf69_enum.h | 18 +-
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index b1cbec876857..57db806ff5af 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -443,7 +443,7 @@ pi433_receive(void *data)
return retval;
 
/* now check RSSI, if low wait for getting high (RSSI interrupt) */
-   while (!rf69_get_flag(dev->spi, rssiExceededThreshold)) {
+   while (!rf69_get_flag(dev->spi, rssi_exceeded_threshold)) {
/* allow tx to interrupt us while waiting for high RSSI */
dev->interrupt_rx_allowed = true;
wake_up_interruptible(>tx_wait_queue);
@@ -452,7 +452,7 @@ pi433_receive(void *data)
dev_dbg(dev->dev, "rx: going to wait for high RSSI level");
retval = wait_event_interruptible(dev->rx_wait_queue,
  rf69_get_flag(dev->spi,
-   
rssiExceededThreshold));
+   
rssi_exceeded_threshold));
if (retval) /* wait was interrupted */
goto abort;
dev->interrupt_rx_allowed = false;
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 54d8105b5812..fc4919711477 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -545,21 +545,21 @@ int rf69_set_dio_mapping(struct spi_device *spi, u8 
DIONumber, u8 value)
 bool rf69_get_flag(struct spi_device *spi, enum flag flag)
 {
switch (flag) {
-   case modeSwitchCompleted:
+   case mode_switch_completed:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_MODE_READY);
-   case readyToReceive:
+   case ready_to_receive:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_RX_READY);
-   case readyToSend:
+   case ready_to_send:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_TX_READY);
-   case pllLocked:
+   case pll_locked:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_PLL_LOCK);
-   case rssiExceededThreshold:
+   case rssi_exceeded_threshold:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_RSSI);
case timeout:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_TIMEOUT);
case automode:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_AUTOMODE);
-   case syncAddressMatch:
+   case sync_address_match:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_SYNC_ADDRESS_MATCH);
case fifo_full:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_FULL);
@@ -571,13 +571,13 @@ bool rf69_get_flag(struct spi_device *spi, enum flag flag)
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_LEVEL);
case fifo_overrun:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_OVERRUN);
-   case packetSent:
+   case packet_sent:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_PACKET_SENT);
case payload_ready:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_PAYLOAD_READY);
-   case crcOk:
+   case crc_ok:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_CRC_OK);
-   case batteryLow:
+   case battery_low:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_LOW_BAT);
default: return false;
}
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index 682b667bf342..81287ce6be35 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -94,23 +94,23 @@ enum threshold_decrement {
 };
 
 enum flag {
-   modeSwitchCompleted,
-   readyToReceive,
-   readyToSend,
-   pllLocked,
-   rssiExceededThreshold,
+   mode_switch_completed,
+   ready_to_receive,
+   ready_to_send,
+   pll_locked,
+   rssi_exceeded_threshold,
timeout,
automode,
-   syncAddressMatch,
+   sync_address_match,
fifo_full,
 // fifo_not_empty, collision with next enum; replaced by following enum...
   

[PATCH 2/6] staging: pi433: fix CamelCase for flag enum

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/pi433_if.c  |  4 ++--
 drivers/staging/pi433/rf69.c  | 18 +-
 drivers/staging/pi433/rf69_enum.h | 18 +-
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index b1cbec876857..57db806ff5af 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -443,7 +443,7 @@ pi433_receive(void *data)
return retval;
 
/* now check RSSI, if low wait for getting high (RSSI interrupt) */
-   while (!rf69_get_flag(dev->spi, rssiExceededThreshold)) {
+   while (!rf69_get_flag(dev->spi, rssi_exceeded_threshold)) {
/* allow tx to interrupt us while waiting for high RSSI */
dev->interrupt_rx_allowed = true;
wake_up_interruptible(>tx_wait_queue);
@@ -452,7 +452,7 @@ pi433_receive(void *data)
dev_dbg(dev->dev, "rx: going to wait for high RSSI level");
retval = wait_event_interruptible(dev->rx_wait_queue,
  rf69_get_flag(dev->spi,
-   
rssiExceededThreshold));
+   
rssi_exceeded_threshold));
if (retval) /* wait was interrupted */
goto abort;
dev->interrupt_rx_allowed = false;
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 54d8105b5812..fc4919711477 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -545,21 +545,21 @@ int rf69_set_dio_mapping(struct spi_device *spi, u8 
DIONumber, u8 value)
 bool rf69_get_flag(struct spi_device *spi, enum flag flag)
 {
switch (flag) {
-   case modeSwitchCompleted:
+   case mode_switch_completed:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_MODE_READY);
-   case readyToReceive:
+   case ready_to_receive:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_RX_READY);
-   case readyToSend:
+   case ready_to_send:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_TX_READY);
-   case pllLocked:
+   case pll_locked:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_PLL_LOCK);
-   case rssiExceededThreshold:
+   case rssi_exceeded_threshold:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_RSSI);
case timeout:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_TIMEOUT);
case automode:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_AUTOMODE);
-   case syncAddressMatch:
+   case sync_address_match:
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_SYNC_ADDRESS_MATCH);
case fifo_full:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_FULL);
@@ -571,13 +571,13 @@ bool rf69_get_flag(struct spi_device *spi, enum flag flag)
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_LEVEL);
case fifo_overrun:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_OVERRUN);
-   case packetSent:
+   case packet_sent:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_PACKET_SENT);
case payload_ready:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_PAYLOAD_READY);
-   case crcOk:
+   case crc_ok:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_CRC_OK);
-   case batteryLow:
+   case battery_low:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_LOW_BAT);
default: return false;
}
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index 682b667bf342..81287ce6be35 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -94,23 +94,23 @@ enum threshold_decrement {
 };
 
 enum flag {
-   modeSwitchCompleted,
-   readyToReceive,
-   readyToSend,
-   pllLocked,
-   rssiExceededThreshold,
+   mode_switch_completed,
+   ready_to_receive,
+   ready_to_send,
+   pll_locked,
+   rssi_exceeded_threshold,
timeout,
automode,
-   syncAddressMatch,
+   sync_address_match,
fifo_full,
 // fifo_not_empty, collision with next enum; replaced by following enum...
fifo_empty,

[PATCH 1/2] mmc: dt-bindings: add support for MT7622 SoC

2018-03-04 Thread sean.wang
From: Sean Wang 

Add the devicetree binding for MT7622 SoC

Signed-off-by: Sean Wang 
---
 Documentation/devicetree/bindings/mmc/mtk-sd.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.txt 
b/Documentation/devicetree/bindings/mmc/mtk-sd.txt
index 9b80176..f33467a 100644
--- a/Documentation/devicetree/bindings/mmc/mtk-sd.txt
+++ b/Documentation/devicetree/bindings/mmc/mtk-sd.txt
@@ -12,6 +12,7 @@ Required properties:
"mediatek,mt8173-mmc": for mmc host ip compatible with mt8173
"mediatek,mt2701-mmc": for mmc host ip compatible with mt2701
"mediatek,mt2712-mmc": for mmc host ip compatible with mt2712
+   "mediatek,mt7622-mmc": for MT7622 SoC
"mediatek,mt7623-mmc", "mediatek,mt2701-mmc": for MT7623 SoC
 
 - reg: physical base address of the controller and length
-- 
2.7.4



[PATCH 5/6] staging: pi433: fix CamelCase for Address variables

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/rf69.c | 8 
 drivers/staging/pi433/rf69.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index f419a3d4485b..c143ffc7596f 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -704,14 +704,14 @@ int rf69_set_payload_length(struct spi_device *spi, u8 
payload_length)
return rf69_write_reg(spi, REG_PAYLOAD_LENGTH, payload_length);
 }
 
-int rf69_set_node_address(struct spi_device *spi, u8 nodeAddress)
+int rf69_set_node_address(struct spi_device *spi, u8 node_address)
 {
-   return rf69_write_reg(spi, REG_NODEADRS, nodeAddress);
+   return rf69_write_reg(spi, REG_NODEADRS, node_address);
 }
 
-int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcastAddress)
+int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcast_address)
 {
-   return rf69_write_reg(spi, REG_BROADCASTADRS, broadcastAddress);
+   return rf69_write_reg(spi, REG_BROADCASTADRS, broadcast_address);
 }
 
 int rf69_set_tx_start_condition(struct spi_device *spi, enum 
tx_start_condition tx_start_condition)
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index 7b7932a553e8..677091319d7e 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -55,8 +55,8 @@ int rf69_enable_crc(struct spi_device *spi);
 int rf69_disable_crc(struct spi_device *spi);
 int rf69_set_address_filtering(struct spi_device *spi, enum address_filtering 
address_filtering);
 int rf69_set_payload_length(struct spi_device *spi, u8 payload_length);
-int rf69_set_node_address(struct spi_device *spi, u8 nodeAddress);
-int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcastAddress);
+int rf69_set_node_address(struct spi_device *spi, u8 node_address);
+int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcast_address);
 int rf69_set_tx_start_condition(struct spi_device *spi, enum 
tx_start_condition tx_start_condition);
 int rf69_set_fifo_threshold(struct spi_device *spi, u8 threshold);
 int rf69_set_dagc(struct spi_device *spi, enum dagc dagc);
-- 
2.16.1



[PATCH 4/6] staging: pi433: fix CamelCase for address_filtering enum

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/Documentation/pi433.txt | 12 ++--
 drivers/staging/pi433/pi433_if.c  |  6 +++---
 drivers/staging/pi433/rf69.c  |  6 +++---
 drivers/staging/pi433/rf69_enum.h |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/pi433/Documentation/pi433.txt 
b/drivers/staging/pi433/Documentation/pi433.txt
index 3313dff3c37e..2e8835bf2c9a 100644
--- a/drivers/staging/pi433/Documentation/pi433.txt
+++ b/drivers/staging/pi433/Documentation/pi433.txt
@@ -232,12 +232,12 @@ rf params:
 amount of bytes that were requested by the read 
request.
Attention: should be used in combination with sync, only
enable_address_filtering;
-   filteringOff- no address filtering will take place
-   nodeAddress - all telegrams, not matching the node
- address will be internally discarded
-   nodeOrBroadcastAddress  - all telegrams, neither matching the
- node, nor the broadcast address will
- be internally discarded
+   filtering_off - no address filtering will take place
+   node_address  - all telegrams, not matching the node
+   address will be internally discarded
+   node_or_broadcast_address - all telegrams, neither matching the
+   node, nor the broadcast address will
+   be internally discarded
Attention: Sync option must be enabled in order to use this 
feature
enable_crc
optionOn- a crc will be calculated over the payload of
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 730200597218..88da91d31e61 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -257,7 +257,7 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
payload_length = rx_cfg->fixed_message_length;
if (rx_cfg->enable_length_byte  == OPTION_ON)
payload_length++;
-   if (rx_cfg->enable_address_filtering != filteringOff)
+   if (rx_cfg->enable_address_filtering != filtering_off)
payload_length++;
ret = rf69_set_payload_length(dev->spi, payload_length);
if (ret < 0)
@@ -274,7 +274,7 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
if (ret < 0)
return ret;
}
-   if (rx_cfg->enable_address_filtering != filteringOff) {
+   if (rx_cfg->enable_address_filtering != filtering_off) {
ret = rf69_set_node_address(dev->spi, rx_cfg->node_address);
if (ret < 0)
return ret;
@@ -502,7 +502,7 @@ pi433_receive(void *data)
}
 
/* address byte enabled? */
-   if (dev->rx_cfg.enable_address_filtering != filteringOff) {
+   if (dev->rx_cfg.enable_address_filtering != filtering_off) {
u8 dummy;
 
bytes_total--;
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index a73a3d2c0685..f419a3d4485b 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -687,11 +687,11 @@ int rf69_disable_crc(struct spi_device *spi)
 int rf69_set_address_filtering(struct spi_device *spi, enum address_filtering 
address_filtering)
 {
switch (address_filtering) {
-   case filteringOff:
+   case filtering_off:
return rf69_read_mod_write(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_ADDRESSFILTERING, PACKETCONFIG1_ADDRESSFILTERING_OFF);
-   case nodeAddress:
+   case node_address:
return rf69_read_mod_write(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_ADDRESSFILTERING, PACKETCONFIG1_ADDRESSFILTERING_NODE);
-   case nodeOrBroadcastAddress:
+   case node_or_broadcast_address:
return rf69_read_mod_write(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_ADDRESSFILTERING, 
PACKETCONFIG1_ADDRESSFILTERING_NODEBROADCAST);
default:
dev_dbg(>dev, "set: illegal input param");
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index d82d2be88cbd..43990e74db85 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -129,9 +129,9 @@ enum tx_start_condition {
 };
 
 enum address_filtering {
-   filteringOff,
-   nodeAddress,
-   nodeOrBroadcastAddress
+   filtering_off,

[PATCH 1/2] mmc: dt-bindings: add support for MT7622 SoC

2018-03-04 Thread sean.wang
From: Sean Wang 

Add the devicetree binding for MT7622 SoC

Signed-off-by: Sean Wang 
---
 Documentation/devicetree/bindings/mmc/mtk-sd.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mmc/mtk-sd.txt 
b/Documentation/devicetree/bindings/mmc/mtk-sd.txt
index 9b80176..f33467a 100644
--- a/Documentation/devicetree/bindings/mmc/mtk-sd.txt
+++ b/Documentation/devicetree/bindings/mmc/mtk-sd.txt
@@ -12,6 +12,7 @@ Required properties:
"mediatek,mt8173-mmc": for mmc host ip compatible with mt8173
"mediatek,mt2701-mmc": for mmc host ip compatible with mt2701
"mediatek,mt2712-mmc": for mmc host ip compatible with mt2712
+   "mediatek,mt7622-mmc": for MT7622 SoC
"mediatek,mt7623-mmc", "mediatek,mt2701-mmc": for MT7623 SoC
 
 - reg: physical base address of the controller and length
-- 
2.7.4



[PATCH 5/6] staging: pi433: fix CamelCase for Address variables

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/rf69.c | 8 
 drivers/staging/pi433/rf69.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index f419a3d4485b..c143ffc7596f 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -704,14 +704,14 @@ int rf69_set_payload_length(struct spi_device *spi, u8 
payload_length)
return rf69_write_reg(spi, REG_PAYLOAD_LENGTH, payload_length);
 }
 
-int rf69_set_node_address(struct spi_device *spi, u8 nodeAddress)
+int rf69_set_node_address(struct spi_device *spi, u8 node_address)
 {
-   return rf69_write_reg(spi, REG_NODEADRS, nodeAddress);
+   return rf69_write_reg(spi, REG_NODEADRS, node_address);
 }
 
-int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcastAddress)
+int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcast_address)
 {
-   return rf69_write_reg(spi, REG_BROADCASTADRS, broadcastAddress);
+   return rf69_write_reg(spi, REG_BROADCASTADRS, broadcast_address);
 }
 
 int rf69_set_tx_start_condition(struct spi_device *spi, enum 
tx_start_condition tx_start_condition)
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index 7b7932a553e8..677091319d7e 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -55,8 +55,8 @@ int rf69_enable_crc(struct spi_device *spi);
 int rf69_disable_crc(struct spi_device *spi);
 int rf69_set_address_filtering(struct spi_device *spi, enum address_filtering 
address_filtering);
 int rf69_set_payload_length(struct spi_device *spi, u8 payload_length);
-int rf69_set_node_address(struct spi_device *spi, u8 nodeAddress);
-int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcastAddress);
+int rf69_set_node_address(struct spi_device *spi, u8 node_address);
+int rf69_set_broadcast_address(struct spi_device *spi, u8 broadcast_address);
 int rf69_set_tx_start_condition(struct spi_device *spi, enum 
tx_start_condition tx_start_condition);
 int rf69_set_fifo_threshold(struct spi_device *spi, u8 threshold);
 int rf69_set_dagc(struct spi_device *spi, enum dagc dagc);
-- 
2.16.1



[PATCH 4/6] staging: pi433: fix CamelCase for address_filtering enum

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/Documentation/pi433.txt | 12 ++--
 drivers/staging/pi433/pi433_if.c  |  6 +++---
 drivers/staging/pi433/rf69.c  |  6 +++---
 drivers/staging/pi433/rf69_enum.h |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/pi433/Documentation/pi433.txt 
b/drivers/staging/pi433/Documentation/pi433.txt
index 3313dff3c37e..2e8835bf2c9a 100644
--- a/drivers/staging/pi433/Documentation/pi433.txt
+++ b/drivers/staging/pi433/Documentation/pi433.txt
@@ -232,12 +232,12 @@ rf params:
 amount of bytes that were requested by the read 
request.
Attention: should be used in combination with sync, only
enable_address_filtering;
-   filteringOff- no address filtering will take place
-   nodeAddress - all telegrams, not matching the node
- address will be internally discarded
-   nodeOrBroadcastAddress  - all telegrams, neither matching the
- node, nor the broadcast address will
- be internally discarded
+   filtering_off - no address filtering will take place
+   node_address  - all telegrams, not matching the node
+   address will be internally discarded
+   node_or_broadcast_address - all telegrams, neither matching the
+   node, nor the broadcast address will
+   be internally discarded
Attention: Sync option must be enabled in order to use this 
feature
enable_crc
optionOn- a crc will be calculated over the payload of
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 730200597218..88da91d31e61 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -257,7 +257,7 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
payload_length = rx_cfg->fixed_message_length;
if (rx_cfg->enable_length_byte  == OPTION_ON)
payload_length++;
-   if (rx_cfg->enable_address_filtering != filteringOff)
+   if (rx_cfg->enable_address_filtering != filtering_off)
payload_length++;
ret = rf69_set_payload_length(dev->spi, payload_length);
if (ret < 0)
@@ -274,7 +274,7 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
if (ret < 0)
return ret;
}
-   if (rx_cfg->enable_address_filtering != filteringOff) {
+   if (rx_cfg->enable_address_filtering != filtering_off) {
ret = rf69_set_node_address(dev->spi, rx_cfg->node_address);
if (ret < 0)
return ret;
@@ -502,7 +502,7 @@ pi433_receive(void *data)
}
 
/* address byte enabled? */
-   if (dev->rx_cfg.enable_address_filtering != filteringOff) {
+   if (dev->rx_cfg.enable_address_filtering != filtering_off) {
u8 dummy;
 
bytes_total--;
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index a73a3d2c0685..f419a3d4485b 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -687,11 +687,11 @@ int rf69_disable_crc(struct spi_device *spi)
 int rf69_set_address_filtering(struct spi_device *spi, enum address_filtering 
address_filtering)
 {
switch (address_filtering) {
-   case filteringOff:
+   case filtering_off:
return rf69_read_mod_write(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_ADDRESSFILTERING, PACKETCONFIG1_ADDRESSFILTERING_OFF);
-   case nodeAddress:
+   case node_address:
return rf69_read_mod_write(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_ADDRESSFILTERING, PACKETCONFIG1_ADDRESSFILTERING_NODE);
-   case nodeOrBroadcastAddress:
+   case node_or_broadcast_address:
return rf69_read_mod_write(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_ADDRESSFILTERING, 
PACKETCONFIG1_ADDRESSFILTERING_NODEBROADCAST);
default:
dev_dbg(>dev, "set: illegal input param");
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index d82d2be88cbd..43990e74db85 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -129,9 +129,9 @@ enum tx_start_condition {
 };
 
 enum address_filtering {
-   filteringOff,
-   nodeAddress,
-   nodeOrBroadcastAddress
+   filtering_off,
+   node_address,
+

[PATCH 2/2] mmc: mediatek: add support for MT7622 SoC

2018-03-04 Thread sean.wang
From: Sean Wang 

Just applying the existing logic and adding its own characteristics into
the space pointed by an extra entry of struct of_device_id to have support
of MT7622 SoC.

Signed-off-by: Chaotian Jing 
Signed-off-by: Sean Wang 
Tested-by: Jumin Li 
---
 drivers/mmc/host/mtk-sd.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 6457a7d..cb274e8 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -438,11 +438,23 @@ static const struct mtk_mmc_compatible mt2712_compat = {
.enhance_rx = true,
 };
 
+static const struct mtk_mmc_compatible mt7622_compat = {
+   .clk_div_bits = 12,
+   .hs400_tune = false,
+   .pad_tune_reg = MSDC_PAD_TUNE0,
+   .async_fifo = true,
+   .data_tune = true,
+   .busy_check = true,
+   .stop_clk_fix = true,
+   .enhance_rx = true,
+};
+
 static const struct of_device_id msdc_of_ids[] = {
{ .compatible = "mediatek,mt8135-mmc", .data = _compat},
{ .compatible = "mediatek,mt8173-mmc", .data = _compat},
{ .compatible = "mediatek,mt2701-mmc", .data = _compat},
{ .compatible = "mediatek,mt2712-mmc", .data = _compat},
+   { .compatible = "mediatek,mt7622-mmc", .data = _compat},
{}
 };
 MODULE_DEVICE_TABLE(of, msdc_of_ids);
-- 
2.7.4



[PATCH 2/2] mmc: mediatek: add support for MT7622 SoC

2018-03-04 Thread sean.wang
From: Sean Wang 

Just applying the existing logic and adding its own characteristics into
the space pointed by an extra entry of struct of_device_id to have support
of MT7622 SoC.

Signed-off-by: Chaotian Jing 
Signed-off-by: Sean Wang 
Tested-by: Jumin Li 
---
 drivers/mmc/host/mtk-sd.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 6457a7d..cb274e8 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -438,11 +438,23 @@ static const struct mtk_mmc_compatible mt2712_compat = {
.enhance_rx = true,
 };
 
+static const struct mtk_mmc_compatible mt7622_compat = {
+   .clk_div_bits = 12,
+   .hs400_tune = false,
+   .pad_tune_reg = MSDC_PAD_TUNE0,
+   .async_fifo = true,
+   .data_tune = true,
+   .busy_check = true,
+   .stop_clk_fix = true,
+   .enhance_rx = true,
+};
+
 static const struct of_device_id msdc_of_ids[] = {
{ .compatible = "mediatek,mt8135-mmc", .data = _compat},
{ .compatible = "mediatek,mt8173-mmc", .data = _compat},
{ .compatible = "mediatek,mt2701-mmc", .data = _compat},
{ .compatible = "mediatek,mt2712-mmc", .data = _compat},
+   { .compatible = "mediatek,mt7622-mmc", .data = _compat},
{}
 };
 MODULE_DEVICE_TABLE(of, msdc_of_ids);
-- 
2.7.4



Re: linux-next: manual merge of the selinux tree with the net-next tree

2018-03-04 Thread Xin Long
On Mon, Mar 5, 2018 at 9:40 AM, Stephen Rothwell  wrote:
> Hi Paul,
>
> Today's linux-next merge of the selinux tree got a conflict in:
>
>   net/sctp/socket.c
>
> between several refactoring commits from the net-next tree and commit:
>
>   2277c7cd75e3 ("sctp: Add LSM hooks")
>
> from the selinux tree.
>
> I fixed it up (I think - see below) and can carry the fix as
The fixup is great!  the same as I mentioned in:
https://patchwork.ozlabs.org/patch/879898/
for net-next.git

> necessary. This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging.  You may also want to consider
> cooperating with the maintainer of the conflicting tree to minimise any
> particularly complex conflicts.
[net-next,0/9] sctp: clean up sctp_sendmsg, this patchset was just applied
in net-next. So I just guess it might not yet be there when selinux tree was
being submitted.

>
> --
> Cheers,
> Stephen Rothwell
>
> diff --cc net/sctp/socket.c
> index 7fa76031bb08,73b34a6b5b09..
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@@ -1606,193 -1622,362 +1622,209 @@@ static int sctp_error(struct sock *sk,
>   static int sctp_msghdr_parse(const struct msghdr *msg,
>  struct sctp_cmsgs *cmsgs);
>
>  -static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
>  +static int sctp_sendmsg_parse(struct sock *sk, struct sctp_cmsgs *cmsgs,
>  +struct sctp_sndrcvinfo *srinfo,
>  +const struct msghdr *msg, size_t msg_len)
>   {
>  -  struct net *net = sock_net(sk);
>  -  struct sctp_sock *sp;
>  -  struct sctp_endpoint *ep;
>  -  struct sctp_association *new_asoc = NULL, *asoc = NULL;
>  -  struct sctp_transport *transport, *chunk_tp;
>  -  struct sctp_chunk *chunk;
>  -  union sctp_addr to;
>  -  struct sctp_af *af;
>  -  struct sockaddr *msg_name = NULL;
>  -  struct sctp_sndrcvinfo default_sinfo;
>  -  struct sctp_sndrcvinfo *sinfo;
>  -  struct sctp_initmsg *sinit;
>  -  sctp_assoc_t associd = 0;
>  -  struct sctp_cmsgs cmsgs = { NULL };
>  -  enum sctp_scope scope;
>  -  bool fill_sinfo_ttl = false, wait_connect = false;
>  -  struct sctp_datamsg *datamsg;
>  -  int msg_flags = msg->msg_flags;
>  -  __u16 sinfo_flags = 0;
>  -  long timeo;
>  +  __u16 sflags;
> int err;
>
>  -  err = 0;
>  -  sp = sctp_sk(sk);
>  -  ep = sp->ep;
>  -
>  -  pr_debug("%s: sk:%p, msg:%p, msg_len:%zu ep:%p\n", __func__, sk,
>  -   msg, msg_len, ep);
>  +  if (sctp_sstate(sk, LISTENING) && sctp_style(sk, TCP))
>  +  return -EPIPE;
>
>  -  /* We cannot send a message over a TCP-style listening socket. */
>  -  if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) {
>  -  err = -EPIPE;
>  -  goto out_nounlock;
>  -  }
>  +  if (msg_len > sk->sk_sndbuf)
>  +  return -EMSGSIZE;
>
>  -  /* Parse out the SCTP CMSGs.  */
>  -  err = sctp_msghdr_parse(msg, );
>  +  memset(cmsgs, 0, sizeof(*cmsgs));
>  +  err = sctp_msghdr_parse(msg, cmsgs);
> if (err) {
> pr_debug("%s: msghdr parse err:%x\n", __func__, err);
>  -  goto out_nounlock;
>  +  return err;
> }
>
>  -  /* Fetch the destination address for this packet.  This
>  -   * address only selects the association--it is not necessarily
>  -   * the address we will send to.
>  -   * For a peeled-off socket, msg_name is ignored.
>  -   */
>  -  if (!sctp_style(sk, UDP_HIGH_BANDWIDTH) && msg->msg_name) {
>  -  int msg_namelen = msg->msg_namelen;
>  -
>  -  err = sctp_verify_addr(sk, (union sctp_addr *)msg->msg_name,
>  - msg_namelen);
>  -  if (err)
>  -  return err;
>  -
>  -  if (msg_namelen > sizeof(to))
>  -  msg_namelen = sizeof(to);
>  -  memcpy(, msg->msg_name, msg_namelen);
>  -  msg_name = msg->msg_name;
>  +  memset(srinfo, 0, sizeof(*srinfo));
>  +  if (cmsgs->srinfo) {
>  +  srinfo->sinfo_stream = cmsgs->srinfo->sinfo_stream;
>  +  srinfo->sinfo_flags = cmsgs->srinfo->sinfo_flags;
>  +  srinfo->sinfo_ppid = cmsgs->srinfo->sinfo_ppid;
>  +  srinfo->sinfo_context = cmsgs->srinfo->sinfo_context;
>  +  srinfo->sinfo_assoc_id = cmsgs->srinfo->sinfo_assoc_id;
>  +  srinfo->sinfo_timetolive = cmsgs->srinfo->sinfo_timetolive;
> }
>
>  -  sinit = cmsgs.init;
>  -  if (cmsgs.sinfo != NULL) {
>  -  memset(_sinfo, 0, sizeof(default_sinfo));
>  -  default_sinfo.sinfo_stream = cmsgs.sinfo->snd_sid;
>  -  

Re: linux-next: manual merge of the selinux tree with the net-next tree

2018-03-04 Thread Xin Long
On Mon, Mar 5, 2018 at 9:40 AM, Stephen Rothwell  wrote:
> Hi Paul,
>
> Today's linux-next merge of the selinux tree got a conflict in:
>
>   net/sctp/socket.c
>
> between several refactoring commits from the net-next tree and commit:
>
>   2277c7cd75e3 ("sctp: Add LSM hooks")
>
> from the selinux tree.
>
> I fixed it up (I think - see below) and can carry the fix as
The fixup is great!  the same as I mentioned in:
https://patchwork.ozlabs.org/patch/879898/
for net-next.git

> necessary. This is now fixed as far as linux-next is concerned, but any
> non trivial conflicts should be mentioned to your upstream maintainer
> when your tree is submitted for merging.  You may also want to consider
> cooperating with the maintainer of the conflicting tree to minimise any
> particularly complex conflicts.
[net-next,0/9] sctp: clean up sctp_sendmsg, this patchset was just applied
in net-next. So I just guess it might not yet be there when selinux tree was
being submitted.

>
> --
> Cheers,
> Stephen Rothwell
>
> diff --cc net/sctp/socket.c
> index 7fa76031bb08,73b34a6b5b09..
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@@ -1606,193 -1622,362 +1622,209 @@@ static int sctp_error(struct sock *sk,
>   static int sctp_msghdr_parse(const struct msghdr *msg,
>  struct sctp_cmsgs *cmsgs);
>
>  -static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len)
>  +static int sctp_sendmsg_parse(struct sock *sk, struct sctp_cmsgs *cmsgs,
>  +struct sctp_sndrcvinfo *srinfo,
>  +const struct msghdr *msg, size_t msg_len)
>   {
>  -  struct net *net = sock_net(sk);
>  -  struct sctp_sock *sp;
>  -  struct sctp_endpoint *ep;
>  -  struct sctp_association *new_asoc = NULL, *asoc = NULL;
>  -  struct sctp_transport *transport, *chunk_tp;
>  -  struct sctp_chunk *chunk;
>  -  union sctp_addr to;
>  -  struct sctp_af *af;
>  -  struct sockaddr *msg_name = NULL;
>  -  struct sctp_sndrcvinfo default_sinfo;
>  -  struct sctp_sndrcvinfo *sinfo;
>  -  struct sctp_initmsg *sinit;
>  -  sctp_assoc_t associd = 0;
>  -  struct sctp_cmsgs cmsgs = { NULL };
>  -  enum sctp_scope scope;
>  -  bool fill_sinfo_ttl = false, wait_connect = false;
>  -  struct sctp_datamsg *datamsg;
>  -  int msg_flags = msg->msg_flags;
>  -  __u16 sinfo_flags = 0;
>  -  long timeo;
>  +  __u16 sflags;
> int err;
>
>  -  err = 0;
>  -  sp = sctp_sk(sk);
>  -  ep = sp->ep;
>  -
>  -  pr_debug("%s: sk:%p, msg:%p, msg_len:%zu ep:%p\n", __func__, sk,
>  -   msg, msg_len, ep);
>  +  if (sctp_sstate(sk, LISTENING) && sctp_style(sk, TCP))
>  +  return -EPIPE;
>
>  -  /* We cannot send a message over a TCP-style listening socket. */
>  -  if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) {
>  -  err = -EPIPE;
>  -  goto out_nounlock;
>  -  }
>  +  if (msg_len > sk->sk_sndbuf)
>  +  return -EMSGSIZE;
>
>  -  /* Parse out the SCTP CMSGs.  */
>  -  err = sctp_msghdr_parse(msg, );
>  +  memset(cmsgs, 0, sizeof(*cmsgs));
>  +  err = sctp_msghdr_parse(msg, cmsgs);
> if (err) {
> pr_debug("%s: msghdr parse err:%x\n", __func__, err);
>  -  goto out_nounlock;
>  +  return err;
> }
>
>  -  /* Fetch the destination address for this packet.  This
>  -   * address only selects the association--it is not necessarily
>  -   * the address we will send to.
>  -   * For a peeled-off socket, msg_name is ignored.
>  -   */
>  -  if (!sctp_style(sk, UDP_HIGH_BANDWIDTH) && msg->msg_name) {
>  -  int msg_namelen = msg->msg_namelen;
>  -
>  -  err = sctp_verify_addr(sk, (union sctp_addr *)msg->msg_name,
>  - msg_namelen);
>  -  if (err)
>  -  return err;
>  -
>  -  if (msg_namelen > sizeof(to))
>  -  msg_namelen = sizeof(to);
>  -  memcpy(, msg->msg_name, msg_namelen);
>  -  msg_name = msg->msg_name;
>  +  memset(srinfo, 0, sizeof(*srinfo));
>  +  if (cmsgs->srinfo) {
>  +  srinfo->sinfo_stream = cmsgs->srinfo->sinfo_stream;
>  +  srinfo->sinfo_flags = cmsgs->srinfo->sinfo_flags;
>  +  srinfo->sinfo_ppid = cmsgs->srinfo->sinfo_ppid;
>  +  srinfo->sinfo_context = cmsgs->srinfo->sinfo_context;
>  +  srinfo->sinfo_assoc_id = cmsgs->srinfo->sinfo_assoc_id;
>  +  srinfo->sinfo_timetolive = cmsgs->srinfo->sinfo_timetolive;
> }
>
>  -  sinit = cmsgs.init;
>  -  if (cmsgs.sinfo != NULL) {
>  -  memset(_sinfo, 0, sizeof(default_sinfo));
>  -  default_sinfo.sinfo_stream = cmsgs.sinfo->snd_sid;
>  -  default_sinfo.sinfo_flags = 

[PATCH 3/6] staging: pi433: fix CamelCase for afterSyncInterrupt

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warning:

  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/pi433_if.c  | 2 +-
 drivers/staging/pi433/rf69.c  | 2 +-
 drivers/staging/pi433/rf69_enum.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 57db806ff5af..730200597218 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -209,7 +209,7 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
return ret;
 
ret = rf69_set_fifo_fill_condition(dev->spi,
-  afterSyncInterrupt);
+  after_sync_interrupt);
if (ret < 0)
return ret;
} else {
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index fc4919711477..a73a3d2c0685 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -625,7 +625,7 @@ int rf69_set_fifo_fill_condition(struct spi_device *spi, 
enum fifo_fill_conditio
switch (fifo_fill_condition) {
case always:
return rf69_set_bit(spi, REG_SYNC_CONFIG, 
MASK_SYNC_CONFIG_FIFO_FILL_CONDITION);
-   case afterSyncInterrupt:
+   case after_sync_interrupt:
return rf69_clear_bit(spi, REG_SYNC_CONFIG, 
MASK_SYNC_CONFIG_FIFO_FILL_CONDITION);
default:
dev_dbg(>dev, "set: illegal input param");
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index 81287ce6be35..d82d2be88cbd 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -114,7 +114,7 @@ enum flag {
 };
 
 enum fifo_fill_condition {
-   afterSyncInterrupt,
+   after_sync_interrupt,
always
 };
 
-- 
2.16.1



Re: [PATCH AUTOSEL for 4.9 005/219] kretprobes: Ensure probe location is at function entry

2018-03-04 Thread Naveen N. Rao

Hi Sasha,

Sasha Levin wrote:

From: "Naveen N. Rao" 

[ Upstream commit 90ec5e89e393c76e19afc845d8f88a5dc8315919 ]



Sorry if this is obvious, but why was this patch picked up for -stable?  
I don't see the upstream commit tagging -stable, so curious why this was 
done.


I don't think this patch should be pushed to -stable since this is not 
really a bug fix. There are also other dependencies for this change (see 
commit a64e3f35a45f4a, for instance), including how userspace (perf) 
builds out the retprobe argument. As such, please drop this from -stable 
(for 3.18. 4.4 and 4.9).


Thanks,
Naveen




Re: [PATCH AUTOSEL for 4.9 005/219] kretprobes: Ensure probe location is at function entry

2018-03-04 Thread Naveen N. Rao

Hi Sasha,

Sasha Levin wrote:

From: "Naveen N. Rao" 

[ Upstream commit 90ec5e89e393c76e19afc845d8f88a5dc8315919 ]



Sorry if this is obvious, but why was this patch picked up for -stable?  
I don't see the upstream commit tagging -stable, so curious why this was 
done.


I don't think this patch should be pushed to -stable since this is not 
really a bug fix. There are also other dependencies for this change (see 
commit a64e3f35a45f4a, for instance), including how userspace (perf) 
builds out the retprobe argument. As such, please drop this from -stable 
(for 3.18. 4.4 and 4.9).


Thanks,
Naveen




[PATCH 3/6] staging: pi433: fix CamelCase for afterSyncInterrupt

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warning:

  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/pi433_if.c  | 2 +-
 drivers/staging/pi433/rf69.c  | 2 +-
 drivers/staging/pi433/rf69_enum.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 57db806ff5af..730200597218 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -209,7 +209,7 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
return ret;
 
ret = rf69_set_fifo_fill_condition(dev->spi,
-  afterSyncInterrupt);
+  after_sync_interrupt);
if (ret < 0)
return ret;
} else {
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index fc4919711477..a73a3d2c0685 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -625,7 +625,7 @@ int rf69_set_fifo_fill_condition(struct spi_device *spi, 
enum fifo_fill_conditio
switch (fifo_fill_condition) {
case always:
return rf69_set_bit(spi, REG_SYNC_CONFIG, 
MASK_SYNC_CONFIG_FIFO_FILL_CONDITION);
-   case afterSyncInterrupt:
+   case after_sync_interrupt:
return rf69_clear_bit(spi, REG_SYNC_CONFIG, 
MASK_SYNC_CONFIG_FIFO_FILL_CONDITION);
default:
dev_dbg(>dev, "set: illegal input param");
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index 81287ce6be35..d82d2be88cbd 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -114,7 +114,7 @@ enum flag {
 };
 
 enum fifo_fill_condition {
-   afterSyncInterrupt,
+   after_sync_interrupt,
always
 };
 
-- 
2.16.1



[PATCH 1/6 v2] staging: pi433: fix CamelCase for packetFormat enum

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
v2: order patches so they apply correctly

 drivers/staging/pi433/pi433_if.c  | 8 
 drivers/staging/pi433/rf69.c  | 8 
 drivers/staging/pi433/rf69.h  | 2 +-
 drivers/staging/pi433/rf69_enum.h | 6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index aad1debd34a2..b1cbec876857 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -222,11 +222,11 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
return ret;
}
if (rx_cfg->enable_length_byte == OPTION_ON) {
-   ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+   ret = rf69_set_packet_format(dev->spi, packet_length_var);
if (ret < 0)
return ret;
} else {
-   ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+   ret = rf69_set_packet_format(dev->spi, packet_length_fix);
if (ret < 0)
return ret;
}
@@ -337,11 +337,11 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct 
pi433_tx_cfg *tx_cfg)
}
 
if (tx_cfg->enable_length_byte == OPTION_ON) {
-   ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+   ret = rf69_set_packet_format(dev->spi, packet_length_var);
if (ret < 0)
return ret;
} else {
-   ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+   ret = rf69_set_packet_format(dev->spi, packet_length_fix);
if (ret < 0)
return ret;
}
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index b2cea5f52eea..54d8105b5812 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -661,12 +661,12 @@ int rf69_set_sync_values(struct spi_device *spi, u8 
sync_values[8])
return retval;
 }
 
-int rf69_set_packet_format(struct spi_device *spi, enum packetFormat 
packetFormat)
+int rf69_set_packet_format(struct spi_device *spi, enum packet_format 
packet_format)
 {
-   switch (packetFormat) {
-   case packetLengthVar:
+   switch (packet_format) {
+   case packet_length_var:
return rf69_set_bit(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_PAKET_FORMAT_VARIABLE);
-   case packetLengthFix:
+   case packet_length_fix:
return rf69_clear_bit(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_PAKET_FORMAT_VARIABLE);
default:
dev_dbg(>dev, "set: illegal input param");
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index cf89b556cb00..7b7932a553e8 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -50,7 +50,7 @@ int rf69_disable_sync(struct spi_device *spi);
 int rf69_set_fifo_fill_condition(struct spi_device *spi, enum 
fifo_fill_condition fifo_fill_condition);
 int rf69_set_sync_size(struct spi_device *spi, u8 sync_size);
 int rf69_set_sync_values(struct spi_device *spi, u8 sync_values[8]);
-int rf69_set_packet_format(struct spi_device *spi, enum packetFormat 
packetFormat);
+int rf69_set_packet_format(struct spi_device *spi, enum packet_format 
packet_format);
 int rf69_enable_crc(struct spi_device *spi);
 int rf69_disable_crc(struct spi_device *spi);
 int rf69_set_address_filtering(struct spi_device *spi, enum address_filtering 
address_filtering);
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index cba3c5b3995c..682b667bf342 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -118,9 +118,9 @@ enum fifo_fill_condition {
always
 };
 
-enum packetFormat {
-   packetLengthFix,
-   packetLengthVar
+enum packet_format {
+   packet_length_fix,
+   packet_length_var
 };
 
 enum tx_start_condition {
-- 
2.16.1



[PATCH 6/6] staging: pi433: fix CamelCase for paRamp enum

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warning:

  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/Documentation/pi433.txt | 2 +-
 drivers/staging/pi433/pi433_if.h  | 2 +-
 drivers/staging/pi433/rf69.c  | 4 ++--
 drivers/staging/pi433/rf69.h  | 2 +-
 drivers/staging/pi433/rf69_enum.h | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/pi433/Documentation/pi433.txt 
b/drivers/staging/pi433/Documentation/pi433.txt
index 2e8835bf2c9a..79bccc586869 100644
--- a/drivers/staging/pi433/Documentation/pi433.txt
+++ b/drivers/staging/pi433/Documentation/pi433.txt
@@ -92,7 +92,7 @@ rf params:
shaping0_3  - gauss filter with BT 0.3 (FSK only)
shapingBR   - filter cut off at BR (OOK only)
shaping2BR  - filter cut off at 2*BR (OOK only)
-   paRamp (FSK only)
+   pa_ramp (FSK only)
ramp3400- amp ramps up in 3.4ms
ramp2000- amp ramps up in 2.0ms
ramp1000- amp ramps up in 1ms
diff --git a/drivers/staging/pi433/pi433_if.h b/drivers/staging/pi433/pi433_if.h
index b3fa4fe64c5c..be4a96055a97 100644
--- a/drivers/staging/pi433/pi433_if.h
+++ b/drivers/staging/pi433/pi433_if.h
@@ -67,7 +67,7 @@ struct pi433_tx_cfg {
enum modulation modulation;
enum mod_shapingmod_shaping;
 
-   enum paRamp pa_ramp;
+   enum pa_ramppa_ramp;
 
enum tx_start_condition tx_start_condition;
 
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index c143ffc7596f..e5c7e48a3b86 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -345,9 +345,9 @@ int rf69_set_output_power_level(struct spi_device *spi, u8 
power_level)
return rf69_read_mod_write(spi, REG_PALEVEL, MASK_PALEVEL_OUTPUT_POWER, 
power_level);
 }
 
-int rf69_set_pa_ramp(struct spi_device *spi, enum paRamp paRamp)
+int rf69_set_pa_ramp(struct spi_device *spi, enum pa_ramp pa_ramp)
 {
-   switch (paRamp) {
+   switch (pa_ramp) {
case ramp3400:
return rf69_write_reg(spi, REG_PARAMP, PARAMP_3400);
case ramp2000:
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index 677091319d7e..d83808a5dd86 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -35,7 +35,7 @@ int rf69_set_frequency(struct spi_device *spi, u32 frequency);
 int rf69_enable_amplifier(struct spi_device *spi, u8 amplifier_mask);
 int rf69_disable_amplifier(struct spi_device *spi, u8 amplifier_mask);
 int rf69_set_output_power_level(struct spi_device *spi, u8 power_level);
-int rf69_set_pa_ramp(struct spi_device *spi, enum paRamp paRamp);
+int rf69_set_pa_ramp(struct spi_device *spi, enum pa_ramp pa_ramp);
 int rf69_set_antenna_impedance(struct spi_device *spi, enum antenna_impedance 
antenna_impedance);
 int rf69_set_lna_gain(struct spi_device *spi, enum lnaGain lnaGain);
 int rf69_set_bandwidth(struct spi_device *spi, enum mantisse mantisse, u8 
exponent);
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index 43990e74db85..5ac3d33a3d0c 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -41,7 +41,7 @@ enum mod_shaping {
SHAPING_2BR
 };
 
-enum paRamp {
+enum pa_ramp {
ramp3400,
ramp2000,
ramp1000,
-- 
2.16.1



[PATCH 6/6] staging: pi433: fix CamelCase for paRamp enum

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warning:

  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/Documentation/pi433.txt | 2 +-
 drivers/staging/pi433/pi433_if.h  | 2 +-
 drivers/staging/pi433/rf69.c  | 4 ++--
 drivers/staging/pi433/rf69.h  | 2 +-
 drivers/staging/pi433/rf69_enum.h | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/pi433/Documentation/pi433.txt 
b/drivers/staging/pi433/Documentation/pi433.txt
index 2e8835bf2c9a..79bccc586869 100644
--- a/drivers/staging/pi433/Documentation/pi433.txt
+++ b/drivers/staging/pi433/Documentation/pi433.txt
@@ -92,7 +92,7 @@ rf params:
shaping0_3  - gauss filter with BT 0.3 (FSK only)
shapingBR   - filter cut off at BR (OOK only)
shaping2BR  - filter cut off at 2*BR (OOK only)
-   paRamp (FSK only)
+   pa_ramp (FSK only)
ramp3400- amp ramps up in 3.4ms
ramp2000- amp ramps up in 2.0ms
ramp1000- amp ramps up in 1ms
diff --git a/drivers/staging/pi433/pi433_if.h b/drivers/staging/pi433/pi433_if.h
index b3fa4fe64c5c..be4a96055a97 100644
--- a/drivers/staging/pi433/pi433_if.h
+++ b/drivers/staging/pi433/pi433_if.h
@@ -67,7 +67,7 @@ struct pi433_tx_cfg {
enum modulation modulation;
enum mod_shapingmod_shaping;
 
-   enum paRamp pa_ramp;
+   enum pa_ramppa_ramp;
 
enum tx_start_condition tx_start_condition;
 
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index c143ffc7596f..e5c7e48a3b86 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -345,9 +345,9 @@ int rf69_set_output_power_level(struct spi_device *spi, u8 
power_level)
return rf69_read_mod_write(spi, REG_PALEVEL, MASK_PALEVEL_OUTPUT_POWER, 
power_level);
 }
 
-int rf69_set_pa_ramp(struct spi_device *spi, enum paRamp paRamp)
+int rf69_set_pa_ramp(struct spi_device *spi, enum pa_ramp pa_ramp)
 {
-   switch (paRamp) {
+   switch (pa_ramp) {
case ramp3400:
return rf69_write_reg(spi, REG_PARAMP, PARAMP_3400);
case ramp2000:
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index 677091319d7e..d83808a5dd86 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -35,7 +35,7 @@ int rf69_set_frequency(struct spi_device *spi, u32 frequency);
 int rf69_enable_amplifier(struct spi_device *spi, u8 amplifier_mask);
 int rf69_disable_amplifier(struct spi_device *spi, u8 amplifier_mask);
 int rf69_set_output_power_level(struct spi_device *spi, u8 power_level);
-int rf69_set_pa_ramp(struct spi_device *spi, enum paRamp paRamp);
+int rf69_set_pa_ramp(struct spi_device *spi, enum pa_ramp pa_ramp);
 int rf69_set_antenna_impedance(struct spi_device *spi, enum antenna_impedance 
antenna_impedance);
 int rf69_set_lna_gain(struct spi_device *spi, enum lnaGain lnaGain);
 int rf69_set_bandwidth(struct spi_device *spi, enum mantisse mantisse, u8 
exponent);
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index 43990e74db85..5ac3d33a3d0c 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -41,7 +41,7 @@ enum mod_shaping {
SHAPING_2BR
 };
 
-enum paRamp {
+enum pa_ramp {
ramp3400,
ramp2000,
ramp1000,
-- 
2.16.1



[PATCH 1/6 v2] staging: pi433: fix CamelCase for packetFormat enum

2018-03-04 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
v2: order patches so they apply correctly

 drivers/staging/pi433/pi433_if.c  | 8 
 drivers/staging/pi433/rf69.c  | 8 
 drivers/staging/pi433/rf69.h  | 2 +-
 drivers/staging/pi433/rf69_enum.h | 6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index aad1debd34a2..b1cbec876857 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -222,11 +222,11 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct 
pi433_rx_cfg *rx_cfg)
return ret;
}
if (rx_cfg->enable_length_byte == OPTION_ON) {
-   ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+   ret = rf69_set_packet_format(dev->spi, packet_length_var);
if (ret < 0)
return ret;
} else {
-   ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+   ret = rf69_set_packet_format(dev->spi, packet_length_fix);
if (ret < 0)
return ret;
}
@@ -337,11 +337,11 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct 
pi433_tx_cfg *tx_cfg)
}
 
if (tx_cfg->enable_length_byte == OPTION_ON) {
-   ret = rf69_set_packet_format(dev->spi, packetLengthVar);
+   ret = rf69_set_packet_format(dev->spi, packet_length_var);
if (ret < 0)
return ret;
} else {
-   ret = rf69_set_packet_format(dev->spi, packetLengthFix);
+   ret = rf69_set_packet_format(dev->spi, packet_length_fix);
if (ret < 0)
return ret;
}
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index b2cea5f52eea..54d8105b5812 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -661,12 +661,12 @@ int rf69_set_sync_values(struct spi_device *spi, u8 
sync_values[8])
return retval;
 }
 
-int rf69_set_packet_format(struct spi_device *spi, enum packetFormat 
packetFormat)
+int rf69_set_packet_format(struct spi_device *spi, enum packet_format 
packet_format)
 {
-   switch (packetFormat) {
-   case packetLengthVar:
+   switch (packet_format) {
+   case packet_length_var:
return rf69_set_bit(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_PAKET_FORMAT_VARIABLE);
-   case packetLengthFix:
+   case packet_length_fix:
return rf69_clear_bit(spi, REG_PACKETCONFIG1, 
MASK_PACKETCONFIG1_PAKET_FORMAT_VARIABLE);
default:
dev_dbg(>dev, "set: illegal input param");
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index cf89b556cb00..7b7932a553e8 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -50,7 +50,7 @@ int rf69_disable_sync(struct spi_device *spi);
 int rf69_set_fifo_fill_condition(struct spi_device *spi, enum 
fifo_fill_condition fifo_fill_condition);
 int rf69_set_sync_size(struct spi_device *spi, u8 sync_size);
 int rf69_set_sync_values(struct spi_device *spi, u8 sync_values[8]);
-int rf69_set_packet_format(struct spi_device *spi, enum packetFormat 
packetFormat);
+int rf69_set_packet_format(struct spi_device *spi, enum packet_format 
packet_format);
 int rf69_enable_crc(struct spi_device *spi);
 int rf69_disable_crc(struct spi_device *spi);
 int rf69_set_address_filtering(struct spi_device *spi, enum address_filtering 
address_filtering);
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index cba3c5b3995c..682b667bf342 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -118,9 +118,9 @@ enum fifo_fill_condition {
always
 };
 
-enum packetFormat {
-   packetLengthFix,
-   packetLengthVar
+enum packet_format {
+   packet_length_fix,
+   packet_length_var
 };
 
 enum tx_start_condition {
-- 
2.16.1



Re: [PATCH v9 5/5] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach

2018-03-04 Thread JeffyChen

Hi Laurent,

sorry, you're right, this patch should not be needed.

the connector should be cleanup by 
drm_mode_config_cleanup->drm_connector_put.


i did that in analogix_dp is to avoid a use-after-free issue not 
kmemleak, because the connector was allocated/freed in analogix_dp's 
bind/unbind.


but i found a kmemleak issue(dma_mask not freed) in dw-hdmi when testing 
that, will send patch soon.


On 03/03/2018 08:20 AM, JeffyChen wrote:

Hi Laurent,

On 03/03/2018 05:49 AM, Laurent Pinchart wrote:

Hi Enric,

Thank you for the patch.

On Friday, 2 March 2018 19:57:57 EET Enric Balletbo i Serra wrote:

From: Jeffy Chen 

We inited connector in attach(), so need a detach() to cleanup.


Do we ? The dw-hdmi driver already sets drm_connector_cleanup() as the
connector .destroy() handler, and the .destroy() operation is called
by the
DRM core. None of the other bridge drivers call drm_connector_cleanup()
directly.


hmmm, checking the code, there are also lots of drivers do the
cleanup(drm_connector_cleanup or funcs->destroy):
drm# grep -r "connector.*funcs->destroy" .
./rockchip/inno_hdmi.c: hdmi->connector.funcs->destroy(>connector);
./rockchip/cdn-dp-core.c:   connector->funcs->destroy(connector);
./bridge/analogix/analogix_dp_core.c:
dp->connector.funcs->destroy(>connector);
./msm/hdmi/hdmi.c: hdmi->connector->funcs->destroy(hdmi->connector);
./msm/dsi/dsi.c: msm_dsi->connector->funcs->destroy(msm_dsi->connector);
./msm/edp/edp.c: edp->connector->funcs->destroy(edp->connector);
./zte/zx_hdmi.c:hdmi->connector.funcs->destroy(>connector);
./drm_connector.c:  connector->funcs->destroy(connector);
./drm_connector.c:  connector->funcs->destroy(connector);
./nouveau/dispnv04/disp.c: connector->funcs->destroy(connector);
./nouveau/nv50_display.c: mstc->connector.funcs->destroy(>connector);
./nouveau/nv50_display.c: connector->funcs->destroy(connector);



when i debug analogix_dp bind/unbind, i found that we need to cleanup
the connector(reported by kmemleak). so i added it to
./bridge/analogix/analogix_dp_core.c...after that i saw dw-hdmi missing
that too(by checking the code), so make this patch.

but i didn't really tested it on devices using dw-hdmi, so i'm not very
sure the dw-hdmi(maybe also other bridges) is the same with analogix_dp.

i can try to find a chromebook veyron to check it next week :)

but even there's a leak, i'm still not very sure about:
should the caller of drm_connector_init cleanup it
or the caller of drm_bridge_attach should do it(for example
analogix_dp_bind/analogix_dp_unbind)
or should the DRM core take care of that?




Signed-off-by: Jeffy Chen 
Signed-off-by: Thierry Escande 
Signed-off-by: Enric Balletbo i Serra 
---





Re: [PATCH v9 5/5] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach

2018-03-04 Thread JeffyChen

Hi Laurent,

sorry, you're right, this patch should not be needed.

the connector should be cleanup by 
drm_mode_config_cleanup->drm_connector_put.


i did that in analogix_dp is to avoid a use-after-free issue not 
kmemleak, because the connector was allocated/freed in analogix_dp's 
bind/unbind.


but i found a kmemleak issue(dma_mask not freed) in dw-hdmi when testing 
that, will send patch soon.


On 03/03/2018 08:20 AM, JeffyChen wrote:

Hi Laurent,

On 03/03/2018 05:49 AM, Laurent Pinchart wrote:

Hi Enric,

Thank you for the patch.

On Friday, 2 March 2018 19:57:57 EET Enric Balletbo i Serra wrote:

From: Jeffy Chen 

We inited connector in attach(), so need a detach() to cleanup.


Do we ? The dw-hdmi driver already sets drm_connector_cleanup() as the
connector .destroy() handler, and the .destroy() operation is called
by the
DRM core. None of the other bridge drivers call drm_connector_cleanup()
directly.


hmmm, checking the code, there are also lots of drivers do the
cleanup(drm_connector_cleanup or funcs->destroy):
drm# grep -r "connector.*funcs->destroy" .
./rockchip/inno_hdmi.c: hdmi->connector.funcs->destroy(>connector);
./rockchip/cdn-dp-core.c:   connector->funcs->destroy(connector);
./bridge/analogix/analogix_dp_core.c:
dp->connector.funcs->destroy(>connector);
./msm/hdmi/hdmi.c: hdmi->connector->funcs->destroy(hdmi->connector);
./msm/dsi/dsi.c: msm_dsi->connector->funcs->destroy(msm_dsi->connector);
./msm/edp/edp.c: edp->connector->funcs->destroy(edp->connector);
./zte/zx_hdmi.c:hdmi->connector.funcs->destroy(>connector);
./drm_connector.c:  connector->funcs->destroy(connector);
./drm_connector.c:  connector->funcs->destroy(connector);
./nouveau/dispnv04/disp.c: connector->funcs->destroy(connector);
./nouveau/nv50_display.c: mstc->connector.funcs->destroy(>connector);
./nouveau/nv50_display.c: connector->funcs->destroy(connector);



when i debug analogix_dp bind/unbind, i found that we need to cleanup
the connector(reported by kmemleak). so i added it to
./bridge/analogix/analogix_dp_core.c...after that i saw dw-hdmi missing
that too(by checking the code), so make this patch.

but i didn't really tested it on devices using dw-hdmi, so i'm not very
sure the dw-hdmi(maybe also other bridges) is the same with analogix_dp.

i can try to find a chromebook veyron to check it next week :)

but even there's a leak, i'm still not very sure about:
should the caller of drm_connector_init cleanup it
or the caller of drm_bridge_attach should do it(for example
analogix_dp_bind/analogix_dp_unbind)
or should the DRM core take care of that?




Signed-off-by: Jeffy Chen 
Signed-off-by: Thierry Escande 
Signed-off-by: Enric Balletbo i Serra 
---





Re: Would you help to tell why async printk solution was not taken to upstream kernel ?

2018-03-04 Thread Qixuan.Wu
Hi Steve,  

On Sun, 04 Mar 2018 23:43:23 +0800
Steven Rostedt  wrote:

> Yes, people keep bringing up this scenario.
> It would require a single burst of printks to all CPUs. And then no
> more printks after that. The last one will end up printing the entire
> buffer out the slow console. The thing is, this is a bounded time, and
> no printk will print more than one full buffer worth.

> If this is a worry, then set the timeouts for the lockup detection to
> be longer than the time it takes to print one full buffer with the
> slowest console.

Thanks for your information and suggestion. We will think of backport 
the code as per the workload, or recently, maybe we will think of disable 
ttyS0 console just for the printk. 

Thanks & Regards
Qixuan

Re: Would you help to tell why async printk solution was not taken to upstream kernel ?

2018-03-04 Thread Qixuan.Wu
Hi Steve,  

On Sun, 04 Mar 2018 23:43:23 +0800
Steven Rostedt  wrote:

> Yes, people keep bringing up this scenario.
> It would require a single burst of printks to all CPUs. And then no
> more printks after that. The last one will end up printing the entire
> buffer out the slow console. The thing is, this is a bounded time, and
> no printk will print more than one full buffer worth.

> If this is a worry, then set the timeouts for the lockup detection to
> be longer than the time it takes to print one full buffer with the
> slowest console.

Thanks for your information and suggestion. We will think of backport 
the code as per the workload, or recently, maybe we will think of disable 
ttyS0 console just for the printk. 

Thanks & Regards
Qixuan

Re: [PATCH 1/6] reset: qcom: AOSS (Always on subsystem) reset controller

2018-03-04 Thread Sibi S

Hi Philipp,

Thanks for the review. I will post out the v2 of the patch series.

On 03/02/2018 04:00 PM, Philipp Zabel wrote:

Hi sibis,

thank you for the patch. I have a few questions and comments below.

On Fri, 2018-03-02 at 14:53 +0530, sibis wrote:

Add reset controller driver for Qualcomm SDM845 SoC to
control reset signals provided by AOSS for Modem, Venus
ADSP, GPU, Camera, Wireless, Display subsystem

Signed-off-by: sibis 
---
  .../devicetree/bindings/reset/qcom,aoss-reset.txt  |  54 +++
  drivers/reset/Kconfig  |  10 ++
  drivers/reset/Makefile |   1 +
  drivers/reset/reset-qcom-aoss.c| 161 +
  include/dt-bindings/reset/qcom,aoss-sdm845.h   |  17 +++
  5 files changed, 243 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/reset/qcom,aoss-reset.txt
  create mode 100644 drivers/reset/reset-qcom-aoss.c
  create mode 100644 include/dt-bindings/reset/qcom,aoss-sdm845.h

diff --git a/Documentation/devicetree/bindings/reset/qcom,aoss-reset.txt 
b/Documentation/devicetree/bindings/reset/qcom,aoss-reset.txt
new file mode 100644
index 000..5318e14
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/qcom,aoss-reset.txt
@@ -0,0 +1,54 @@
+Qualcomm AOSS Reset Controller
+==
+
+This binding describes a reset-controller found on AOSS (Always on SubSysem)
+for Qualcomm SDM845 SoCs.
+
+Required properties:
+- compatible:
+   Usage: required
+   Value type: 
+   Definition: must be:
+   "qcom,aoss-reset-sdm845", "syscon"
+
+- reg:
+   Usage: required
+   Value type: 
+   Definition: must specify the base address and size of the
+   syscon device.
+
+
+- #reset-cells:
+   Usage: required
+   Value type: 
+   Definition: must be 1; cell entry represents the reset index.
+
+example:
+
+aoss_reset: qcom,reset-controller@b2e0100 {
+   compatible = "qcom,aoss-reset-sdm845", "syscon";
+   reg = <0xc2b 0x20004>;
+   #reset-cells = <1>;
+};
+
+
+Specifying reset lines connected to IP modules
+==
+
+Device nodes that need access to reset lines should
+specify them as a reset phandle in their corresponding node as
+specified in reset.txt.
+
+Example:
+
+   modem-pil@408 {
+   ...
+
+   resets = <_reset AOSS_CC_MSS_RESTART>;
+   reset-names = "mss_restart";
+
+   ...
+};
+
+For list of all valid reset indicies see
+
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index 7fc7769..4b1da86 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -81,6 +81,16 @@ config RESET_PISTACHIO
help
  This enables the reset driver for ImgTec Pistachio SoCs.
  
+config RESET_QCOM_AOSS

+   bool "Qcom AOSS Reset Driver"
+   depends on ARCH_QCOM || COMPILE_TEST


Do all ARCH_QCOM have AOSS? If so, should this be enabled by default?



AOSS reset is currently supported on SDM845 SoCs and not on any of other 
the previously upstreamed Qualcomm SoCs. I will change description to 
convey the same. I needs to explicitly enabled for SDM845 SoCs.



+   select MFD_SYSCON
+   help
+ This enables the AOSS (Always On SubSystem) reset driver
+ for Qcom SoCs. Say Y if you want to control reset signals


Is Qcom and Qualcomm interchangeable?



Though it is used interchangeably, it will make more sense if I
change it to Qualcomm here.


+ provided by AOSS for Modem, Venus, ADSP, GPU, Camera,
+ Wireless, Display subsystem. Otherwise, say N.
+
  config RESET_SIMPLE
bool "Simple Reset Controller Driver" if COMPILE_TEST
default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || 
ARCH_ZX
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 132c24f..c30044a 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o
  obj-$(CONFIG_RESET_MESON) += reset-meson.o
  obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
  obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
+obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o
  obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
  obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
  obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
diff --git a/drivers/reset/reset-qcom-aoss.c b/drivers/reset/reset-qcom-aoss.c
new file mode 100644
index 000..eb8c69b
--- /dev/null
+++ b/drivers/reset/reset-qcom-aoss.c
@@ -0,0 +1,161 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct qcom_aoss_reset_map {
+   unsigned int reg;
+   u8 bit;
+};
+
+struct qcom_aoss_desc {
+   const struct regmap_config *config;
+   const struct 

Re: [PATCH 1/6] reset: qcom: AOSS (Always on subsystem) reset controller

2018-03-04 Thread Sibi S

Hi Philipp,

Thanks for the review. I will post out the v2 of the patch series.

On 03/02/2018 04:00 PM, Philipp Zabel wrote:

Hi sibis,

thank you for the patch. I have a few questions and comments below.

On Fri, 2018-03-02 at 14:53 +0530, sibis wrote:

Add reset controller driver for Qualcomm SDM845 SoC to
control reset signals provided by AOSS for Modem, Venus
ADSP, GPU, Camera, Wireless, Display subsystem

Signed-off-by: sibis 
---
  .../devicetree/bindings/reset/qcom,aoss-reset.txt  |  54 +++
  drivers/reset/Kconfig  |  10 ++
  drivers/reset/Makefile |   1 +
  drivers/reset/reset-qcom-aoss.c| 161 +
  include/dt-bindings/reset/qcom,aoss-sdm845.h   |  17 +++
  5 files changed, 243 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/reset/qcom,aoss-reset.txt
  create mode 100644 drivers/reset/reset-qcom-aoss.c
  create mode 100644 include/dt-bindings/reset/qcom,aoss-sdm845.h

diff --git a/Documentation/devicetree/bindings/reset/qcom,aoss-reset.txt 
b/Documentation/devicetree/bindings/reset/qcom,aoss-reset.txt
new file mode 100644
index 000..5318e14
--- /dev/null
+++ b/Documentation/devicetree/bindings/reset/qcom,aoss-reset.txt
@@ -0,0 +1,54 @@
+Qualcomm AOSS Reset Controller
+==
+
+This binding describes a reset-controller found on AOSS (Always on SubSysem)
+for Qualcomm SDM845 SoCs.
+
+Required properties:
+- compatible:
+   Usage: required
+   Value type: 
+   Definition: must be:
+   "qcom,aoss-reset-sdm845", "syscon"
+
+- reg:
+   Usage: required
+   Value type: 
+   Definition: must specify the base address and size of the
+   syscon device.
+
+
+- #reset-cells:
+   Usage: required
+   Value type: 
+   Definition: must be 1; cell entry represents the reset index.
+
+example:
+
+aoss_reset: qcom,reset-controller@b2e0100 {
+   compatible = "qcom,aoss-reset-sdm845", "syscon";
+   reg = <0xc2b 0x20004>;
+   #reset-cells = <1>;
+};
+
+
+Specifying reset lines connected to IP modules
+==
+
+Device nodes that need access to reset lines should
+specify them as a reset phandle in their corresponding node as
+specified in reset.txt.
+
+Example:
+
+   modem-pil@408 {
+   ...
+
+   resets = <_reset AOSS_CC_MSS_RESTART>;
+   reset-names = "mss_restart";
+
+   ...
+};
+
+For list of all valid reset indicies see
+
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index 7fc7769..4b1da86 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -81,6 +81,16 @@ config RESET_PISTACHIO
help
  This enables the reset driver for ImgTec Pistachio SoCs.
  
+config RESET_QCOM_AOSS

+   bool "Qcom AOSS Reset Driver"
+   depends on ARCH_QCOM || COMPILE_TEST


Do all ARCH_QCOM have AOSS? If so, should this be enabled by default?



AOSS reset is currently supported on SDM845 SoCs and not on any of other 
the previously upstreamed Qualcomm SoCs. I will change description to 
convey the same. I needs to explicitly enabled for SDM845 SoCs.



+   select MFD_SYSCON
+   help
+ This enables the AOSS (Always On SubSystem) reset driver
+ for Qcom SoCs. Say Y if you want to control reset signals


Is Qcom and Qualcomm interchangeable?



Though it is used interchangeably, it will make more sense if I
change it to Qualcomm here.


+ provided by AOSS for Modem, Venus, ADSP, GPU, Camera,
+ Wireless, Display subsystem. Otherwise, say N.
+
  config RESET_SIMPLE
bool "Simple Reset Controller Driver" if COMPILE_TEST
default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || 
ARCH_ZX
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 132c24f..c30044a 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o
  obj-$(CONFIG_RESET_MESON) += reset-meson.o
  obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
  obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
+obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o
  obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
  obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
  obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
diff --git a/drivers/reset/reset-qcom-aoss.c b/drivers/reset/reset-qcom-aoss.c
new file mode 100644
index 000..eb8c69b
--- /dev/null
+++ b/drivers/reset/reset-qcom-aoss.c
@@ -0,0 +1,161 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 The Linux Foundation. All rights reserved.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct qcom_aoss_reset_map {
+   unsigned int reg;
+   u8 bit;
+};
+
+struct qcom_aoss_desc {
+   const struct regmap_config *config;
+   const struct qcom_aoss_reset_map 

RE: [PATCH] scsi: mpt3sas: clarify mmio pointer types

2018-03-04 Thread Sreekanth Reddy
-Original Message-
From: Arnd Bergmann [mailto:a...@arndb.de]
Sent: Thursday, March 1, 2018 6:37 PM
To: Suganath Prabu S; Sathya Prakash; Chaitra P B; James E.J. Bottomley;
Martin K. Petersen
Cc: Arnd Bergmann; Hannes Reinecke; Sreekanth Reddy;
mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: mpt3sas: clarify mmio pointer types

The newly added code mixes up phys_addr_t/resource_size_t with dma_addr_t
and void pointers, as seen from these compiler warning:

drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_get_chain_phys':
drivers/scsi/mpt3sas/mpt3sas_base.c:235:21: error: cast to pointer from
integer of different size [-Werror=int-to-pointer-cast]
  base_chain_phys  = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
 ^
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:427:20: error: cast from pointer to
integer of different size [-Werror=pointer-to-int-cast]
sgel->Address = (dma_addr_t)dst_addr_phys;
^
drivers/scsi/mpt3sas/mpt3sas_base.c:438:7: error: cast from pointer to
integer of different size [-Werror=pointer-to-int-cast]
   (dma_addr_t)buff_ptr_phys;
   ^
drivers/scsi/mpt3sas/mpt3sas_base.c:444:10: error: cast from pointer to
integer of different size [-Werror=pointer-to-int-cast]
  (dma_addr_t)buff_ptr_phys;

Both dma_addr_t and phys_addr_t may be wider than a pointer, so we must
avoid the conversion to pointer types. This also helps readability.

A second problem is treating MMIO addresses from a 'struct resource'
as addresses that can be used for DMA on that device. In almost all cases,
those are the same, but on some of the more obscure architectures, PCI
memory address 0 is mapped into the CPU address space at a nonzero offset.
I don't have a good fix for that, so I'm adding a comment here, plus a
WARN_ON() that triggers whenever the phys_addr_t number is outside of the
low 32-bit address space and causes a straight overflow when assigned to
the 32-bit sgel->Address.

Fixes: 182ac784b41f ("scsi: mpt3sas: Introduce Base function for
cloning.")
Signed-off-by: Arnd Bergmann 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 42
-
 drivers/scsi/mpt3sas/mpt3sas_base.h |  2 +-
 2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 9f2434e59b40..61f93a134956 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -225,14 +225,14 @@ _base_get_chain(struct MPT3SAS_ADAPTER *ioc, u16
smid,
  *
  * @Return - Physical chain address.
  */
-static inline void *
+static inline phys_addr_t
 _base_get_chain_phys(struct MPT3SAS_ADAPTER *ioc, u16 smid,
u8 sge_chain_count)
 {
-   void *base_chain_phys, *chain_phys;
+   phys_addr_t base_chain_phys, chain_phys;
u16 cmd_credit = ioc->facts.RequestCredit + 1;

-   base_chain_phys  = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET
+
+   base_chain_phys  = ioc->chip_phys + MPI_FRAME_START_OFFSET +
(cmd_credit * ioc->request_sz) +
REPLY_FREE_POOL_SIZE;
chain_phys = base_chain_phys + (smid * ioc->facts.MaxChainDepth *
@@ -272,11 +272,11 @@ _base_get_buffer_bar0(struct MPT3SAS_ADAPTER *ioc,
u16 smid)
  *
  * @Returns - Pointer to buffer location in BAR0.
  */
-static void *
+static phys_addr_t
 _base_get_buffer_phys_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)  {
u16 cmd_credit = ioc->facts.RequestCredit + 1;
-   void *chain_end_phys = _base_get_chain_phys(ioc,
+   phys_addr_t chain_end_phys = _base_get_chain_phys(ioc,
cmd_credit + 1,
ioc->facts.MaxChainDepth);
return chain_end_phys + (smid * 64 * 1024); @@ -330,11 +330,12 @@
static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
bool is_write = 0;
u16 i = 0;
void __iomem *buffer_iomem;
-   void  *buffer_iomem_phys;
+   phys_addr_t buffer_iomem_phys;
void __iomem *buff_ptr;
-   void *buff_ptr_phys;
+   phys_addr_t buff_ptr_phys;
void __iomem *dst_chain_addr[MCPU_MAX_CHAINS_PER_IO];
-   void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO], *dst_addr_phys;
+   void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO];
+   phys_addr_t dst_addr_phys;
MPI2RequestHeader_t *request_hdr;
struct scsi_cmnd *scmd;
struct scatterlist *sg_scmd = NULL;
@@ -391,6 +392,7 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER
*ioc,

buff_ptr = buffer_iomem;
buff_ptr_phys = buffer_iomem_phys;
+   WARN_ON(buff_ptr_phys > U32_MAX);

if (sgel->FlagsLength &
(MPI2_SGE_FLAGS_HOST_TO_IOC <<
MPI2_SGE_FLAGS_SHIFT)) @@ -421,10 +423,10 @@ static void
_clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,

RE: [PATCH] scsi: mpt3sas: clarify mmio pointer types

2018-03-04 Thread Sreekanth Reddy
-Original Message-
From: Arnd Bergmann [mailto:a...@arndb.de]
Sent: Thursday, March 1, 2018 6:37 PM
To: Suganath Prabu S; Sathya Prakash; Chaitra P B; James E.J. Bottomley;
Martin K. Petersen
Cc: Arnd Bergmann; Hannes Reinecke; Sreekanth Reddy;
mpt-fusionlinux@broadcom.com; linux-s...@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: mpt3sas: clarify mmio pointer types

The newly added code mixes up phys_addr_t/resource_size_t with dma_addr_t
and void pointers, as seen from these compiler warning:

drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_base_get_chain_phys':
drivers/scsi/mpt3sas/mpt3sas_base.c:235:21: error: cast to pointer from
integer of different size [-Werror=int-to-pointer-cast]
  base_chain_phys  = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET +
 ^
drivers/scsi/mpt3sas/mpt3sas_base.c: In function '_clone_sg_entries':
drivers/scsi/mpt3sas/mpt3sas_base.c:427:20: error: cast from pointer to
integer of different size [-Werror=pointer-to-int-cast]
sgel->Address = (dma_addr_t)dst_addr_phys;
^
drivers/scsi/mpt3sas/mpt3sas_base.c:438:7: error: cast from pointer to
integer of different size [-Werror=pointer-to-int-cast]
   (dma_addr_t)buff_ptr_phys;
   ^
drivers/scsi/mpt3sas/mpt3sas_base.c:444:10: error: cast from pointer to
integer of different size [-Werror=pointer-to-int-cast]
  (dma_addr_t)buff_ptr_phys;

Both dma_addr_t and phys_addr_t may be wider than a pointer, so we must
avoid the conversion to pointer types. This also helps readability.

A second problem is treating MMIO addresses from a 'struct resource'
as addresses that can be used for DMA on that device. In almost all cases,
those are the same, but on some of the more obscure architectures, PCI
memory address 0 is mapped into the CPU address space at a nonzero offset.
I don't have a good fix for that, so I'm adding a comment here, plus a
WARN_ON() that triggers whenever the phys_addr_t number is outside of the
low 32-bit address space and causes a straight overflow when assigned to
the 32-bit sgel->Address.

Fixes: 182ac784b41f ("scsi: mpt3sas: Introduce Base function for
cloning.")
Signed-off-by: Arnd Bergmann 
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 42
-
 drivers/scsi/mpt3sas/mpt3sas_base.h |  2 +-
 2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c
b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 9f2434e59b40..61f93a134956 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -225,14 +225,14 @@ _base_get_chain(struct MPT3SAS_ADAPTER *ioc, u16
smid,
  *
  * @Return - Physical chain address.
  */
-static inline void *
+static inline phys_addr_t
 _base_get_chain_phys(struct MPT3SAS_ADAPTER *ioc, u16 smid,
u8 sge_chain_count)
 {
-   void *base_chain_phys, *chain_phys;
+   phys_addr_t base_chain_phys, chain_phys;
u16 cmd_credit = ioc->facts.RequestCredit + 1;

-   base_chain_phys  = (void *)ioc->chip_phys + MPI_FRAME_START_OFFSET
+
+   base_chain_phys  = ioc->chip_phys + MPI_FRAME_START_OFFSET +
(cmd_credit * ioc->request_sz) +
REPLY_FREE_POOL_SIZE;
chain_phys = base_chain_phys + (smid * ioc->facts.MaxChainDepth *
@@ -272,11 +272,11 @@ _base_get_buffer_bar0(struct MPT3SAS_ADAPTER *ioc,
u16 smid)
  *
  * @Returns - Pointer to buffer location in BAR0.
  */
-static void *
+static phys_addr_t
 _base_get_buffer_phys_bar0(struct MPT3SAS_ADAPTER *ioc, u16 smid)  {
u16 cmd_credit = ioc->facts.RequestCredit + 1;
-   void *chain_end_phys = _base_get_chain_phys(ioc,
+   phys_addr_t chain_end_phys = _base_get_chain_phys(ioc,
cmd_credit + 1,
ioc->facts.MaxChainDepth);
return chain_end_phys + (smid * 64 * 1024); @@ -330,11 +330,12 @@
static void _clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
bool is_write = 0;
u16 i = 0;
void __iomem *buffer_iomem;
-   void  *buffer_iomem_phys;
+   phys_addr_t buffer_iomem_phys;
void __iomem *buff_ptr;
-   void *buff_ptr_phys;
+   phys_addr_t buff_ptr_phys;
void __iomem *dst_chain_addr[MCPU_MAX_CHAINS_PER_IO];
-   void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO], *dst_addr_phys;
+   void *src_chain_addr[MCPU_MAX_CHAINS_PER_IO];
+   phys_addr_t dst_addr_phys;
MPI2RequestHeader_t *request_hdr;
struct scsi_cmnd *scmd;
struct scatterlist *sg_scmd = NULL;
@@ -391,6 +392,7 @@ static void _clone_sg_entries(struct MPT3SAS_ADAPTER
*ioc,

buff_ptr = buffer_iomem;
buff_ptr_phys = buffer_iomem_phys;
+   WARN_ON(buff_ptr_phys > U32_MAX);

if (sgel->FlagsLength &
(MPI2_SGE_FLAGS_HOST_TO_IOC <<
MPI2_SGE_FLAGS_SHIFT)) @@ -421,10 +423,10 @@ static void
_clone_sg_entries(struct MPT3SAS_ADAPTER *ioc,
   

Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Greg KH
On Mon, Mar 05, 2018 at 04:02:06AM +0530, Arushi Singhal wrote:
> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.
> Indentation is also changed, to fix the  checkpatch issue if line is not
> exceding 80 characters.
> 
> Signed-off-by: Arushi Singhal 
> ---
>  .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 
> +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)

Your subject line does not match the file you are changing :(


Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Greg KH
On Mon, Mar 05, 2018 at 04:02:06AM +0530, Arushi Singhal wrote:
> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.
> Indentation is also changed, to fix the  checkpatch issue if line is not
> exceding 80 characters.
> 
> Signed-off-by: Arushi Singhal 
> ---
>  .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 
> +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)

Your subject line does not match the file you are changing :(


[PATCH] ZBOOT: fix stack protector in compressed boot phase

2018-03-04 Thread Huacai Chen
Call __stack_chk_guard_setup() in decompress_kernel() is too late that
stack checking always fails for decompress_kernel() itself. So remove
__stack_chk_guard_setup() and initialize __stack_chk_guard at where we
define it.

Original code comes from ARM but also used for MIPS and SH, so fix them
together. If without this fix, compressed booting of these archs will
fail because stack checking is enabled by default (>=4.16).

Cc: sta...@vger.kernel.org
Signed-off-by: Huacai Chen 
---
 arch/arm/boot/compressed/misc.c| 9 +
 arch/mips/boot/compressed/decompress.c | 9 +
 arch/sh/boot/compressed/misc.c | 9 +
 3 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 16a8a80..43aca75 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -128,12 +128,7 @@ asmlinkage void __div0(void)
error("Attempting division by 0!");
 }
 
-unsigned long __stack_chk_guard;
-
-void __stack_chk_guard_setup(void)
-{
-   __stack_chk_guard = 0x000a0dff;
-}
+unsigned long __stack_chk_guard = 0x000a0dff;
 
 void __stack_chk_fail(void)
 {
@@ -150,8 +145,6 @@ decompress_kernel(unsigned long output_start, unsigned long 
free_mem_ptr_p,
 {
int ret;
 
-   __stack_chk_guard_setup();
-
output_data = (unsigned char *)output_start;
free_mem_ptr= free_mem_ptr_p;
free_mem_end_ptr= free_mem_ptr_end_p;
diff --git a/arch/mips/boot/compressed/decompress.c 
b/arch/mips/boot/compressed/decompress.c
index fdf99e9..0694b3f 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -76,12 +76,7 @@ void error(char *x)
 #include "../../../../lib/decompress_unxz.c"
 #endif
 
-unsigned long __stack_chk_guard;
-
-void __stack_chk_guard_setup(void)
-{
-   __stack_chk_guard = 0x000a0dff;
-}
+unsigned long __stack_chk_guard = 0x000a0dff;
 
 void __stack_chk_fail(void)
 {
@@ -92,8 +87,6 @@ void decompress_kernel(unsigned long boot_heap_start)
 {
unsigned long zimage_start, zimage_size;
 
-   __stack_chk_guard_setup();
-
zimage_start = (unsigned long)(&__image_begin);
zimage_size = (unsigned long)(&__image_end) -
(unsigned long)(&__image_begin);
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c
index 627ce8e..2c564c2 100644
--- a/arch/sh/boot/compressed/misc.c
+++ b/arch/sh/boot/compressed/misc.c
@@ -104,12 +104,7 @@ static void error(char *x)
while(1);   /* Halt */
 }
 
-unsigned long __stack_chk_guard;
-
-void __stack_chk_guard_setup(void)
-{
-   __stack_chk_guard = 0x000a0dff;
-}
+unsigned long __stack_chk_guard = 0x000a0dff;
 
 void __stack_chk_fail(void)
 {
@@ -130,8 +125,6 @@ void decompress_kernel(void)
 {
unsigned long output_addr;
 
-   __stack_chk_guard_setup();
-
 #ifdef CONFIG_SUPERH64
output_addr = (CONFIG_MEMORY_START + 0x2000);
 #else
-- 
2.7.0



[PATCH] ZBOOT: fix stack protector in compressed boot phase

2018-03-04 Thread Huacai Chen
Call __stack_chk_guard_setup() in decompress_kernel() is too late that
stack checking always fails for decompress_kernel() itself. So remove
__stack_chk_guard_setup() and initialize __stack_chk_guard at where we
define it.

Original code comes from ARM but also used for MIPS and SH, so fix them
together. If without this fix, compressed booting of these archs will
fail because stack checking is enabled by default (>=4.16).

Cc: sta...@vger.kernel.org
Signed-off-by: Huacai Chen 
---
 arch/arm/boot/compressed/misc.c| 9 +
 arch/mips/boot/compressed/decompress.c | 9 +
 arch/sh/boot/compressed/misc.c | 9 +
 3 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 16a8a80..43aca75 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -128,12 +128,7 @@ asmlinkage void __div0(void)
error("Attempting division by 0!");
 }
 
-unsigned long __stack_chk_guard;
-
-void __stack_chk_guard_setup(void)
-{
-   __stack_chk_guard = 0x000a0dff;
-}
+unsigned long __stack_chk_guard = 0x000a0dff;
 
 void __stack_chk_fail(void)
 {
@@ -150,8 +145,6 @@ decompress_kernel(unsigned long output_start, unsigned long 
free_mem_ptr_p,
 {
int ret;
 
-   __stack_chk_guard_setup();
-
output_data = (unsigned char *)output_start;
free_mem_ptr= free_mem_ptr_p;
free_mem_end_ptr= free_mem_ptr_end_p;
diff --git a/arch/mips/boot/compressed/decompress.c 
b/arch/mips/boot/compressed/decompress.c
index fdf99e9..0694b3f 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -76,12 +76,7 @@ void error(char *x)
 #include "../../../../lib/decompress_unxz.c"
 #endif
 
-unsigned long __stack_chk_guard;
-
-void __stack_chk_guard_setup(void)
-{
-   __stack_chk_guard = 0x000a0dff;
-}
+unsigned long __stack_chk_guard = 0x000a0dff;
 
 void __stack_chk_fail(void)
 {
@@ -92,8 +87,6 @@ void decompress_kernel(unsigned long boot_heap_start)
 {
unsigned long zimage_start, zimage_size;
 
-   __stack_chk_guard_setup();
-
zimage_start = (unsigned long)(&__image_begin);
zimage_size = (unsigned long)(&__image_end) -
(unsigned long)(&__image_begin);
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c
index 627ce8e..2c564c2 100644
--- a/arch/sh/boot/compressed/misc.c
+++ b/arch/sh/boot/compressed/misc.c
@@ -104,12 +104,7 @@ static void error(char *x)
while(1);   /* Halt */
 }
 
-unsigned long __stack_chk_guard;
-
-void __stack_chk_guard_setup(void)
-{
-   __stack_chk_guard = 0x000a0dff;
-}
+unsigned long __stack_chk_guard = 0x000a0dff;
 
 void __stack_chk_fail(void)
 {
@@ -130,8 +125,6 @@ void decompress_kernel(void)
 {
unsigned long output_addr;
 
-   __stack_chk_guard_setup();
-
 #ifdef CONFIG_SUPERH64
output_addr = (CONFIG_MEMORY_START + 0x2000);
 #else
-- 
2.7.0



Re: [PATCH v2] cpufreq: schedutil: rate limits for SCHED_DEADLINE

2018-03-04 Thread Viresh Kumar
On 28-02-18, 12:22, Rafael J. Wysocki wrote:
> On Wed, Feb 28, 2018 at 12:06 PM, Claudio Scordino
>  wrote:
> > When the SCHED_DEADLINE scheduling class increases the CPU utilization,
> > we should not wait for the rate limit, otherwise we may miss some
> > deadline.
> >
> > Tests using rt-app on Exynos5422 with up to 10 SCHED_DEADLINE tasks have
> > shown reductions of even 10% of deadline misses with a negligible
> > increase of energy consumption (measured through Baylibre Cape).
> >
> > Signed-off-by: Claudio Scordino 
> > CC: Ingo Molnar 
> > CC: Patrick Bellasi 
> > CC: Dietmar Eggemann 
> > CC: Morten Rasmussen 
> > CC: Juri Lelli 
> > CC: Viresh Kumar 
> > CC: Vincent Guittot 
> > CC: Todd Kjos 
> > CC: Joel Fernandes 
> > CC: linux...@vger.kernel.org
> > CC: linux-kernel@vger.kernel.org
> > ---
> > Changes from v1:
> >  - Logic moved from sugov_should_update_freq() to
> >sugov_update_single()/_shared() to not duplicate data structures
> >  - Rate limit not ignored in case of "fast switch"
> 
> I'm not sure about this last bit.
> 
> IMO you can set sg_policy->need_freq_update even in the "fast switch"
> case to start with and special case it in the future if that turns out
> to be problematic.  That is, unless you have data indicating that it
> already is problematic, of course. :-)
> 
> > ---
> >  kernel/sched/cpufreq_schedutil.c | 16 
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/kernel/sched/cpufreq_schedutil.c 
> > b/kernel/sched/cpufreq_schedutil.c
> > index 7936f54..ca6ce72 100644
> > --- a/kernel/sched/cpufreq_schedutil.c
> > +++ b/kernel/sched/cpufreq_schedutil.c
> > @@ -273,6 +273,14 @@ static void sugov_update_single(struct 
> > update_util_data *hook, u64 time,
> > sugov_set_iowait_boost(sg_cpu, time);
> > sg_cpu->last_update = time;
> >
> > +   /*
> > +* Make sugov_should_update_freq() ignore the rate limit when DL
> > +* has increased the utilization.
> > +*/
> > +   if ((cpu_util_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->util_dl) &&
> > +   !(sg_policy->policy->fast_switch_enabled))
> > +   sg_policy->need_freq_update = true;
> > +

And a new routine for this block would be good as well.

-- 
viresh


Re: [PATCH v2] cpufreq: schedutil: rate limits for SCHED_DEADLINE

2018-03-04 Thread Viresh Kumar
On 28-02-18, 12:22, Rafael J. Wysocki wrote:
> On Wed, Feb 28, 2018 at 12:06 PM, Claudio Scordino
>  wrote:
> > When the SCHED_DEADLINE scheduling class increases the CPU utilization,
> > we should not wait for the rate limit, otherwise we may miss some
> > deadline.
> >
> > Tests using rt-app on Exynos5422 with up to 10 SCHED_DEADLINE tasks have
> > shown reductions of even 10% of deadline misses with a negligible
> > increase of energy consumption (measured through Baylibre Cape).
> >
> > Signed-off-by: Claudio Scordino 
> > CC: Ingo Molnar 
> > CC: Patrick Bellasi 
> > CC: Dietmar Eggemann 
> > CC: Morten Rasmussen 
> > CC: Juri Lelli 
> > CC: Viresh Kumar 
> > CC: Vincent Guittot 
> > CC: Todd Kjos 
> > CC: Joel Fernandes 
> > CC: linux...@vger.kernel.org
> > CC: linux-kernel@vger.kernel.org
> > ---
> > Changes from v1:
> >  - Logic moved from sugov_should_update_freq() to
> >sugov_update_single()/_shared() to not duplicate data structures
> >  - Rate limit not ignored in case of "fast switch"
> 
> I'm not sure about this last bit.
> 
> IMO you can set sg_policy->need_freq_update even in the "fast switch"
> case to start with and special case it in the future if that turns out
> to be problematic.  That is, unless you have data indicating that it
> already is problematic, of course. :-)
> 
> > ---
> >  kernel/sched/cpufreq_schedutil.c | 16 
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/kernel/sched/cpufreq_schedutil.c 
> > b/kernel/sched/cpufreq_schedutil.c
> > index 7936f54..ca6ce72 100644
> > --- a/kernel/sched/cpufreq_schedutil.c
> > +++ b/kernel/sched/cpufreq_schedutil.c
> > @@ -273,6 +273,14 @@ static void sugov_update_single(struct 
> > update_util_data *hook, u64 time,
> > sugov_set_iowait_boost(sg_cpu, time);
> > sg_cpu->last_update = time;
> >
> > +   /*
> > +* Make sugov_should_update_freq() ignore the rate limit when DL
> > +* has increased the utilization.
> > +*/
> > +   if ((cpu_util_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->util_dl) &&
> > +   !(sg_policy->policy->fast_switch_enabled))
> > +   sg_policy->need_freq_update = true;
> > +

And a new routine for this block would be good as well.

-- 
viresh


Re: [PATCH 4.4 035/108] dont put symlink bodies in pagecache into highmem

2018-03-04 Thread Greg Kroah-Hartman
On Mon, Mar 05, 2018 at 12:37:59AM +, Ben Hutchings wrote:
> On Thu, 2018-02-15 at 16:16 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> > 
> > --
> > 
> > From: Al Viro 
> > 
> > commit 21fc61c73c3903c4c312d0802da01ec2b323d174 upstream.
> > 
> > kmap() in page_follow_link_light() needed to go - allowing to hold
> > an arbitrary number of kmaps for long is a great way to deadlocking
> > the system.
> > 
> > new helper (inode_nohighmem(inode)) needs to be used for pagecache
> > symlinks inodes; done for all in-tree cases.  page_follow_link_light()
> > instrumented to yell about anything missed.
> 
> Except that this backport only updates ext4 and f2fs (and doesn't add
> the warning).  I suppose that's all matters for Android, but it would
> be nice to get a more complete backport into 4.4-stable...

That should be all the in-tree users of this, for 4.4, right?  If not,
ick.  Jin, can you look into this?

thanks,

greg k-h


Re: [PATCH 4.4 035/108] dont put symlink bodies in pagecache into highmem

2018-03-04 Thread Greg Kroah-Hartman
On Mon, Mar 05, 2018 at 12:37:59AM +, Ben Hutchings wrote:
> On Thu, 2018-02-15 at 16:16 +0100, Greg Kroah-Hartman wrote:
> > 4.4-stable review patch.  If anyone has any objections, please let me know.
> > 
> > --
> > 
> > From: Al Viro 
> > 
> > commit 21fc61c73c3903c4c312d0802da01ec2b323d174 upstream.
> > 
> > kmap() in page_follow_link_light() needed to go - allowing to hold
> > an arbitrary number of kmaps for long is a great way to deadlocking
> > the system.
> > 
> > new helper (inode_nohighmem(inode)) needs to be used for pagecache
> > symlinks inodes; done for all in-tree cases.  page_follow_link_light()
> > instrumented to yell about anything missed.
> 
> Except that this backport only updates ext4 and f2fs (and doesn't add
> the warning).  I suppose that's all matters for Android, but it would
> be nice to get a more complete backport into 4.4-stable...

That should be all the in-tree users of this, for 4.4, right?  If not,
ick.  Jin, can you look into this?

thanks,

greg k-h


Re: [PATCH v3] staging: ipx: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Greg KH
On Mon, Mar 05, 2018 at 09:47:40AM +0530, Arushi Singhal wrote:
> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.
> 
> Signed-off-by: Arushi Singhal 
> ---
> changes in v2
> *In v1 printk was changed to pr_*macro(), which is used
> in kernel instead of calling printk() directly. And for drivers,
> dev_*macro() or net_*macro_ratelimited() should be used for calling
> printk() directly.
> 
> changes in v3
> *Indentation is not changed, as line is exceeding 80 characters limit.
> 
>  drivers/staging/ipx/af_ipx.c | 2 +-

Did you read drivers/staging/ipx/TODO?

Please go do so.

sorry,

greg k-h


Re: [PATCH v3] staging: ipx: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-04 Thread Greg KH
On Mon, Mar 05, 2018 at 09:47:40AM +0530, Arushi Singhal wrote:
> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.
> 
> Signed-off-by: Arushi Singhal 
> ---
> changes in v2
> *In v1 printk was changed to pr_*macro(), which is used
> in kernel instead of calling printk() directly. And for drivers,
> dev_*macro() or net_*macro_ratelimited() should be used for calling
> printk() directly.
> 
> changes in v3
> *Indentation is not changed, as line is exceeding 80 characters limit.
> 
>  drivers/staging/ipx/af_ipx.c | 2 +-

Did you read drivers/staging/ipx/TODO?

Please go do so.

sorry,

greg k-h


[PATCH] staging: bcm2835-audio: Release resources on module_exit()

2018-03-04 Thread Kirill Marinushkin
In the current implementation, `rmmod snd_bcm2835` does not release
resources properly. It causes an oops when trying to list sound devices.

This commit fixes it.

Steps to reproduce:


$ rmmod snd_bcm2835
$ aplay -L
[  138.648130] Unable to handle kernel paging request at virtual address 
7f1343c0
[  138.660415] pgd = ad8f
[  138.665567] [7f1343c0] *pgd=3864c811, *pte=, *ppte=
[  138.674887] Internal error: Oops: 7 [#1] SMP ARM
[  138.683571] Modules linked in: sha256_generic cfg80211 rfkill snd_pcm 
snd_timer
 snd fixed uio_pdrv_genirq uio ip_tables x_tables ipv6 [last unloaded: 
snd_bcm2835
]
[  138.706594] CPU: 3 PID: 463 Comm: aplay Tainted: GWC   
4.15.0-rc1-v
7+ #6
[  138.719833] Hardware name: BCM2835
[  138.726016] task: b877ac00 task.stack: aebec000
[  138.733408] PC is at try_module_get+0x38/0x24c
[  138.740813] LR is at snd_ctl_open+0x58/0x194 [snd]
[  138.748485] pc : [<801c4d5c>]lr : [<7f0e6b2c>]psr: 2013
[  138.757709] sp : aebedd60  ip : aebedd88  fp : aebedd84
[  138.765884] r10:   r9 : 0004  r8 : 7f0ed440
[  138.774040] r7 : b7e469b0  r6 : 7f0e6b2c  r5 : afd91900  r4 : 7f1343c0
[  138.783571] r3 : aebec000  r2 : 0001  r1 : b877ac00  r0 : 7f1343c0
[  138.793084] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  138.803300] Control: 10c5387d  Table: 2d8f006a  DAC: 0055
[  138.812064] Process aplay (pid: 463, stack limit = 0xaebec210)
[  138.820868] Stack: (0xaebedd60 to 0xaebee000)
[  138.828207] dd60:  b848d000 afd91900  b7e469b0 7f0ed440 
aebedda4 aebedd88
[  138.842371] dd80: 7f0e6b2c 801c4d30 afd91900 7f0ea4dc  b7e469b0 
aebeddcc aebedda8
[  138.856611] dda0: 7f0e250c 7f0e6ae0 7f0e2464 b8478ec0 b7e469b0 afd91900 
7f0ea388 
[  138.870864] ddc0: aebeddf4 aebeddd0 802ce590 7f0e2470 8090ab64 afd91900 
afd91900 b7e469b0
[  138.885301] dde0: afd91908 802ce4e4 aebede1c aebeddf8 802c57b4 802ce4f0 
afd91900 aebedea8
[  138.900110] de00: b7fa4c00   0004 aebede3c aebede20 
802c6ba8 802c56b4
[  138.915260] de20: aebedea8  aebedf5c  aebedea4 aebede40 
802d9a68 802c6b58
[  138.930661] de40: b874ddd0   0001 0041  
afd91900 aebede70
[  138.946402] de60:   0002 b7e469b0 b8a87610 b8d6ab80 
801852f8 0008
[  138.962314] de80: aebedf5c aebedea8 0001 80108464 aebec000  
aebedf4c aebedea8
[  138.978414] dea0: 802dacd4 802d970c b8a87610 b8d6ab80 a7982bc6 0009 
af363019 b9231480
[  138.994617] dec0:  b8c038a0 b7e469b0 0101 0002 0238 
 
[  139.010823] dee0:  aebedee8 0008 000f aebedf3c aebedf00 
802ed7e4 80843f94
[  139.027025] df00: 0003 0008 b9231490 b9231480  0008 
af363000 
[  139.043229] df20: 0005 0002 ff9c  0008 ff9c 
af363000 0003
[  139.059430] df40: aebedf94 aebedf50 802c6f70 802dac70 aebec000  
0001 
[  139.075629] df60: 0002 0004 0100 0001 7ebe577c 0002e038 
 0005
[  139.091828] df80: 80108464 aebec000 aebedfa4 aebedf98 802c7060 802c6e6c 
 aebedfa8
[  139.108025] dfa0: 801082c0 802c7040 7ebe577c 0002e038 7ebe577c 0008 
0b98 e81c8400
[  139.124222] dfc0: 7ebe577c 0002e038  0005 7ebe57e4 00a20af8 
7ebe57f0 76f87394
[  139.140419] dfe0:  7ebe55c4 76ec88e8 76df1d9c 6010 7ebe577c 
 
[  139.156715] [<801c4d5c>] (try_module_get) from [<7f0e6b2c>] 
(snd_ctl_open+0x58/0x194 [snd])
[  139.173222] [<7f0e6b2c>] (snd_ctl_open [snd]) from [<7f0e250c>] 
(snd_open+0xa8/0x14c [snd])
[  139.189683] [<7f0e250c>] (snd_open [snd]) from [<802ce590>] 
(chrdev_open+0xac/0x188)
[  139.205465] [<802ce590>] (chrdev_open) from [<802c57b4>] 
(do_dentry_open+0x10c/0x314)
[  139.221347] [<802c57b4>] (do_dentry_open) from [<802c6ba8>] 
(vfs_open+0x5c/0x88)
[  139.236788] [<802c6ba8>] (vfs_open) from [<802d9a68>] 
(path_openat+0x368/0x944)
[  139.248270] [<802d9a68>] (path_openat) from [<802dacd4>] 
(do_filp_open+0x70/0xc4)
[  139.263731] [<802dacd4>] (do_filp_open) from [<802c6f70>] 
(do_sys_open+0x110/0x1d4)
[  139.279378] [<802c6f70>] (do_sys_open) from [<802c7060>] (SyS_open+0x2c/0x30)
[  139.290647] [<802c7060>] (SyS_open) from [<801082c0>] 
(ret_fast_syscall+0x0/0x28)
[  139.306021] Code: e3c3303f e5932004 e2822001 e5832004 (e5943000)
[  139.316265] ---[ end trace 7f3f7f6193b663ed ]---
[  139.324956] note: aplay[463] exited with preempt_count 1


Signed-off-by: Kirill Marinushkin 
Cc: Eric Anholt 
Cc: Stefan Wahren 
Cc: Greg Kroah-Hartman 
Cc: Florian Fainelli 
Cc: Ray Jui 
Cc: Scott Branden 
Cc: bcm-kernel-feedback-l...@broadcom.com
Cc: Michael Zoran 
Cc: linux-rpi-ker...@lists.infradead.org
Cc: 

[PATCH] staging: bcm2835-audio: Release resources on module_exit()

2018-03-04 Thread Kirill Marinushkin
In the current implementation, `rmmod snd_bcm2835` does not release
resources properly. It causes an oops when trying to list sound devices.

This commit fixes it.

Steps to reproduce:


$ rmmod snd_bcm2835
$ aplay -L
[  138.648130] Unable to handle kernel paging request at virtual address 
7f1343c0
[  138.660415] pgd = ad8f
[  138.665567] [7f1343c0] *pgd=3864c811, *pte=, *ppte=
[  138.674887] Internal error: Oops: 7 [#1] SMP ARM
[  138.683571] Modules linked in: sha256_generic cfg80211 rfkill snd_pcm 
snd_timer
 snd fixed uio_pdrv_genirq uio ip_tables x_tables ipv6 [last unloaded: 
snd_bcm2835
]
[  138.706594] CPU: 3 PID: 463 Comm: aplay Tainted: GWC   
4.15.0-rc1-v
7+ #6
[  138.719833] Hardware name: BCM2835
[  138.726016] task: b877ac00 task.stack: aebec000
[  138.733408] PC is at try_module_get+0x38/0x24c
[  138.740813] LR is at snd_ctl_open+0x58/0x194 [snd]
[  138.748485] pc : [<801c4d5c>]lr : [<7f0e6b2c>]psr: 2013
[  138.757709] sp : aebedd60  ip : aebedd88  fp : aebedd84
[  138.765884] r10:   r9 : 0004  r8 : 7f0ed440
[  138.774040] r7 : b7e469b0  r6 : 7f0e6b2c  r5 : afd91900  r4 : 7f1343c0
[  138.783571] r3 : aebec000  r2 : 0001  r1 : b877ac00  r0 : 7f1343c0
[  138.793084] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  138.803300] Control: 10c5387d  Table: 2d8f006a  DAC: 0055
[  138.812064] Process aplay (pid: 463, stack limit = 0xaebec210)
[  138.820868] Stack: (0xaebedd60 to 0xaebee000)
[  138.828207] dd60:  b848d000 afd91900  b7e469b0 7f0ed440 
aebedda4 aebedd88
[  138.842371] dd80: 7f0e6b2c 801c4d30 afd91900 7f0ea4dc  b7e469b0 
aebeddcc aebedda8
[  138.856611] dda0: 7f0e250c 7f0e6ae0 7f0e2464 b8478ec0 b7e469b0 afd91900 
7f0ea388 
[  138.870864] ddc0: aebeddf4 aebeddd0 802ce590 7f0e2470 8090ab64 afd91900 
afd91900 b7e469b0
[  138.885301] dde0: afd91908 802ce4e4 aebede1c aebeddf8 802c57b4 802ce4f0 
afd91900 aebedea8
[  138.900110] de00: b7fa4c00   0004 aebede3c aebede20 
802c6ba8 802c56b4
[  138.915260] de20: aebedea8  aebedf5c  aebedea4 aebede40 
802d9a68 802c6b58
[  138.930661] de40: b874ddd0   0001 0041  
afd91900 aebede70
[  138.946402] de60:   0002 b7e469b0 b8a87610 b8d6ab80 
801852f8 0008
[  138.962314] de80: aebedf5c aebedea8 0001 80108464 aebec000  
aebedf4c aebedea8
[  138.978414] dea0: 802dacd4 802d970c b8a87610 b8d6ab80 a7982bc6 0009 
af363019 b9231480
[  138.994617] dec0:  b8c038a0 b7e469b0 0101 0002 0238 
 
[  139.010823] dee0:  aebedee8 0008 000f aebedf3c aebedf00 
802ed7e4 80843f94
[  139.027025] df00: 0003 0008 b9231490 b9231480  0008 
af363000 
[  139.043229] df20: 0005 0002 ff9c  0008 ff9c 
af363000 0003
[  139.059430] df40: aebedf94 aebedf50 802c6f70 802dac70 aebec000  
0001 
[  139.075629] df60: 0002 0004 0100 0001 7ebe577c 0002e038 
 0005
[  139.091828] df80: 80108464 aebec000 aebedfa4 aebedf98 802c7060 802c6e6c 
 aebedfa8
[  139.108025] dfa0: 801082c0 802c7040 7ebe577c 0002e038 7ebe577c 0008 
0b98 e81c8400
[  139.124222] dfc0: 7ebe577c 0002e038  0005 7ebe57e4 00a20af8 
7ebe57f0 76f87394
[  139.140419] dfe0:  7ebe55c4 76ec88e8 76df1d9c 6010 7ebe577c 
 
[  139.156715] [<801c4d5c>] (try_module_get) from [<7f0e6b2c>] 
(snd_ctl_open+0x58/0x194 [snd])
[  139.173222] [<7f0e6b2c>] (snd_ctl_open [snd]) from [<7f0e250c>] 
(snd_open+0xa8/0x14c [snd])
[  139.189683] [<7f0e250c>] (snd_open [snd]) from [<802ce590>] 
(chrdev_open+0xac/0x188)
[  139.205465] [<802ce590>] (chrdev_open) from [<802c57b4>] 
(do_dentry_open+0x10c/0x314)
[  139.221347] [<802c57b4>] (do_dentry_open) from [<802c6ba8>] 
(vfs_open+0x5c/0x88)
[  139.236788] [<802c6ba8>] (vfs_open) from [<802d9a68>] 
(path_openat+0x368/0x944)
[  139.248270] [<802d9a68>] (path_openat) from [<802dacd4>] 
(do_filp_open+0x70/0xc4)
[  139.263731] [<802dacd4>] (do_filp_open) from [<802c6f70>] 
(do_sys_open+0x110/0x1d4)
[  139.279378] [<802c6f70>] (do_sys_open) from [<802c7060>] (SyS_open+0x2c/0x30)
[  139.290647] [<802c7060>] (SyS_open) from [<801082c0>] 
(ret_fast_syscall+0x0/0x28)
[  139.306021] Code: e3c3303f e5932004 e2822001 e5832004 (e5943000)
[  139.316265] ---[ end trace 7f3f7f6193b663ed ]---
[  139.324956] note: aplay[463] exited with preempt_count 1


Signed-off-by: Kirill Marinushkin 
Cc: Eric Anholt 
Cc: Stefan Wahren 
Cc: Greg Kroah-Hartman 
Cc: Florian Fainelli 
Cc: Ray Jui 
Cc: Scott Branden 
Cc: bcm-kernel-feedback-l...@broadcom.com
Cc: Michael Zoran 
Cc: linux-rpi-ker...@lists.infradead.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: de...@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
---
 .../staging/vc04_services/bcm2835-audio/bcm2835.c  | 37 +++---
 1 file 

  1   2   3   4   5   6   7   >