[PATCH v5 2/3] thermal: tegra: fix memory allocation

2018-12-02 Thread Wei Ni
Fix memory allocation to store the pointers to
thermal_zone_device.

Signed-off-by: Wei Ni 
Acked-by: Thierry Reding 
---
 drivers/thermal/tegra/soctherm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index f07de8258e93..fd2703c0cfc5 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -1339,7 +1339,7 @@ static int tegra_soctherm_probe(struct platform_device 
*pdev)
}
 
tegra->thermctl_tzs = devm_kcalloc(>dev,
-  soc->num_ttgs, sizeof(*z),
+  soc->num_ttgs, sizeof(z),
   GFP_KERNEL);
if (!tegra->thermctl_tzs)
return -ENOMEM;
-- 
2.7.4



[PATCH v5 0/3] Fixes for Tegra soctherm

2018-12-02 Thread Wei Ni
This series fixed some issues for Tegra soctherm

Main changes from v4:
1. fixed for the parsing sensor id.
2. keep warning for missing critical trips.

Main changes from v3:
1. updated codes for parsing sensor id, per Thierry's comments

Main changes from v2:
1. add codes to parse sensor id to avoid registration
failure.

Main changes from v1:
1. Acked by Thierry Reding  for the patch
"thermal: tegra: fix memory allocation".
2. Print out the sensor name when register failed.
2. Remove patch "thermal: tegra: fix coverity defect"

Wei Ni (3):
  thermal: tegra: remove unnecessary warnings
  thermal: tegra: fix memory allocation
  thermal: tegra: parse sensor id before sensor register

 drivers/thermal/tegra/soctherm.c | 51 
 1 file changed, 46 insertions(+), 5 deletions(-)

-- 
2.7.4



Re: [PATCH v4 7/7] zram: writeback throttle

2018-12-02 Thread Sergey Senozhatsky
On (12/03/18 11:40), Minchan Kim wrote:
[..]
> + down_read(>init_lock);
> + atomic64_set(>stats.bd_wb_limit, val);
> + if (val == 0)
> + zram->stop_writeback = false;
> + up_read(>init_lock);

[..]

> + if (zram->stop_writeback) {
> + ret = -EIO;
> + break;
> + }
> +
>   if (!blk_idx) {
>   blk_idx = alloc_block_bdev(zram);
>   if (!blk_idx) {
> @@ -694,6 +732,11 @@ static ssize_t writeback_store(struct device *dev,
>   zram_set_element(zram, index, blk_idx);
>   blk_idx = 0;
>   atomic64_inc(>stats.pages_stored);
> + if (atomic64_add_unless(>stats.bd_wb_limit,
> + -1 << (PAGE_SHIFT - 12), 0)) {
> + if (atomic64_read(>stats.bd_wb_limit) == 0)
> + zram->stop_writeback = true;
> + }

Do we need ->stop_writeback? It should be identical to

atomic64_read(>stats.bd_wb_limit) == 0


Otherwise, looks good!

-ss


Re: [PATCH v4 7/7] zram: writeback throttle

2018-12-02 Thread Sergey Senozhatsky
On (12/03/18 11:40), Minchan Kim wrote:
[..]
> + down_read(>init_lock);
> + atomic64_set(>stats.bd_wb_limit, val);
> + if (val == 0)
> + zram->stop_writeback = false;
> + up_read(>init_lock);

[..]

> + if (zram->stop_writeback) {
> + ret = -EIO;
> + break;
> + }
> +
>   if (!blk_idx) {
>   blk_idx = alloc_block_bdev(zram);
>   if (!blk_idx) {
> @@ -694,6 +732,11 @@ static ssize_t writeback_store(struct device *dev,
>   zram_set_element(zram, index, blk_idx);
>   blk_idx = 0;
>   atomic64_inc(>stats.pages_stored);
> + if (atomic64_add_unless(>stats.bd_wb_limit,
> + -1 << (PAGE_SHIFT - 12), 0)) {
> + if (atomic64_read(>stats.bd_wb_limit) == 0)
> + zram->stop_writeback = true;
> + }

Do we need ->stop_writeback? It should be identical to

atomic64_read(>stats.bd_wb_limit) == 0


Otherwise, looks good!

-ss


RE: [PATCH] scsi: qla4xxx: NULL check before some freeing functions is not needed.

2018-12-02 Thread Rangankar, Manish

> -Original Message-
> From: Thomas Meyer 
> Sent: Monday, December 3, 2018 2:22 AM
> To: Dept-Eng QLogic Storage Upstream  upstr...@cavium.com>; j...@linux.vnet.ibm.com;
> martin.peter...@oracle.com; linux-s...@vger.kernel.org; linux-
> ker...@vger.kernel.org
> Subject: [PATCH] scsi: qla4xxx: NULL check before some freeing functions is 
> not
> needed.
> 
> External Email
> 
> NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Thomas Meyer 
> ---
> 
> diff -u -p a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
> --- a/drivers/scsi/qla4xxx/ql4_os.c
> +++ b/drivers/scsi/qla4xxx/ql4_os.c
> @@ -4160,20 +4160,17 @@ static void qla4xxx_mem_free(struct scsi
> ha->fw_dump_size = 0;
> 
> /* Free srb pool. */
> -   if (ha->srb_mempool)
> -   mempool_destroy(ha->srb_mempool);
> +   mempool_destroy(ha->srb_mempool);
> 
> ha->srb_mempool = NULL;
> 
> -   if (ha->chap_dma_pool)
> -   dma_pool_destroy(ha->chap_dma_pool);
> +   dma_pool_destroy(ha->chap_dma_pool);
> 
> if (ha->chap_list)
> vfree(ha->chap_list);
> ha->chap_list = NULL;
> 
> -   if (ha->fw_ddb_dma_pool)
> -   dma_pool_destroy(ha->fw_ddb_dma_pool);
> +   dma_pool_destroy(ha->fw_ddb_dma_pool);
> 
> /* release io space registers  */
> if (is_qla8022(ha)) {

Thanks
Acked-by: Manish Rangankar 


RE: [PATCH] scsi: qla4xxx: NULL check before some freeing functions is not needed.

2018-12-02 Thread Rangankar, Manish

> -Original Message-
> From: Thomas Meyer 
> Sent: Monday, December 3, 2018 2:22 AM
> To: Dept-Eng QLogic Storage Upstream  upstr...@cavium.com>; j...@linux.vnet.ibm.com;
> martin.peter...@oracle.com; linux-s...@vger.kernel.org; linux-
> ker...@vger.kernel.org
> Subject: [PATCH] scsi: qla4xxx: NULL check before some freeing functions is 
> not
> needed.
> 
> External Email
> 
> NULL check before some freeing functions is not needed.
> 
> Signed-off-by: Thomas Meyer 
> ---
> 
> diff -u -p a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
> --- a/drivers/scsi/qla4xxx/ql4_os.c
> +++ b/drivers/scsi/qla4xxx/ql4_os.c
> @@ -4160,20 +4160,17 @@ static void qla4xxx_mem_free(struct scsi
> ha->fw_dump_size = 0;
> 
> /* Free srb pool. */
> -   if (ha->srb_mempool)
> -   mempool_destroy(ha->srb_mempool);
> +   mempool_destroy(ha->srb_mempool);
> 
> ha->srb_mempool = NULL;
> 
> -   if (ha->chap_dma_pool)
> -   dma_pool_destroy(ha->chap_dma_pool);
> +   dma_pool_destroy(ha->chap_dma_pool);
> 
> if (ha->chap_list)
> vfree(ha->chap_list);
> ha->chap_list = NULL;
> 
> -   if (ha->fw_ddb_dma_pool)
> -   dma_pool_destroy(ha->fw_ddb_dma_pool);
> +   dma_pool_destroy(ha->fw_ddb_dma_pool);
> 
> /* release io space registers  */
> if (is_qla8022(ha)) {

Thanks
Acked-by: Manish Rangankar 


[GIT] Sparc

2018-12-02 Thread David Miller


1) Some implicit switch fallthrough fixes from Stephen Rothwell.

2) Missing of_node_put() in various sparc drivers from
   Yangtao Li.

Please pull, thanks!

The following changes since commit 25e19c1fe421280a47f37c3571aa379e6e67966c:

  Merge tag 'libnvdimm-fixes-4.20-rc3' of 
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm (2018-11-18 
12:21:09 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git 

for you to fetch changes up to dac097c4546e4c5b16dd303a1e97c1d319c8ab3e:

  drivers/tty: add missing of_node_put() (2018-12-02 20:55:23 -0800)


Sabyasachi Gupta (1):
  arch/sparc: Use kzalloc_node

Stephen Rothwell (3):
  sparc: suppress the implicit-fallthrough warning
  sparc32: suppress an implicit-fallthrough warning
  sparc32: supress another implicit-fallthrough warning

Yangtao Li (3):
  sbus: char: add of_node_put()
  drivers/sbus/char: add of_node_put()
  drivers/tty: add missing of_node_put()

 arch/sparc/kernel/iommu.c   | 3 +--
 arch/sparc/kernel/signal32.c| 1 +
 arch/sparc/kernel/signal_32.c   | 1 +
 arch/sparc/kernel/signal_64.c   | 1 +
 drivers/sbus/char/display7seg.c | 1 +
 drivers/sbus/char/envctrl.c | 2 ++
 drivers/tty/serial/suncore.c| 1 +
 7 files changed, 8 insertions(+), 2 deletions(-)


[GIT] Sparc

2018-12-02 Thread David Miller


1) Some implicit switch fallthrough fixes from Stephen Rothwell.

2) Missing of_node_put() in various sparc drivers from
   Yangtao Li.

Please pull, thanks!

The following changes since commit 25e19c1fe421280a47f37c3571aa379e6e67966c:

  Merge tag 'libnvdimm-fixes-4.20-rc3' of 
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm (2018-11-18 
12:21:09 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git 

for you to fetch changes up to dac097c4546e4c5b16dd303a1e97c1d319c8ab3e:

  drivers/tty: add missing of_node_put() (2018-12-02 20:55:23 -0800)


Sabyasachi Gupta (1):
  arch/sparc: Use kzalloc_node

Stephen Rothwell (3):
  sparc: suppress the implicit-fallthrough warning
  sparc32: suppress an implicit-fallthrough warning
  sparc32: supress another implicit-fallthrough warning

Yangtao Li (3):
  sbus: char: add of_node_put()
  drivers/sbus/char: add of_node_put()
  drivers/tty: add missing of_node_put()

 arch/sparc/kernel/iommu.c   | 3 +--
 arch/sparc/kernel/signal32.c| 1 +
 arch/sparc/kernel/signal_32.c   | 1 +
 arch/sparc/kernel/signal_64.c   | 1 +
 drivers/sbus/char/display7seg.c | 1 +
 drivers/sbus/char/envctrl.c | 2 ++
 drivers/tty/serial/suncore.c| 1 +
 7 files changed, 8 insertions(+), 2 deletions(-)


[PATCH -tip] kernel/sched,wake_q: Branch predict wake_q_add() cmpxchg

2018-12-02 Thread Davidlohr Bueso

The cmpxchg will fail when the task is already in the process
of waking up, and as such is an extremely rare occurrence.
Micro-optimize the call and put an unlikely() around it.

To no surprise, when using CONFIG_PROFILE_ANNOTATED_BRANCHES
under a number of workloads the incorrect rate was a mere 1-2%.

Signed-off-by: Davidlohr Bueso 
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 091e089063be..f7747cf6e427 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -408,7 +408,7 @@ void wake_q_add(struct wake_q_head *head, struct 
task_struct *task)
 * This cmpxchg() executes a full barrier, which pairs with the full
 * barrier executed by the wakeup in wake_up_q().
 */
-   if (cmpxchg(>next, NULL, WAKE_Q_TAIL))
+   if (unlikely(cmpxchg(>next, NULL, WAKE_Q_TAIL)))
return;

get_task_struct(task);
--
2.16.4



[PATCH -tip] kernel/sched,wake_q: Branch predict wake_q_add() cmpxchg

2018-12-02 Thread Davidlohr Bueso

The cmpxchg will fail when the task is already in the process
of waking up, and as such is an extremely rare occurrence.
Micro-optimize the call and put an unlikely() around it.

To no surprise, when using CONFIG_PROFILE_ANNOTATED_BRANCHES
under a number of workloads the incorrect rate was a mere 1-2%.

Signed-off-by: Davidlohr Bueso 
---
kernel/sched/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 091e089063be..f7747cf6e427 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -408,7 +408,7 @@ void wake_q_add(struct wake_q_head *head, struct 
task_struct *task)
 * This cmpxchg() executes a full barrier, which pairs with the full
 * barrier executed by the wakeup in wake_up_q().
 */
-   if (cmpxchg(>next, NULL, WAKE_Q_TAIL))
+   if (unlikely(cmpxchg(>next, NULL, WAKE_Q_TAIL)))
return;

get_task_struct(task);
--
2.16.4



Re: [PATCH v9 3/4] seccomp: add a return code to trap to userspace

2018-12-02 Thread Serge E. Hallyn
On Sun, Dec 02, 2018 at 08:28:26PM -0700, Tycho Andersen wrote:
> This patch introduces a means for syscalls matched in seccomp to notify
> some other task that a particular filter has been triggered.
> 
> The motivation for this is primarily for use with containers. For example,
> if a container does an init_module(), we obviously don't want to load this
> untrusted code, which may be compiled for the wrong version of the kernel
> anyway. Instead, we could parse the module image, figure out which module
> the container is trying to load and load it on the host.
> 
> As another example, containers cannot mount() in general since various
> filesystems assume a trusted image. However, if an orchestrator knows that
> e.g. a particular block device has not been exposed to a container for
> writing, it want to allow the container to mount that block device (that
> is, handle the mount for it).
> 
> This patch adds functionality that is already possible via at least two
> other means that I know about, both of which involve ptrace(): first, one
> could ptrace attach, and then iterate through syscalls via PTRACE_SYSCALL.
> Unfortunately this is slow, so a faster version would be to install a
> filter that does SECCOMP_RET_TRACE, which triggers a PTRACE_EVENT_SECCOMP.
> Since ptrace allows only one tracer, if the container runtime is that
> tracer, users inside the container (or outside) trying to debug it will not
> be able to use ptrace, which is annoying. It also means that older
> distributions based on Upstart cannot boot inside containers using ptrace,
> since upstart itself uses ptrace to monitor services while starting.
> 
> The actual implementation of this is fairly small, although getting the
> synchronization right was/is slightly complex.
> 
> Finally, it's worth noting that the classic seccomp TOCTOU of reading
> memory data from the task still applies here, but can be avoided with
> careful design of the userspace handler: if the userspace handler reads all
> of the task memory that is necessary before applying its security policy,
> the tracee's subsequent memory edits will not be read by the tracer.
> 
> Signed-off-by: Tycho Andersen 
> CC: Kees Cook 
> CC: Andy Lutomirski 
> CC: Oleg Nesterov 
> CC: Eric W. Biederman 
> CC: "Serge E. Hallyn" 

Acked-by: Serge Hallyn 

a few questions below, though, which I'm sure are just me reading too
late at night,

> CC: Christian Brauner 
> CC: Tyler Hicks 
> CC: Akihiro Suda 
> ---
> v2: * make id a u64; the idea here being that it will never overflow,
>   because 64 is huge (one syscall every nanosecond => wrap every 584
>   years) (Andy)
> * prevent nesting of user notifications: if someone is already attached
>   the tree in one place, nobody else can attach to the tree (Andy)
> * notify the listener of signals the tracee receives as well (Andy)
> * implement poll
> v3: * lockdep fix (Oleg)
> * drop unnecessary WARN()s (Christian)
> * rearrange error returns to be more rpetty (Christian)
> * fix build in !CONFIG_SECCOMP_USER_NOTIFICATION case
> v4: * fix implementation of poll to use poll_wait() (Jann)
> * change listener's fd flags to be 0 (Jann)
> * hoist filter initialization out of ifdefs to its own function
>   init_user_notification()
> * add some more testing around poll() and closing the listener while a
>   syscall is in action
> * s/GET_LISTENER/NEW_LISTENER, since you can't _get_ a listener, but it
>   creates a new one (Matthew)
> * correctly handle pid namespaces, add some testcases (Matthew)
> * use EINPROGRESS instead of EINVAL when a notification response is
>   written twice (Matthew)
> * fix comment typo from older version (SEND vs READ) (Matthew)
> * whitespace and logic simplification (Tobin)
> * add some Documentation/ bits on userspace trapping
> v5: * fix documentation typos (Jann)
> * add signalled field to struct seccomp_notif (Jann)
> * switch to using ioctls instead of read()/write() for struct passing
>   (Jann)
> * add an ioctl to ensure an id is still valid
> v6: * docs typo fixes, update docs for ioctl() change (Christian)
> v7: * switch struct seccomp_knotif's id member to a u64 (derp :)
> * use notify_lock in IS_ID_VALID query to avoid racing
> * s/signalled/signaled (Tyler)
> * fix docs to reflect that ids are not globally unique (Tyler)
> * add a test to check -ERESTARTSYS behavior (Tyler)
> * drop CONFIG_SECCOMP_USER_NOTIFICATION (Tyler)
> * reorder USER_NOTIF in seccomp return codes list (Tyler)
> * return size instead of sizeof(struct user_notif) (Tyler)
> * ENOENT instead of EINVAL when invalid id is passed (Tyler)
> * drop CONFIG_SECCOMP_USER_NOTIFICATION guards (Tyler)
> * s/IS_ID_VALID/ID_VALID and switch ioctl to be "well behaved" (Tyler)
> * add a new struct notification to minimize the additions to
>   struct seccomp_filter, also pack the necessary additions a 

Re: [PATCH v9 3/4] seccomp: add a return code to trap to userspace

2018-12-02 Thread Serge E. Hallyn
On Sun, Dec 02, 2018 at 08:28:26PM -0700, Tycho Andersen wrote:
> This patch introduces a means for syscalls matched in seccomp to notify
> some other task that a particular filter has been triggered.
> 
> The motivation for this is primarily for use with containers. For example,
> if a container does an init_module(), we obviously don't want to load this
> untrusted code, which may be compiled for the wrong version of the kernel
> anyway. Instead, we could parse the module image, figure out which module
> the container is trying to load and load it on the host.
> 
> As another example, containers cannot mount() in general since various
> filesystems assume a trusted image. However, if an orchestrator knows that
> e.g. a particular block device has not been exposed to a container for
> writing, it want to allow the container to mount that block device (that
> is, handle the mount for it).
> 
> This patch adds functionality that is already possible via at least two
> other means that I know about, both of which involve ptrace(): first, one
> could ptrace attach, and then iterate through syscalls via PTRACE_SYSCALL.
> Unfortunately this is slow, so a faster version would be to install a
> filter that does SECCOMP_RET_TRACE, which triggers a PTRACE_EVENT_SECCOMP.
> Since ptrace allows only one tracer, if the container runtime is that
> tracer, users inside the container (or outside) trying to debug it will not
> be able to use ptrace, which is annoying. It also means that older
> distributions based on Upstart cannot boot inside containers using ptrace,
> since upstart itself uses ptrace to monitor services while starting.
> 
> The actual implementation of this is fairly small, although getting the
> synchronization right was/is slightly complex.
> 
> Finally, it's worth noting that the classic seccomp TOCTOU of reading
> memory data from the task still applies here, but can be avoided with
> careful design of the userspace handler: if the userspace handler reads all
> of the task memory that is necessary before applying its security policy,
> the tracee's subsequent memory edits will not be read by the tracer.
> 
> Signed-off-by: Tycho Andersen 
> CC: Kees Cook 
> CC: Andy Lutomirski 
> CC: Oleg Nesterov 
> CC: Eric W. Biederman 
> CC: "Serge E. Hallyn" 

Acked-by: Serge Hallyn 

a few questions below, though, which I'm sure are just me reading too
late at night,

> CC: Christian Brauner 
> CC: Tyler Hicks 
> CC: Akihiro Suda 
> ---
> v2: * make id a u64; the idea here being that it will never overflow,
>   because 64 is huge (one syscall every nanosecond => wrap every 584
>   years) (Andy)
> * prevent nesting of user notifications: if someone is already attached
>   the tree in one place, nobody else can attach to the tree (Andy)
> * notify the listener of signals the tracee receives as well (Andy)
> * implement poll
> v3: * lockdep fix (Oleg)
> * drop unnecessary WARN()s (Christian)
> * rearrange error returns to be more rpetty (Christian)
> * fix build in !CONFIG_SECCOMP_USER_NOTIFICATION case
> v4: * fix implementation of poll to use poll_wait() (Jann)
> * change listener's fd flags to be 0 (Jann)
> * hoist filter initialization out of ifdefs to its own function
>   init_user_notification()
> * add some more testing around poll() and closing the listener while a
>   syscall is in action
> * s/GET_LISTENER/NEW_LISTENER, since you can't _get_ a listener, but it
>   creates a new one (Matthew)
> * correctly handle pid namespaces, add some testcases (Matthew)
> * use EINPROGRESS instead of EINVAL when a notification response is
>   written twice (Matthew)
> * fix comment typo from older version (SEND vs READ) (Matthew)
> * whitespace and logic simplification (Tobin)
> * add some Documentation/ bits on userspace trapping
> v5: * fix documentation typos (Jann)
> * add signalled field to struct seccomp_notif (Jann)
> * switch to using ioctls instead of read()/write() for struct passing
>   (Jann)
> * add an ioctl to ensure an id is still valid
> v6: * docs typo fixes, update docs for ioctl() change (Christian)
> v7: * switch struct seccomp_knotif's id member to a u64 (derp :)
> * use notify_lock in IS_ID_VALID query to avoid racing
> * s/signalled/signaled (Tyler)
> * fix docs to reflect that ids are not globally unique (Tyler)
> * add a test to check -ERESTARTSYS behavior (Tyler)
> * drop CONFIG_SECCOMP_USER_NOTIFICATION (Tyler)
> * reorder USER_NOTIF in seccomp return codes list (Tyler)
> * return size instead of sizeof(struct user_notif) (Tyler)
> * ENOENT instead of EINVAL when invalid id is passed (Tyler)
> * drop CONFIG_SECCOMP_USER_NOTIFICATION guards (Tyler)
> * s/IS_ID_VALID/ID_VALID and switch ioctl to be "well behaved" (Tyler)
> * add a new struct notification to minimize the additions to
>   struct seccomp_filter, also pack the necessary additions a 

[PATCH RESEND V2 3/4] ARM: dts: imx6ul: Add flexcan stop mode wakeup support

2018-12-02 Thread Joakim Zhang
From: Aisheng Dong 

Add stop-mode property which is required by stop mode wakeup
feature.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
 arch/arm/boot/dts/imx6ul.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi
index 99c366303d73..e14f46ec4d7e 100644
--- a/arch/arm/boot/dts/imx6ul.dtsi
+++ b/arch/arm/boot/dts/imx6ul.dtsi
@@ -406,6 +406,7 @@
clocks = < IMX6UL_CLK_CAN1_IPG>,
 < IMX6UL_CLK_CAN1_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 1 0x10 17>;
status = "disabled";
};
 
@@ -416,6 +417,7 @@
clocks = < IMX6UL_CLK_CAN2_IPG>,
 < IMX6UL_CLK_CAN2_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 2 0x10 18>;
status = "disabled";
};
 
-- 
2.17.1



[PATCH RESEND V2 4/4] ARM: dts: imx7s: Add flexcan stop mode wakeup support

2018-12-02 Thread Joakim Zhang
From: Aisheng Dong 

Add stop-mode property which is required by stop mode wakeup
feature.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
 arch/arm/boot/dts/imx7s.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 477901c2061c..11ea993c48cc 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -873,6 +873,7 @@
clocks = < IMX7D_CLK_DUMMY>,
< IMX7D_CAN1_ROOT_CLK>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 1 0x10 17>;
status = "disabled";
};
 
@@ -883,6 +884,7 @@
clocks = < IMX7D_CLK_DUMMY>,
< IMX7D_CAN2_ROOT_CLK>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 2 0x10 18>;
status = "disabled";
};
 
-- 
2.17.1



[PATCH RESEND V2 2/4] ARM: dts: imx6qdl: Add flexcan stop mode wakeup support

2018-12-02 Thread Joakim Zhang
From: Aisheng Dong 

Add stop-mode property which is required by stop mode wakeup
feature.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
 arch/arm/boot/dts/imx6qdl.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 6d827b69ead0..7fb8be1c9cef 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -561,6 +561,7 @@
clocks = < IMX6QDL_CLK_CAN1_IPG>,
 < IMX6QDL_CLK_CAN1_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x34 28 0x10 17>;
status = "disabled";
};
 
@@ -571,6 +572,7 @@
clocks = < IMX6QDL_CLK_CAN2_IPG>,
 < IMX6QDL_CLK_CAN2_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x34 29 0x10 18>;
status = "disabled";
};
 
-- 
2.17.1



[PATCH RESEND V2 3/4] ARM: dts: imx6ul: Add flexcan stop mode wakeup support

2018-12-02 Thread Joakim Zhang
From: Aisheng Dong 

Add stop-mode property which is required by stop mode wakeup
feature.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
 arch/arm/boot/dts/imx6ul.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi
index 99c366303d73..e14f46ec4d7e 100644
--- a/arch/arm/boot/dts/imx6ul.dtsi
+++ b/arch/arm/boot/dts/imx6ul.dtsi
@@ -406,6 +406,7 @@
clocks = < IMX6UL_CLK_CAN1_IPG>,
 < IMX6UL_CLK_CAN1_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 1 0x10 17>;
status = "disabled";
};
 
@@ -416,6 +417,7 @@
clocks = < IMX6UL_CLK_CAN2_IPG>,
 < IMX6UL_CLK_CAN2_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 2 0x10 18>;
status = "disabled";
};
 
-- 
2.17.1



[PATCH RESEND V2 4/4] ARM: dts: imx7s: Add flexcan stop mode wakeup support

2018-12-02 Thread Joakim Zhang
From: Aisheng Dong 

Add stop-mode property which is required by stop mode wakeup
feature.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
 arch/arm/boot/dts/imx7s.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index 477901c2061c..11ea993c48cc 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -873,6 +873,7 @@
clocks = < IMX7D_CLK_DUMMY>,
< IMX7D_CAN1_ROOT_CLK>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 1 0x10 17>;
status = "disabled";
};
 
@@ -883,6 +884,7 @@
clocks = < IMX7D_CLK_DUMMY>,
< IMX7D_CAN2_ROOT_CLK>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 2 0x10 18>;
status = "disabled";
};
 
-- 
2.17.1



[PATCH RESEND V2 2/4] ARM: dts: imx6qdl: Add flexcan stop mode wakeup support

2018-12-02 Thread Joakim Zhang
From: Aisheng Dong 

Add stop-mode property which is required by stop mode wakeup
feature.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
 arch/arm/boot/dts/imx6qdl.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 6d827b69ead0..7fb8be1c9cef 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -561,6 +561,7 @@
clocks = < IMX6QDL_CLK_CAN1_IPG>,
 < IMX6QDL_CLK_CAN1_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x34 28 0x10 17>;
status = "disabled";
};
 
@@ -571,6 +572,7 @@
clocks = < IMX6QDL_CLK_CAN2_IPG>,
 < IMX6QDL_CLK_CAN2_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x34 29 0x10 18>;
status = "disabled";
};
 
-- 
2.17.1



[PATCH RESEND V2 1/4] ARM: dts: imx6sx: Add flexcan stop mode wakeup support

2018-12-02 Thread Joakim Zhang
From: Aisheng Dong 

Add stop-mode property which is required by stop mode wakeup
feature.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
 arch/arm/boot/dts/imx6sx.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 6c8d2bb09025..272ff6133ec1 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -451,6 +451,7 @@
clocks = < IMX6SX_CLK_CAN1_IPG>,
 < IMX6SX_CLK_CAN1_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 1 0x10 17>;
status = "disabled";
};
 
@@ -461,6 +462,7 @@
clocks = < IMX6SX_CLK_CAN2_IPG>,
 < IMX6SX_CLK_CAN2_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 2 0x10 18>;
status = "disabled";
};
 
-- 
2.17.1



[PATCH RESEND V2 0/4] ARM: dts: imx: Add flexcan stop mode wake

2018-12-02 Thread Joakim Zhang
This patchset intends to add flexcan stop mode wakeup support on IMX6/7 
platforms.

ChangeLog:
V1->V2:
*update stop mode property(stop-mode -> fsl,stop-mode).

Hi Shawn,
   This property has been merged both flexcan bindings doc and kernel
   driver.

Best Regards,
Joakim Zhang

Aisheng Dong (4):
  ARM: dts: imx6sx: Add flexcan stop mode wakeup support
  ARM: dts: imx6qdl: Add flexcan stop mode wakeup support
  ARM: dts: imx6ul: Add flexcan stop mode wakeup support
  ARM: dts: imx7s: Add flexcan stop mode wakeup support

 arch/arm/boot/dts/imx6qdl.dtsi | 2 ++
 arch/arm/boot/dts/imx6sx.dtsi  | 2 ++
 arch/arm/boot/dts/imx6ul.dtsi  | 2 ++
 arch/arm/boot/dts/imx7s.dtsi   | 2 ++
 4 files changed, 8 insertions(+)

-- 
2.17.1



[PATCH RESEND V2 1/4] ARM: dts: imx6sx: Add flexcan stop mode wakeup support

2018-12-02 Thread Joakim Zhang
From: Aisheng Dong 

Add stop-mode property which is required by stop mode wakeup
feature.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
 arch/arm/boot/dts/imx6sx.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi
index 6c8d2bb09025..272ff6133ec1 100644
--- a/arch/arm/boot/dts/imx6sx.dtsi
+++ b/arch/arm/boot/dts/imx6sx.dtsi
@@ -451,6 +451,7 @@
clocks = < IMX6SX_CLK_CAN1_IPG>,
 < IMX6SX_CLK_CAN1_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 1 0x10 17>;
status = "disabled";
};
 
@@ -461,6 +462,7 @@
clocks = < IMX6SX_CLK_CAN2_IPG>,
 < IMX6SX_CLK_CAN2_SERIAL>;
clock-names = "ipg", "per";
+   fsl,stop-mode = < 0x10 2 0x10 18>;
status = "disabled";
};
 
-- 
2.17.1



[PATCH RESEND V2 0/4] ARM: dts: imx: Add flexcan stop mode wake

2018-12-02 Thread Joakim Zhang
This patchset intends to add flexcan stop mode wakeup support on IMX6/7 
platforms.

ChangeLog:
V1->V2:
*update stop mode property(stop-mode -> fsl,stop-mode).

Hi Shawn,
   This property has been merged both flexcan bindings doc and kernel
   driver.

Best Regards,
Joakim Zhang

Aisheng Dong (4):
  ARM: dts: imx6sx: Add flexcan stop mode wakeup support
  ARM: dts: imx6qdl: Add flexcan stop mode wakeup support
  ARM: dts: imx6ul: Add flexcan stop mode wakeup support
  ARM: dts: imx7s: Add flexcan stop mode wakeup support

 arch/arm/boot/dts/imx6qdl.dtsi | 2 ++
 arch/arm/boot/dts/imx6sx.dtsi  | 2 ++
 arch/arm/boot/dts/imx6ul.dtsi  | 2 ++
 arch/arm/boot/dts/imx7s.dtsi   | 2 ++
 4 files changed, 8 insertions(+)

-- 
2.17.1



Re: [PATCH v9 2/4] seccomp: switch system call argument type to void *

2018-12-02 Thread Serge E. Hallyn
On Sun, Dec 02, 2018 at 08:28:25PM -0700, Tycho Andersen wrote:
> The const qualifier causes problems for any code that wants to write to the
> third argument of the seccomp syscall, as we will do in a future patch in
> this series.
> 
> The third argument to the seccomp syscall is documented as void *, so
> rather than just dropping the const, let's switch everything to use void *
> as well.
> 
> I believe this is safe because of 1. the documentation above, 2. there's no
> real type information exported about syscalls anywhere besides the man
> pages.
> 
> Signed-off-by: Tycho Andersen 
> CC: Kees Cook 
> CC: Andy Lutomirski 
> CC: Oleg Nesterov 
> CC: Eric W. Biederman 
> CC: "Serge E. Hallyn" 

Acked-by: Serge Hallyn 

Though I'm not entirely convinced there will be no ill effects of changing
the argument type.  I'll feel comfortable when Michael and Paul say it's
fine :)

> CC: Christian Brauner 
> CC: Tyler Hicks 
> CC: Akihiro Suda 
> ---
>  include/linux/seccomp.h | 2 +-
>  kernel/seccomp.c| 8 
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
> index e5320f6c8654..b5103c019cf4 100644
> --- a/include/linux/seccomp.h
> +++ b/include/linux/seccomp.h
> @@ -43,7 +43,7 @@ extern void secure_computing_strict(int this_syscall);
>  #endif
>  
>  extern long prctl_get_seccomp(void);
> -extern long prctl_set_seccomp(unsigned long, char __user *);
> +extern long prctl_set_seccomp(unsigned long, void __user *);
>  
>  static inline int seccomp_mode(struct seccomp *s)
>  {
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 96afc32e041d..393e029f778a 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -924,7 +924,7 @@ static long seccomp_get_action_avail(const char __user 
> *uaction)
>  
>  /* Common entry point for both prctl and syscall. */
>  static long do_seccomp(unsigned int op, unsigned int flags,
> -const char __user *uargs)
> +void __user *uargs)
>  {
>   switch (op) {
>   case SECCOMP_SET_MODE_STRICT:
> @@ -944,7 +944,7 @@ static long do_seccomp(unsigned int op, unsigned int 
> flags,
>  }
>  
>  SYSCALL_DEFINE3(seccomp, unsigned int, op, unsigned int, flags,
> -  const char __user *, uargs)
> +  void __user *, uargs)
>  {
>   return do_seccomp(op, flags, uargs);
>  }
> @@ -956,10 +956,10 @@ SYSCALL_DEFINE3(seccomp, unsigned int, op, unsigned 
> int, flags,
>   *
>   * Returns 0 on success or -EINVAL on failure.
>   */
> -long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter)
> +long prctl_set_seccomp(unsigned long seccomp_mode, void __user *filter)
>  {
>   unsigned int op;
> - char __user *uargs;
> + void __user *uargs;
>  
>   switch (seccomp_mode) {
>   case SECCOMP_MODE_STRICT:
> -- 
> 2.19.1


Re: [PATCH v9 2/4] seccomp: switch system call argument type to void *

2018-12-02 Thread Serge E. Hallyn
On Sun, Dec 02, 2018 at 08:28:25PM -0700, Tycho Andersen wrote:
> The const qualifier causes problems for any code that wants to write to the
> third argument of the seccomp syscall, as we will do in a future patch in
> this series.
> 
> The third argument to the seccomp syscall is documented as void *, so
> rather than just dropping the const, let's switch everything to use void *
> as well.
> 
> I believe this is safe because of 1. the documentation above, 2. there's no
> real type information exported about syscalls anywhere besides the man
> pages.
> 
> Signed-off-by: Tycho Andersen 
> CC: Kees Cook 
> CC: Andy Lutomirski 
> CC: Oleg Nesterov 
> CC: Eric W. Biederman 
> CC: "Serge E. Hallyn" 

Acked-by: Serge Hallyn 

Though I'm not entirely convinced there will be no ill effects of changing
the argument type.  I'll feel comfortable when Michael and Paul say it's
fine :)

> CC: Christian Brauner 
> CC: Tyler Hicks 
> CC: Akihiro Suda 
> ---
>  include/linux/seccomp.h | 2 +-
>  kernel/seccomp.c| 8 
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
> index e5320f6c8654..b5103c019cf4 100644
> --- a/include/linux/seccomp.h
> +++ b/include/linux/seccomp.h
> @@ -43,7 +43,7 @@ extern void secure_computing_strict(int this_syscall);
>  #endif
>  
>  extern long prctl_get_seccomp(void);
> -extern long prctl_set_seccomp(unsigned long, char __user *);
> +extern long prctl_set_seccomp(unsigned long, void __user *);
>  
>  static inline int seccomp_mode(struct seccomp *s)
>  {
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 96afc32e041d..393e029f778a 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -924,7 +924,7 @@ static long seccomp_get_action_avail(const char __user 
> *uaction)
>  
>  /* Common entry point for both prctl and syscall. */
>  static long do_seccomp(unsigned int op, unsigned int flags,
> -const char __user *uargs)
> +void __user *uargs)
>  {
>   switch (op) {
>   case SECCOMP_SET_MODE_STRICT:
> @@ -944,7 +944,7 @@ static long do_seccomp(unsigned int op, unsigned int 
> flags,
>  }
>  
>  SYSCALL_DEFINE3(seccomp, unsigned int, op, unsigned int, flags,
> -  const char __user *, uargs)
> +  void __user *, uargs)
>  {
>   return do_seccomp(op, flags, uargs);
>  }
> @@ -956,10 +956,10 @@ SYSCALL_DEFINE3(seccomp, unsigned int, op, unsigned 
> int, flags,
>   *
>   * Returns 0 on success or -EINVAL on failure.
>   */
> -long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter)
> +long prctl_set_seccomp(unsigned long seccomp_mode, void __user *filter)
>  {
>   unsigned int op;
> - char __user *uargs;
> + void __user *uargs;
>  
>   switch (seccomp_mode) {
>   case SECCOMP_MODE_STRICT:
> -- 
> 2.19.1


Re: [PATCH] serial/sunsu: add missing of_node_put()

2018-12-02 Thread David Miller
From: Yangtao Li 
Date: Wed, 21 Nov 2018 11:06:15 -0500

> of_find_node_by_path() acquires a reference to the node
> returned by it and that reference needs to be dropped by its caller.
> This place is not doing this, so fix it.
> 
> Signed-off-by: Yangtao Li 

Several coding style problems and you are adding two new
leaks.

> + struct device_node *tmp;
>   const char *keyb = of_get_property(ap, "keyboard", NULL);
>   const char *ms = of_get_property(ap, "mouse", NULL);

Always order local variable declarations from longest to
shortest line.

>  
>   if (keyb) {
> - if (dp == of_find_node_by_path(keyb))
> - return SU_PORT_KBD;
> + tmp = of_find_node_by_path(keyb);
> + if (tmp && dp == tmp){

Always put a space between ")" and the "{" openning a new basic
block.

> + rc = SU_PORT_KBD;
> + goto out;
> + }
>   }
>   if (ms) {
> - if (dp == of_find_node_by_path(ms))
> - return SU_PORT_MS;
> + tmp = of_find_node_by_path(ms);
> + if (tmp && dp == tmp){
> + rc = SU_PORT_MS;
> + goto out;
> + }
>   }
>   }
>  
> - return SU_PORT_PORT;
> +out:
> + of_node_put(ap);
> + return rc;

Now you have two references, one held by 'ap' and one held by 'tmp'.

You are not releasing the one held by 'tmp', and you must release
'tmp' even if it equals 'dp'.

It's pretty obvious you have no way by which to test these changes and
therefore are not doing so.



Re: [PATCH] serial/sunsu: add missing of_node_put()

2018-12-02 Thread David Miller
From: Yangtao Li 
Date: Wed, 21 Nov 2018 11:06:15 -0500

> of_find_node_by_path() acquires a reference to the node
> returned by it and that reference needs to be dropped by its caller.
> This place is not doing this, so fix it.
> 
> Signed-off-by: Yangtao Li 

Several coding style problems and you are adding two new
leaks.

> + struct device_node *tmp;
>   const char *keyb = of_get_property(ap, "keyboard", NULL);
>   const char *ms = of_get_property(ap, "mouse", NULL);

Always order local variable declarations from longest to
shortest line.

>  
>   if (keyb) {
> - if (dp == of_find_node_by_path(keyb))
> - return SU_PORT_KBD;
> + tmp = of_find_node_by_path(keyb);
> + if (tmp && dp == tmp){

Always put a space between ")" and the "{" openning a new basic
block.

> + rc = SU_PORT_KBD;
> + goto out;
> + }
>   }
>   if (ms) {
> - if (dp == of_find_node_by_path(ms))
> - return SU_PORT_MS;
> + tmp = of_find_node_by_path(ms);
> + if (tmp && dp == tmp){
> + rc = SU_PORT_MS;
> + goto out;
> + }
>   }
>   }
>  
> - return SU_PORT_PORT;
> +out:
> + of_node_put(ap);
> + return rc;

Now you have two references, one held by 'ap' and one held by 'tmp'.

You are not releasing the one held by 'tmp', and you must release
'tmp' even if it equals 'dp'.

It's pretty obvious you have no way by which to test these changes and
therefore are not doing so.



Re: [PATCH] sbus: char: add of_node_put()

2018-12-02 Thread David Miller
From: Yangtao Li 
Date: Tue, 20 Nov 2018 08:30:40 -0500

> use of_node_put() to release the refcount.
> 
> Signed-off-by: Yangtao Li 

Applied.


Re: [PATCH] drivers/tty: add missing of_node_put()

2018-12-02 Thread David Miller
From: Yangtao Li 
Date: Wed, 21 Nov 2018 10:22:54 -0500

> of_find_node_by_path() acquires a reference to the node
> returned by it and that reference needs to be dropped by its caller.
> This place is not doing this, so fix it.
> 
> Signed-off-by: Yangtao Li 

Applied.


Re: [PATCH] drivers/sbus/char: add of_node_put()

2018-12-02 Thread David Miller
From: Yangtao Li 
Date: Tue, 20 Nov 2018 08:38:26 -0500

> use of_node_put() to release the refcount.
> 
> Signed-off-by: Yangtao Li 

Applied.


Re: [PATCH] sbus: char: add of_node_put()

2018-12-02 Thread David Miller
From: Yangtao Li 
Date: Tue, 20 Nov 2018 08:30:40 -0500

> use of_node_put() to release the refcount.
> 
> Signed-off-by: Yangtao Li 

Applied.


Re: [PATCH] drivers/tty: add missing of_node_put()

2018-12-02 Thread David Miller
From: Yangtao Li 
Date: Wed, 21 Nov 2018 10:22:54 -0500

> of_find_node_by_path() acquires a reference to the node
> returned by it and that reference needs to be dropped by its caller.
> This place is not doing this, so fix it.
> 
> Signed-off-by: Yangtao Li 

Applied.


Re: [PATCH] drivers/sbus/char: add of_node_put()

2018-12-02 Thread David Miller
From: Yangtao Li 
Date: Tue, 20 Nov 2018 08:38:26 -0500

> use of_node_put() to release the refcount.
> 
> Signed-off-by: Yangtao Li 

Applied.


Re: [PATCH v9 1/4] seccomp: hoist struct seccomp_data recalculation higher

2018-12-02 Thread Serge E. Hallyn
On Sun, Dec 02, 2018 at 08:28:24PM -0700, Tycho Andersen wrote:
> In the next patch, we're going to use the sd pointer passed to
> __seccomp_filter() as the data to pass to userspace. Except that in some
> cases (__seccomp_filter(SECCOMP_RET_TRACE), emulate_vsyscall(), every time
> seccomp is inovked on power, etc.) the sd pointer will be NULL in order to
> force seccomp to recompute the register data. Previously this recomputation
> happened one level lower, in seccomp_run_filters(); this patch just moves
> it up a level higher to __seccomp_filter().
> 
> Thanks Oleg for spotting this.
> 
> Signed-off-by: Tycho Andersen 
> CC: Kees Cook 
> CC: Andy Lutomirski 
> CC: Oleg Nesterov 
> CC: Eric W. Biederman 
> CC: "Serge E. Hallyn" 

Acked-by: Serge Hallyn 

> CC: Christian Brauner 
> CC: Tyler Hicks 
> CC: Akihiro Suda 
> ---
>  kernel/seccomp.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index f2ae2324c232..96afc32e041d 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -188,7 +188,6 @@ static int seccomp_check_filter(struct sock_filter 
> *filter, unsigned int flen)
>  static u32 seccomp_run_filters(const struct seccomp_data *sd,
>  struct seccomp_filter **match)
>  {
> - struct seccomp_data sd_local;
>   u32 ret = SECCOMP_RET_ALLOW;
>   /* Make sure cross-thread synced filter points somewhere sane. */
>   struct seccomp_filter *f =
> @@ -198,11 +197,6 @@ static u32 seccomp_run_filters(const struct seccomp_data 
> *sd,
>   if (WARN_ON(f == NULL))
>   return SECCOMP_RET_KILL_PROCESS;
>  
> - if (!sd) {
> - populate_seccomp_data(_local);
> - sd = _local;
> - }
> -
>   /*
>* All filters in the list are evaluated and the lowest BPF return
>* value always takes priority (ignoring the DATA).
> @@ -658,6 +652,7 @@ static int __seccomp_filter(int this_syscall, const 
> struct seccomp_data *sd,
>   u32 filter_ret, action;
>   struct seccomp_filter *match = NULL;
>   int data;
> + struct seccomp_data sd_local;
>  
>   /*
>* Make sure that any changes to mode from another thread have
> @@ -665,6 +660,11 @@ static int __seccomp_filter(int this_syscall, const 
> struct seccomp_data *sd,
>*/
>   rmb();
>  
> + if (!sd) {
> + populate_seccomp_data(_local);
> + sd = _local;
> + }
> +
>   filter_ret = seccomp_run_filters(sd, );
>   data = filter_ret & SECCOMP_RET_DATA;
>   action = filter_ret & SECCOMP_RET_ACTION_FULL;
> -- 
> 2.19.1


Re: [PATCH v9 1/4] seccomp: hoist struct seccomp_data recalculation higher

2018-12-02 Thread Serge E. Hallyn
On Sun, Dec 02, 2018 at 08:28:24PM -0700, Tycho Andersen wrote:
> In the next patch, we're going to use the sd pointer passed to
> __seccomp_filter() as the data to pass to userspace. Except that in some
> cases (__seccomp_filter(SECCOMP_RET_TRACE), emulate_vsyscall(), every time
> seccomp is inovked on power, etc.) the sd pointer will be NULL in order to
> force seccomp to recompute the register data. Previously this recomputation
> happened one level lower, in seccomp_run_filters(); this patch just moves
> it up a level higher to __seccomp_filter().
> 
> Thanks Oleg for spotting this.
> 
> Signed-off-by: Tycho Andersen 
> CC: Kees Cook 
> CC: Andy Lutomirski 
> CC: Oleg Nesterov 
> CC: Eric W. Biederman 
> CC: "Serge E. Hallyn" 

Acked-by: Serge Hallyn 

> CC: Christian Brauner 
> CC: Tyler Hicks 
> CC: Akihiro Suda 
> ---
>  kernel/seccomp.c | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index f2ae2324c232..96afc32e041d 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -188,7 +188,6 @@ static int seccomp_check_filter(struct sock_filter 
> *filter, unsigned int flen)
>  static u32 seccomp_run_filters(const struct seccomp_data *sd,
>  struct seccomp_filter **match)
>  {
> - struct seccomp_data sd_local;
>   u32 ret = SECCOMP_RET_ALLOW;
>   /* Make sure cross-thread synced filter points somewhere sane. */
>   struct seccomp_filter *f =
> @@ -198,11 +197,6 @@ static u32 seccomp_run_filters(const struct seccomp_data 
> *sd,
>   if (WARN_ON(f == NULL))
>   return SECCOMP_RET_KILL_PROCESS;
>  
> - if (!sd) {
> - populate_seccomp_data(_local);
> - sd = _local;
> - }
> -
>   /*
>* All filters in the list are evaluated and the lowest BPF return
>* value always takes priority (ignoring the DATA).
> @@ -658,6 +652,7 @@ static int __seccomp_filter(int this_syscall, const 
> struct seccomp_data *sd,
>   u32 filter_ret, action;
>   struct seccomp_filter *match = NULL;
>   int data;
> + struct seccomp_data sd_local;
>  
>   /*
>* Make sure that any changes to mode from another thread have
> @@ -665,6 +660,11 @@ static int __seccomp_filter(int this_syscall, const 
> struct seccomp_data *sd,
>*/
>   rmb();
>  
> + if (!sd) {
> + populate_seccomp_data(_local);
> + sd = _local;
> + }
> +
>   filter_ret = seccomp_run_filters(sd, );
>   data = filter_ret & SECCOMP_RET_DATA;
>   action = filter_ret & SECCOMP_RET_ACTION_FULL;
> -- 
> 2.19.1


BROTHERS HOOD

2018-12-02 Thread Illuminati brotherschurch
HELLO

  Are you a business man, politician, musical, student and you want to
be rich, powerful and be famous in life or need a power to achieving
your dreams. You can achieve your dreams by being a member of the
Illuminati. With this all your dreams and heart desire can be fully
accomplish, if you really want to be a member of the great Illuminati
then you can contact us at: illuminatibrotherschu...@gmail.com

Very Warm Regards,
Saint Octopus.
GREETINGS FROM THE GREAT BROTHERS!


BROTHERS HOOD

2018-12-02 Thread Illuminati brotherschurch
HELLO

  Are you a business man, politician, musical, student and you want to
be rich, powerful and be famous in life or need a power to achieving
your dreams. You can achieve your dreams by being a member of the
Illuminati. With this all your dreams and heart desire can be fully
accomplish, if you really want to be a member of the great Illuminati
then you can contact us at: illuminatibrotherschu...@gmail.com

Very Warm Regards,
Saint Octopus.
GREETINGS FROM THE GREAT BROTHERS!


Re: [PATCH] cpufreq: ia64: Remove unused header files

2018-12-02 Thread Viresh Kumar
On 03-12-18, 10:12, Viresh Kumar wrote:
> On 30-11-18, 09:16, Yangtao Li wrote:
> > seq_file.h does not need to be included,so remove it.Moreover deleted a
> > line of meaningless return and move the module declaration to the end.
> > In a function whose return type is void, returning on the last line is
> > not required.
> > 
> > Signed-off-by: Yangtao Li 
> > ---
> >  drivers/cpufreq/ia64-acpi-cpufreq.c | 10 +++---
> >  1 file changed, 3 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c 
> > b/drivers/cpufreq/ia64-acpi-cpufreq.c
> > index dd5440d3372d..43ac191fb46a 100644
> > --- a/drivers/cpufreq/ia64-acpi-cpufreq.c
> > +++ b/drivers/cpufreq/ia64-acpi-cpufreq.c
> > @@ -16,7 +16,6 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -24,11 +23,6 @@
> >  #include 
> >  #include 
> >  
> > -MODULE_AUTHOR("Venkatesh Pallipadi");
> > -MODULE_DESCRIPTION("ACPI Processor P-States Driver");
> > -MODULE_LICENSE("GPL");
> > -
> > -
> >  struct cpufreq_acpi_io {
> > struct acpi_processor_performance   acpi_data;
> > unsigned intresume;
> > @@ -348,9 +342,11 @@ acpi_cpufreq_exit (void)
> > pr_debug("acpi_cpufreq_exit\n");
> >  
> > cpufreq_unregister_driver(_cpufreq_driver);
> > -   return;
> >  }
> >  
> > +MODULE_AUTHOR("Venkatesh Pallipadi");
> > +MODULE_DESCRIPTION("ACPI Processor P-States Driver");
> > +MODULE_LICENSE("GPL");

Well, why not move this to the end of file completely ?

> >  
> >  late_initcall(acpi_cpufreq_init);
> >  module_exit(acpi_cpufreq_exit);
> 
> Acked-by: Viresh Kumar 

-- 
viresh


Re: [PATCH] cpufreq: ia64: Remove unused header files

2018-12-02 Thread Viresh Kumar
On 03-12-18, 10:12, Viresh Kumar wrote:
> On 30-11-18, 09:16, Yangtao Li wrote:
> > seq_file.h does not need to be included,so remove it.Moreover deleted a
> > line of meaningless return and move the module declaration to the end.
> > In a function whose return type is void, returning on the last line is
> > not required.
> > 
> > Signed-off-by: Yangtao Li 
> > ---
> >  drivers/cpufreq/ia64-acpi-cpufreq.c | 10 +++---
> >  1 file changed, 3 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c 
> > b/drivers/cpufreq/ia64-acpi-cpufreq.c
> > index dd5440d3372d..43ac191fb46a 100644
> > --- a/drivers/cpufreq/ia64-acpi-cpufreq.c
> > +++ b/drivers/cpufreq/ia64-acpi-cpufreq.c
> > @@ -16,7 +16,6 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -24,11 +23,6 @@
> >  #include 
> >  #include 
> >  
> > -MODULE_AUTHOR("Venkatesh Pallipadi");
> > -MODULE_DESCRIPTION("ACPI Processor P-States Driver");
> > -MODULE_LICENSE("GPL");
> > -
> > -
> >  struct cpufreq_acpi_io {
> > struct acpi_processor_performance   acpi_data;
> > unsigned intresume;
> > @@ -348,9 +342,11 @@ acpi_cpufreq_exit (void)
> > pr_debug("acpi_cpufreq_exit\n");
> >  
> > cpufreq_unregister_driver(_cpufreq_driver);
> > -   return;
> >  }
> >  
> > +MODULE_AUTHOR("Venkatesh Pallipadi");
> > +MODULE_DESCRIPTION("ACPI Processor P-States Driver");
> > +MODULE_LICENSE("GPL");

Well, why not move this to the end of file completely ?

> >  
> >  late_initcall(acpi_cpufreq_init);
> >  module_exit(acpi_cpufreq_exit);
> 
> Acked-by: Viresh Kumar 

-- 
viresh


Re: [PATCH] cpufreq: ia64: Remove unused header files

2018-12-02 Thread Viresh Kumar
On 30-11-18, 09:16, Yangtao Li wrote:
> seq_file.h does not need to be included,so remove it.Moreover deleted a
> line of meaningless return and move the module declaration to the end.
> In a function whose return type is void, returning on the last line is
> not required.
> 
> Signed-off-by: Yangtao Li 
> ---
>  drivers/cpufreq/ia64-acpi-cpufreq.c | 10 +++---
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c 
> b/drivers/cpufreq/ia64-acpi-cpufreq.c
> index dd5440d3372d..43ac191fb46a 100644
> --- a/drivers/cpufreq/ia64-acpi-cpufreq.c
> +++ b/drivers/cpufreq/ia64-acpi-cpufreq.c
> @@ -16,7 +16,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -24,11 +23,6 @@
>  #include 
>  #include 
>  
> -MODULE_AUTHOR("Venkatesh Pallipadi");
> -MODULE_DESCRIPTION("ACPI Processor P-States Driver");
> -MODULE_LICENSE("GPL");
> -
> -
>  struct cpufreq_acpi_io {
>   struct acpi_processor_performance   acpi_data;
>   unsigned intresume;
> @@ -348,9 +342,11 @@ acpi_cpufreq_exit (void)
>   pr_debug("acpi_cpufreq_exit\n");
>  
>   cpufreq_unregister_driver(_cpufreq_driver);
> - return;
>  }
>  
> +MODULE_AUTHOR("Venkatesh Pallipadi");
> +MODULE_DESCRIPTION("ACPI Processor P-States Driver");
> +MODULE_LICENSE("GPL");
>  
>  late_initcall(acpi_cpufreq_init);
>  module_exit(acpi_cpufreq_exit);

Acked-by: Viresh Kumar 

-- 
viresh


Re: [PATCH] cpufreq: ia64: Remove unused header files

2018-12-02 Thread Viresh Kumar
On 30-11-18, 09:16, Yangtao Li wrote:
> seq_file.h does not need to be included,so remove it.Moreover deleted a
> line of meaningless return and move the module declaration to the end.
> In a function whose return type is void, returning on the last line is
> not required.
> 
> Signed-off-by: Yangtao Li 
> ---
>  drivers/cpufreq/ia64-acpi-cpufreq.c | 10 +++---
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c 
> b/drivers/cpufreq/ia64-acpi-cpufreq.c
> index dd5440d3372d..43ac191fb46a 100644
> --- a/drivers/cpufreq/ia64-acpi-cpufreq.c
> +++ b/drivers/cpufreq/ia64-acpi-cpufreq.c
> @@ -16,7 +16,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -24,11 +23,6 @@
>  #include 
>  #include 
>  
> -MODULE_AUTHOR("Venkatesh Pallipadi");
> -MODULE_DESCRIPTION("ACPI Processor P-States Driver");
> -MODULE_LICENSE("GPL");
> -
> -
>  struct cpufreq_acpi_io {
>   struct acpi_processor_performance   acpi_data;
>   unsigned intresume;
> @@ -348,9 +342,11 @@ acpi_cpufreq_exit (void)
>   pr_debug("acpi_cpufreq_exit\n");
>  
>   cpufreq_unregister_driver(_cpufreq_driver);
> - return;
>  }
>  
> +MODULE_AUTHOR("Venkatesh Pallipadi");
> +MODULE_DESCRIPTION("ACPI Processor P-States Driver");
> +MODULE_LICENSE("GPL");
>  
>  late_initcall(acpi_cpufreq_init);
>  module_exit(acpi_cpufreq_exit);

Acked-by: Viresh Kumar 

-- 
viresh


Re: [PATCH] pci: p2pdma: clean up documentation and kernel-doc

2018-12-02 Thread Logan Gunthorpe



On 2018-12-01 10:31 a.m., Randy Dunlap wrote:
> From: Randy Dunlap 
> 
> Fix typos, spellos, and grammar in p2pdma.rst and p2pdma.c.
> 
> Fix return value(s) in function pci_p2pmem_alloc_sgl().
> 
> Signed-off-by: Randy Dunlap 
> Cc: linux-...@vger.kernel.org
> Cc: Bjorn Helgaas 
> Cc: Jonathan Corbet 
> Cc: Logan Gunthorpe 

Thanks!

Acked-by: Logan Gunthorpe 



Re: [PATCH] pci: p2pdma: clean up documentation and kernel-doc

2018-12-02 Thread Logan Gunthorpe



On 2018-12-01 10:31 a.m., Randy Dunlap wrote:
> From: Randy Dunlap 
> 
> Fix typos, spellos, and grammar in p2pdma.rst and p2pdma.c.
> 
> Fix return value(s) in function pci_p2pmem_alloc_sgl().
> 
> Signed-off-by: Randy Dunlap 
> Cc: linux-...@vger.kernel.org
> Cc: Bjorn Helgaas 
> Cc: Jonathan Corbet 
> Cc: Logan Gunthorpe 

Thanks!

Acked-by: Logan Gunthorpe 



Re: [RFC PATCH net v2] net: phy: Fix the issue that netif always links up after resuming

2018-12-02 Thread Kunihiko Hayashi
Hi Florian Heiner,

On Fri, 30 Nov 2018 19:47:37 +0100  wrote:

> On 30.11.2018 18:46, Florian Fainelli wrote:
> > 
> > 
> > On 11/30/2018 1:25 AM, Kunihiko Hayashi wrote:
> >> Even though the link is down before entering hibernation,
> >> there is an issue that the network interface always links up after resuming
> >> from hibernation.
> >>
> >> The phydev->state is PHY_READY before enabling the network interface, so
> >> the link is down. After resuming from hibernation, the phydev->state is
> >> forcibly set to PHY_UP in mdio_bus_phy_restore(), and the link becomes up.
> >>
> >> This patch adds a new convenient function to check whether the PHY is in
> >> a started state, and expects to solve the issue by changing phydev->state
> >> to PHY_UP and calling phy_start_machine() only when the PHY is started.
> >>
> >> Suggested-by: Heiner Kallweit 
> >> Signed-off-by: Kunihiko Hayashi 
> >> ---
> >>  drivers/net/phy/phy.c|  2 +-
> >>  drivers/net/phy/phy_device.c |  9 +
> >>  include/linux/phy.h  | 10 ++
> >>  3 files changed, 16 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> >> index 1d73ac3..f484d03 100644
> >> --- a/drivers/net/phy/phy.c
> >> +++ b/drivers/net/phy/phy.c
> >> @@ -670,7 +670,7 @@ void phy_stop_machine(struct phy_device *phydev)
> >>cancel_delayed_work_sync(>state_queue);
> >>  
> >>mutex_lock(>lock);
> >> -  if (phydev->state > PHY_UP && phydev->state != PHY_HALTED)
> >> +  if (phy_is_started(phydev))
> >>phydev->state = PHY_UP;
> >>mutex_unlock(>lock);
> >>  }
> >> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> >> index ab33d17..2c39717 100644
> >> --- a/drivers/net/phy/phy_device.c
> >> +++ b/drivers/net/phy/phy_device.c
> >> @@ -309,10 +309,11 @@ static int mdio_bus_phy_restore(struct device *dev)
> >>return ret;
> >>  
> >>/* The PHY needs to renegotiate. */
> >> -  phydev->link = 0;
> >> -  phydev->state = PHY_UP;
> >> -
> >> -  phy_start_machine(phydev);
> >> +  if (phy_is_started(phydev)) {
> >> +  phydev->link = 0;
> >> +  phydev->state = PHY_UP;
> >> +  phy_start_machine(phydev);
> >> +  }
> > 
> > Don't you need some of these steps to be performed under phydev->lock
> > being held? See comment below.
> > 
> Yes, locking should be done. The old code sets phydev->state
> w/o holding the lock, I'd says this was wrong.

Indeed. The phydev->state should be set with locking the mutex even here.

And it seems that setting phydev->link and calling phy_start_machine() don't
need to hold the lock. Is it correct?

> >>  
> >>return 0;
> >>  }
> >> diff --git a/include/linux/phy.h b/include/linux/phy.h
> >> index 3ea87f7..c194b45 100644
> >> --- a/include/linux/phy.h
> >> +++ b/include/linux/phy.h
> >> @@ -898,6 +898,16 @@ static inline bool phy_is_pseudo_fixed_link(struct 
> >> phy_device *phydev)
> >>  }
> >>  
> >>  /**
> >> + * phy_is_started - Convenience function for testing whether a PHY is in
> >> + * a started state
> >> + * @phydev: the phy_device struct
> >> + */
> >> +static inline bool phy_is_started(struct phy_device *phydev)
> >> +{
> > 
> > An assert with the phydev->lock mutex being held here would greatly
> > help, because otherwise this is possibly racy.
> > 
> Have a look at __phy_resume() to see what is meant with this comment.

I see. I found that there was a lock detection in this function.
The phy_is_started() should have the same detection, shouldn't it?

Thank you,

> >> +  return phydev->state >= PHY_UP && phydev->state != PHY_HALTED;
> >> +}
> >> +
> >> +/**
> >>   * phy_write_mmd - Convenience function for writing a register
> >>   * on an MMD on a given PHY.
> >>   * @phydev: The phy_device struct
> >>
> > 

---
Best Regards,
Kunihiko Hayashi




Re: [RFC PATCH net v2] net: phy: Fix the issue that netif always links up after resuming

2018-12-02 Thread Kunihiko Hayashi
Hi Florian Heiner,

On Fri, 30 Nov 2018 19:47:37 +0100  wrote:

> On 30.11.2018 18:46, Florian Fainelli wrote:
> > 
> > 
> > On 11/30/2018 1:25 AM, Kunihiko Hayashi wrote:
> >> Even though the link is down before entering hibernation,
> >> there is an issue that the network interface always links up after resuming
> >> from hibernation.
> >>
> >> The phydev->state is PHY_READY before enabling the network interface, so
> >> the link is down. After resuming from hibernation, the phydev->state is
> >> forcibly set to PHY_UP in mdio_bus_phy_restore(), and the link becomes up.
> >>
> >> This patch adds a new convenient function to check whether the PHY is in
> >> a started state, and expects to solve the issue by changing phydev->state
> >> to PHY_UP and calling phy_start_machine() only when the PHY is started.
> >>
> >> Suggested-by: Heiner Kallweit 
> >> Signed-off-by: Kunihiko Hayashi 
> >> ---
> >>  drivers/net/phy/phy.c|  2 +-
> >>  drivers/net/phy/phy_device.c |  9 +
> >>  include/linux/phy.h  | 10 ++
> >>  3 files changed, 16 insertions(+), 5 deletions(-)
> >>
> >> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> >> index 1d73ac3..f484d03 100644
> >> --- a/drivers/net/phy/phy.c
> >> +++ b/drivers/net/phy/phy.c
> >> @@ -670,7 +670,7 @@ void phy_stop_machine(struct phy_device *phydev)
> >>cancel_delayed_work_sync(>state_queue);
> >>  
> >>mutex_lock(>lock);
> >> -  if (phydev->state > PHY_UP && phydev->state != PHY_HALTED)
> >> +  if (phy_is_started(phydev))
> >>phydev->state = PHY_UP;
> >>mutex_unlock(>lock);
> >>  }
> >> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> >> index ab33d17..2c39717 100644
> >> --- a/drivers/net/phy/phy_device.c
> >> +++ b/drivers/net/phy/phy_device.c
> >> @@ -309,10 +309,11 @@ static int mdio_bus_phy_restore(struct device *dev)
> >>return ret;
> >>  
> >>/* The PHY needs to renegotiate. */
> >> -  phydev->link = 0;
> >> -  phydev->state = PHY_UP;
> >> -
> >> -  phy_start_machine(phydev);
> >> +  if (phy_is_started(phydev)) {
> >> +  phydev->link = 0;
> >> +  phydev->state = PHY_UP;
> >> +  phy_start_machine(phydev);
> >> +  }
> > 
> > Don't you need some of these steps to be performed under phydev->lock
> > being held? See comment below.
> > 
> Yes, locking should be done. The old code sets phydev->state
> w/o holding the lock, I'd says this was wrong.

Indeed. The phydev->state should be set with locking the mutex even here.

And it seems that setting phydev->link and calling phy_start_machine() don't
need to hold the lock. Is it correct?

> >>  
> >>return 0;
> >>  }
> >> diff --git a/include/linux/phy.h b/include/linux/phy.h
> >> index 3ea87f7..c194b45 100644
> >> --- a/include/linux/phy.h
> >> +++ b/include/linux/phy.h
> >> @@ -898,6 +898,16 @@ static inline bool phy_is_pseudo_fixed_link(struct 
> >> phy_device *phydev)
> >>  }
> >>  
> >>  /**
> >> + * phy_is_started - Convenience function for testing whether a PHY is in
> >> + * a started state
> >> + * @phydev: the phy_device struct
> >> + */
> >> +static inline bool phy_is_started(struct phy_device *phydev)
> >> +{
> > 
> > An assert with the phydev->lock mutex being held here would greatly
> > help, because otherwise this is possibly racy.
> > 
> Have a look at __phy_resume() to see what is meant with this comment.

I see. I found that there was a lock detection in this function.
The phy_is_started() should have the same detection, shouldn't it?

Thank you,

> >> +  return phydev->state >= PHY_UP && phydev->state != PHY_HALTED;
> >> +}
> >> +
> >> +/**
> >>   * phy_write_mmd - Convenience function for writing a register
> >>   * on an MMD on a given PHY.
> >>   * @phydev: The phy_device struct
> >>
> > 

---
Best Regards,
Kunihiko Hayashi




[PATCH 19/22] mfd: wm831x-core: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM831X
drivers/mfd/Kconfig:bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm831x-core.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index e70d35ef5c6d..d64214c78cba 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -13,7 +13,8 @@
  */
 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1944,7 +1945,3 @@ void wm831x_device_shutdown(struct wm831x *wm831x)
}
 }
 EXPORT_SYMBOL_GPL(wm831x_device_shutdown);
-
-MODULE_DESCRIPTION("Core support for the WM831X AudioPlus PMIC");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mark Brown");
-- 
2.7.4



[PATCH 19/22] mfd: wm831x-core: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM831X
drivers/mfd/Kconfig:bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm831x-core.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index e70d35ef5c6d..d64214c78cba 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -13,7 +13,8 @@
  */
 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1944,7 +1945,3 @@ void wm831x_device_shutdown(struct wm831x *wm831x)
}
 }
 EXPORT_SYMBOL_GPL(wm831x_device_shutdown);
-
-MODULE_DESCRIPTION("Core support for the WM831X AudioPlus PMIC");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mark Brown");
-- 
2.7.4



[PATCH 18/22] mfd: wm831x-i2c: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM831X_I2C
drivers/mfd/Kconfig:bool "Wolfson Microelectronics WM831x/2x PMICs with I2C"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm831x-i2c.c | 20 ++--
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c
index 22f7054d1b28..0f3af42f7268 100644
--- a/drivers/mfd/wm831x-i2c.c
+++ b/drivers/mfd/wm831x-i2c.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -68,15 +68,6 @@ static int wm831x_i2c_probe(struct i2c_client *i2c,
return wm831x_device_init(wm831x, i2c->irq);
 }
 
-static int wm831x_i2c_remove(struct i2c_client *i2c)
-{
-   struct wm831x *wm831x = i2c_get_clientdata(i2c);
-
-   wm831x_device_exit(wm831x);
-
-   return 0;
-}
-
 static int wm831x_i2c_suspend(struct device *dev)
 {
struct wm831x *wm831x = dev_get_drvdata(dev);
@@ -103,7 +94,6 @@ static const struct i2c_device_id wm831x_i2c_id[] = {
{ "wm8326", WM8326 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id);
 
 static const struct dev_pm_ops wm831x_pm_ops = {
.suspend = wm831x_i2c_suspend,
@@ -115,9 +105,9 @@ static struct i2c_driver wm831x_i2c_driver = {
.name = "wm831x",
.pm = _pm_ops,
.of_match_table = of_match_ptr(wm831x_of_match),
+   .suppress_bind_attrs = true,
},
.probe = wm831x_i2c_probe,
-   .remove = wm831x_i2c_remove,
.id_table = wm831x_i2c_id,
 };
 
@@ -132,9 +122,3 @@ static int __init wm831x_i2c_init(void)
return ret;
 }
 subsys_initcall(wm831x_i2c_init);
-
-static void __exit wm831x_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(wm831x_i2c_exit);
-- 
2.7.4



[PATCH 20/22] mfd: wm8350-i2c: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM8350_I2C
drivers/mfd/Kconfig:bool "Wolfson Microelectronics WM8350 with I2C"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.
But we do delete an unused moduleparam.h

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm8350-i2c.c | 24 +---
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c
index 9358f03b7938..b4194e068e1b 100644
--- a/drivers/mfd/wm8350-i2c.c
+++ b/drivers/mfd/wm8350-i2c.c
@@ -13,8 +13,6 @@
  *
  */
 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -48,30 +46,19 @@ static int wm8350_i2c_probe(struct i2c_client *i2c,
return wm8350_device_init(wm8350, i2c->irq, pdata);
 }
 
-static int wm8350_i2c_remove(struct i2c_client *i2c)
-{
-   struct wm8350 *wm8350 = i2c_get_clientdata(i2c);
-
-   wm8350_device_exit(wm8350);
-
-   return 0;
-}
-
 static const struct i2c_device_id wm8350_i2c_id[] = {
{ "wm8350", 0 },
{ "wm8351", 0 },
{ "wm8352", 0 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, wm8350_i2c_id);
-
 
 static struct i2c_driver wm8350_i2c_driver = {
.driver = {
   .name = "wm8350",
+  .suppress_bind_attrs = true,
},
.probe = wm8350_i2c_probe,
-   .remove = wm8350_i2c_remove,
.id_table = wm8350_i2c_id,
 };
 
@@ -81,12 +68,3 @@ static int __init wm8350_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(wm8350_i2c_init);
-
-static void __exit wm8350_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(wm8350_i2c_exit);
-
-MODULE_DESCRIPTION("I2C support for the WM8350 AudioPlus PMIC");
-MODULE_LICENSE("GPL");
-- 
2.7.4



[PATCH 18/22] mfd: wm831x-i2c: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM831X_I2C
drivers/mfd/Kconfig:bool "Wolfson Microelectronics WM831x/2x PMICs with I2C"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm831x-i2c.c | 20 ++--
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/mfd/wm831x-i2c.c b/drivers/mfd/wm831x-i2c.c
index 22f7054d1b28..0f3af42f7268 100644
--- a/drivers/mfd/wm831x-i2c.c
+++ b/drivers/mfd/wm831x-i2c.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -68,15 +68,6 @@ static int wm831x_i2c_probe(struct i2c_client *i2c,
return wm831x_device_init(wm831x, i2c->irq);
 }
 
-static int wm831x_i2c_remove(struct i2c_client *i2c)
-{
-   struct wm831x *wm831x = i2c_get_clientdata(i2c);
-
-   wm831x_device_exit(wm831x);
-
-   return 0;
-}
-
 static int wm831x_i2c_suspend(struct device *dev)
 {
struct wm831x *wm831x = dev_get_drvdata(dev);
@@ -103,7 +94,6 @@ static const struct i2c_device_id wm831x_i2c_id[] = {
{ "wm8326", WM8326 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, wm831x_i2c_id);
 
 static const struct dev_pm_ops wm831x_pm_ops = {
.suspend = wm831x_i2c_suspend,
@@ -115,9 +105,9 @@ static struct i2c_driver wm831x_i2c_driver = {
.name = "wm831x",
.pm = _pm_ops,
.of_match_table = of_match_ptr(wm831x_of_match),
+   .suppress_bind_attrs = true,
},
.probe = wm831x_i2c_probe,
-   .remove = wm831x_i2c_remove,
.id_table = wm831x_i2c_id,
 };
 
@@ -132,9 +122,3 @@ static int __init wm831x_i2c_init(void)
return ret;
 }
 subsys_initcall(wm831x_i2c_init);
-
-static void __exit wm831x_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(wm831x_i2c_exit);
-- 
2.7.4



[PATCH 20/22] mfd: wm8350-i2c: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM8350_I2C
drivers/mfd/Kconfig:bool "Wolfson Microelectronics WM8350 with I2C"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.
But we do delete an unused moduleparam.h

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm8350-i2c.c | 24 +---
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c
index 9358f03b7938..b4194e068e1b 100644
--- a/drivers/mfd/wm8350-i2c.c
+++ b/drivers/mfd/wm8350-i2c.c
@@ -13,8 +13,6 @@
  *
  */
 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -48,30 +46,19 @@ static int wm8350_i2c_probe(struct i2c_client *i2c,
return wm8350_device_init(wm8350, i2c->irq, pdata);
 }
 
-static int wm8350_i2c_remove(struct i2c_client *i2c)
-{
-   struct wm8350 *wm8350 = i2c_get_clientdata(i2c);
-
-   wm8350_device_exit(wm8350);
-
-   return 0;
-}
-
 static const struct i2c_device_id wm8350_i2c_id[] = {
{ "wm8350", 0 },
{ "wm8351", 0 },
{ "wm8352", 0 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, wm8350_i2c_id);
-
 
 static struct i2c_driver wm8350_i2c_driver = {
.driver = {
   .name = "wm8350",
+  .suppress_bind_attrs = true,
},
.probe = wm8350_i2c_probe,
-   .remove = wm8350_i2c_remove,
.id_table = wm8350_i2c_id,
 };
 
@@ -81,12 +68,3 @@ static int __init wm8350_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(wm8350_i2c_init);
-
-static void __exit wm8350_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(wm8350_i2c_exit);
-
-MODULE_DESCRIPTION("I2C support for the WM8350 AudioPlus PMIC");
-MODULE_LICENSE("GPL");
-- 
2.7.4



[PATCH 22/22] mfd: wm8400-core: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM8400
drivers/mfd/Kconfig:bool "Wolfson Microelectronics WM8400"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

A trivial function rename from wm8400_module_init to the name
wm8400_driver_init is also done to reduce possible confusion.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Mark Brown 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm8400-core.c | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c
index 8a98a2fc74e1..79756c83f5f0 100644
--- a/drivers/mfd/wm8400-core.c
+++ b/drivers/mfd/wm8400-core.c
@@ -12,7 +12,7 @@
  *
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -150,7 +150,6 @@ static const struct i2c_device_id wm8400_i2c_id[] = {
{ "wm8400", 0 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, wm8400_i2c_id);
 
 static struct i2c_driver wm8400_i2c_driver = {
.driver = {
@@ -161,7 +160,7 @@ static struct i2c_driver wm8400_i2c_driver = {
 };
 #endif
 
-static int __init wm8400_module_init(void)
+static int __init wm8400_driver_init(void)
 {
int ret = -ENODEV;
 
@@ -173,15 +172,4 @@ static int __init wm8400_module_init(void)
 
return ret;
 }
-subsys_initcall(wm8400_module_init);
-
-static void __exit wm8400_module_exit(void)
-{
-#if IS_ENABLED(CONFIG_I2C)
-   i2c_del_driver(_i2c_driver);
-#endif
-}
-module_exit(wm8400_module_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mark Brown ");
+subsys_initcall(wm8400_driver_init);
-- 
2.7.4



[PATCH 17/22] mfd: wm831x-spi: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM831X_SPI
drivers/mfd/Kconfig:bool "Wolfson Microelectronics WM831x/2x PMICs with SPI"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm831x-spi.c | 24 ++--
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c
index 018ce652ae57..dd4dab419940 100644
--- a/drivers/mfd/wm831x-spi.c
+++ b/drivers/mfd/wm831x-spi.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -67,15 +67,6 @@ static int wm831x_spi_probe(struct spi_device *spi)
return wm831x_device_init(wm831x, spi->irq);
 }
 
-static int wm831x_spi_remove(struct spi_device *spi)
-{
-   struct wm831x *wm831x = spi_get_drvdata(spi);
-
-   wm831x_device_exit(wm831x);
-
-   return 0;
-}
-
 static int wm831x_spi_suspend(struct device *dev)
 {
struct wm831x *wm831x = dev_get_drvdata(dev);
@@ -108,17 +99,16 @@ static const struct spi_device_id wm831x_spi_ids[] = {
{ "wm8326", WM8326 },
{ },
 };
-MODULE_DEVICE_TABLE(spi, wm831x_spi_ids);
 
 static struct spi_driver wm831x_spi_driver = {
.driver = {
.name   = "wm831x",
.pm = _spi_pm,
.of_match_table = of_match_ptr(wm831x_of_match),
+   .suppress_bind_attrs = true,
},
.id_table   = wm831x_spi_ids,
.probe  = wm831x_spi_probe,
-   .remove = wm831x_spi_remove,
 };
 
 static int __init wm831x_spi_init(void)
@@ -132,13 +122,3 @@ static int __init wm831x_spi_init(void)
return 0;
 }
 subsys_initcall(wm831x_spi_init);
-
-static void __exit wm831x_spi_exit(void)
-{
-   spi_unregister_driver(_spi_driver);
-}
-module_exit(wm831x_spi_exit);
-
-MODULE_DESCRIPTION("SPI support for WM831x/2x AudioPlus PMICs");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mark Brown");
-- 
2.7.4



[PATCH 22/22] mfd: wm8400-core: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM8400
drivers/mfd/Kconfig:bool "Wolfson Microelectronics WM8400"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

A trivial function rename from wm8400_module_init to the name
wm8400_driver_init is also done to reduce possible confusion.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Mark Brown 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm8400-core.c | 18 +++---
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c
index 8a98a2fc74e1..79756c83f5f0 100644
--- a/drivers/mfd/wm8400-core.c
+++ b/drivers/mfd/wm8400-core.c
@@ -12,7 +12,7 @@
  *
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -150,7 +150,6 @@ static const struct i2c_device_id wm8400_i2c_id[] = {
{ "wm8400", 0 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, wm8400_i2c_id);
 
 static struct i2c_driver wm8400_i2c_driver = {
.driver = {
@@ -161,7 +160,7 @@ static struct i2c_driver wm8400_i2c_driver = {
 };
 #endif
 
-static int __init wm8400_module_init(void)
+static int __init wm8400_driver_init(void)
 {
int ret = -ENODEV;
 
@@ -173,15 +172,4 @@ static int __init wm8400_module_init(void)
 
return ret;
 }
-subsys_initcall(wm8400_module_init);
-
-static void __exit wm8400_module_exit(void)
-{
-#if IS_ENABLED(CONFIG_I2C)
-   i2c_del_driver(_i2c_driver);
-#endif
-}
-module_exit(wm8400_module_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mark Brown ");
+subsys_initcall(wm8400_driver_init);
-- 
2.7.4



[PATCH 17/22] mfd: wm831x-spi: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM831X_SPI
drivers/mfd/Kconfig:bool "Wolfson Microelectronics WM831x/2x PMICs with SPI"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm831x-spi.c | 24 ++--
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c
index 018ce652ae57..dd4dab419940 100644
--- a/drivers/mfd/wm831x-spi.c
+++ b/drivers/mfd/wm831x-spi.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -67,15 +67,6 @@ static int wm831x_spi_probe(struct spi_device *spi)
return wm831x_device_init(wm831x, spi->irq);
 }
 
-static int wm831x_spi_remove(struct spi_device *spi)
-{
-   struct wm831x *wm831x = spi_get_drvdata(spi);
-
-   wm831x_device_exit(wm831x);
-
-   return 0;
-}
-
 static int wm831x_spi_suspend(struct device *dev)
 {
struct wm831x *wm831x = dev_get_drvdata(dev);
@@ -108,17 +99,16 @@ static const struct spi_device_id wm831x_spi_ids[] = {
{ "wm8326", WM8326 },
{ },
 };
-MODULE_DEVICE_TABLE(spi, wm831x_spi_ids);
 
 static struct spi_driver wm831x_spi_driver = {
.driver = {
.name   = "wm831x",
.pm = _spi_pm,
.of_match_table = of_match_ptr(wm831x_of_match),
+   .suppress_bind_attrs = true,
},
.id_table   = wm831x_spi_ids,
.probe  = wm831x_spi_probe,
-   .remove = wm831x_spi_remove,
 };
 
 static int __init wm831x_spi_init(void)
@@ -132,13 +122,3 @@ static int __init wm831x_spi_init(void)
return 0;
 }
 subsys_initcall(wm831x_spi_init);
-
-static void __exit wm831x_spi_exit(void)
-{
-   spi_unregister_driver(_spi_driver);
-}
-module_exit(wm831x_spi_exit);
-
-MODULE_DESCRIPTION("SPI support for WM831x/2x AudioPlus PMICs");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mark Brown");
-- 
2.7.4



[PATCH 21/22] mfd: wm8350-core: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM8350
drivers/mfd/Kconfig:bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the
file does export some symbols.

Cc: Linus Walleij 
Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm8350-core.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index 8a07c5634aee..e6434a4d7439 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -13,7 +13,8 @@
  */
 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -466,6 +467,3 @@ void wm8350_device_exit(struct wm8350 *wm8350)
wm8350_irq_exit(wm8350);
 }
 EXPORT_SYMBOL_GPL(wm8350_device_exit);
-
-MODULE_DESCRIPTION("WM8350 AudioPlus PMIC core driver");
-MODULE_LICENSE("GPL");
-- 
2.7.4



[PATCH 21/22] mfd: wm8350-core: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM8350
drivers/mfd/Kconfig:bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the
file does export some symbols.

Cc: Linus Walleij 
Cc: Lee Jones 
Cc: patc...@opensource.cirrus.com
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/wm8350-core.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index 8a07c5634aee..e6434a4d7439 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -13,7 +13,8 @@
  */
 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -466,6 +467,3 @@ void wm8350_device_exit(struct wm8350 *wm8350)
wm8350_irq_exit(wm8350);
 }
 EXPORT_SYMBOL_GPL(wm8350_device_exit);
-
-MODULE_DESCRIPTION("WM8350 AudioPlus PMIC core driver");
-MODULE_LICENSE("GPL");
-- 
2.7.4



[PATCH 16/22] mfd: tps80031: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS80031
drivers/mfd/Kconfig:bool "TI TPS80031/TPS80032 Power Management chips"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Laxman Dewangan 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/tps80031.c | 37 ++---
 1 file changed, 2 insertions(+), 35 deletions(-)

diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c
index 608c7f77830e..865257ade8ac 100644
--- a/drivers/mfd/tps80031.c
+++ b/drivers/mfd/tps80031.c
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -516,40 +515,18 @@ static int tps80031_probe(struct i2c_client *client,
return ret;
 }
 
-static int tps80031_remove(struct i2c_client *client)
-{
-   struct tps80031 *tps80031 = i2c_get_clientdata(client);
-   int i;
-
-   if (tps80031_power_off_dev == tps80031) {
-   tps80031_power_off_dev = NULL;
-   pm_power_off = NULL;
-   }
-
-   mfd_remove_devices(tps80031->dev);
-
-   regmap_del_irq_chip(client->irq, tps80031->irq_data);
-
-   for (i = 0; i < TPS80031_NUM_SLAVES; i++) {
-   if (tps80031->clients[i] != client)
-   i2c_unregister_device(tps80031->clients[i]);
-   }
-   return 0;
-}
-
 static const struct i2c_device_id tps80031_id_table[] = {
{ "tps80031", TPS80031 },
{ "tps80032", TPS80032 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, tps80031_id_table);
 
 static struct i2c_driver tps80031_driver = {
.driver = {
-   .name   = "tps80031",
+   .name   = "tps80031",
+   .suppress_bind_attrs= true,
},
.probe  = tps80031_probe,
-   .remove = tps80031_remove,
.id_table   = tps80031_id_table,
 };
 
@@ -558,13 +535,3 @@ static int __init tps80031_init(void)
return i2c_add_driver(_driver);
 }
 subsys_initcall(tps80031_init);
-
-static void __exit tps80031_exit(void)
-{
-   i2c_del_driver(_driver);
-}
-module_exit(tps80031_exit);
-
-MODULE_AUTHOR("Laxman Dewangan ");
-MODULE_DESCRIPTION("TPS80031 core driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 14/22] mfd: tps65090: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS65090
drivers/mfd/Kconfig:bool "TI TPS65090 Power Management chips"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Venu Byravarasu 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/tps65090.c | 30 +-
 1 file changed, 5 insertions(+), 25 deletions(-)

diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c
index f13e4cd06e89..6968df4d7828 100644
--- a/drivers/mfd/tps65090.c
+++ b/drivers/mfd/tps65090.c
@@ -2,7 +2,9 @@
  * Core driver for TI TPS65090 PMIC family
  *
  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
-
+ *
+ * Author: Venu Byravarasu 
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * version 2, as published by the Free Software Foundation.
@@ -19,7 +21,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -171,7 +173,6 @@ static const struct of_device_id tps65090_of_match[] = {
{ .compatible = "ti,tps65090",},
{},
 };
-MODULE_DEVICE_TABLE(of, tps65090_of_match);
 #endif
 
 static int tps65090_i2c_probe(struct i2c_client *client,
@@ -236,30 +237,19 @@ static int tps65090_i2c_probe(struct i2c_client *client,
return ret;
 }
 
-static int tps65090_i2c_remove(struct i2c_client *client)
-{
-   struct tps65090 *tps65090 = i2c_get_clientdata(client);
-
-   mfd_remove_devices(tps65090->dev);
-   if (client->irq)
-   regmap_del_irq_chip(client->irq, tps65090->irq_data);
-
-   return 0;
-}
 
 static const struct i2c_device_id tps65090_id_table[] = {
{ "tps65090", 0 },
{ },
 };
-MODULE_DEVICE_TABLE(i2c, tps65090_id_table);
 
 static struct i2c_driver tps65090_driver = {
.driver = {
.name   = "tps65090",
+   .suppress_bind_attrs = true,
.of_match_table = of_match_ptr(tps65090_of_match),
},
.probe  = tps65090_i2c_probe,
-   .remove = tps65090_i2c_remove,
.id_table   = tps65090_id_table,
 };
 
@@ -268,13 +258,3 @@ static int __init tps65090_init(void)
return i2c_add_driver(_driver);
 }
 subsys_initcall(tps65090_init);
-
-static void __exit tps65090_exit(void)
-{
-   i2c_del_driver(_driver);
-}
-module_exit(tps65090_exit);
-
-MODULE_DESCRIPTION("TPS65090 core driver");
-MODULE_AUTHOR("Venu Byravarasu ");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 16/22] mfd: tps80031: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS80031
drivers/mfd/Kconfig:bool "TI TPS80031/TPS80032 Power Management chips"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Laxman Dewangan 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/tps80031.c | 37 ++---
 1 file changed, 2 insertions(+), 35 deletions(-)

diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c
index 608c7f77830e..865257ade8ac 100644
--- a/drivers/mfd/tps80031.c
+++ b/drivers/mfd/tps80031.c
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -516,40 +515,18 @@ static int tps80031_probe(struct i2c_client *client,
return ret;
 }
 
-static int tps80031_remove(struct i2c_client *client)
-{
-   struct tps80031 *tps80031 = i2c_get_clientdata(client);
-   int i;
-
-   if (tps80031_power_off_dev == tps80031) {
-   tps80031_power_off_dev = NULL;
-   pm_power_off = NULL;
-   }
-
-   mfd_remove_devices(tps80031->dev);
-
-   regmap_del_irq_chip(client->irq, tps80031->irq_data);
-
-   for (i = 0; i < TPS80031_NUM_SLAVES; i++) {
-   if (tps80031->clients[i] != client)
-   i2c_unregister_device(tps80031->clients[i]);
-   }
-   return 0;
-}
-
 static const struct i2c_device_id tps80031_id_table[] = {
{ "tps80031", TPS80031 },
{ "tps80032", TPS80032 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, tps80031_id_table);
 
 static struct i2c_driver tps80031_driver = {
.driver = {
-   .name   = "tps80031",
+   .name   = "tps80031",
+   .suppress_bind_attrs= true,
},
.probe  = tps80031_probe,
-   .remove = tps80031_remove,
.id_table   = tps80031_id_table,
 };
 
@@ -558,13 +535,3 @@ static int __init tps80031_init(void)
return i2c_add_driver(_driver);
 }
 subsys_initcall(tps80031_init);
-
-static void __exit tps80031_exit(void)
-{
-   i2c_del_driver(_driver);
-}
-module_exit(tps80031_exit);
-
-MODULE_AUTHOR("Laxman Dewangan ");
-MODULE_DESCRIPTION("TPS80031 core driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 14/22] mfd: tps65090: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS65090
drivers/mfd/Kconfig:bool "TI TPS65090 Power Management chips"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Venu Byravarasu 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/tps65090.c | 30 +-
 1 file changed, 5 insertions(+), 25 deletions(-)

diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c
index f13e4cd06e89..6968df4d7828 100644
--- a/drivers/mfd/tps65090.c
+++ b/drivers/mfd/tps65090.c
@@ -2,7 +2,9 @@
  * Core driver for TI TPS65090 PMIC family
  *
  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
-
+ *
+ * Author: Venu Byravarasu 
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
  * version 2, as published by the Free Software Foundation.
@@ -19,7 +21,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -171,7 +173,6 @@ static const struct of_device_id tps65090_of_match[] = {
{ .compatible = "ti,tps65090",},
{},
 };
-MODULE_DEVICE_TABLE(of, tps65090_of_match);
 #endif
 
 static int tps65090_i2c_probe(struct i2c_client *client,
@@ -236,30 +237,19 @@ static int tps65090_i2c_probe(struct i2c_client *client,
return ret;
 }
 
-static int tps65090_i2c_remove(struct i2c_client *client)
-{
-   struct tps65090 *tps65090 = i2c_get_clientdata(client);
-
-   mfd_remove_devices(tps65090->dev);
-   if (client->irq)
-   regmap_del_irq_chip(client->irq, tps65090->irq_data);
-
-   return 0;
-}
 
 static const struct i2c_device_id tps65090_id_table[] = {
{ "tps65090", 0 },
{ },
 };
-MODULE_DEVICE_TABLE(i2c, tps65090_id_table);
 
 static struct i2c_driver tps65090_driver = {
.driver = {
.name   = "tps65090",
+   .suppress_bind_attrs = true,
.of_match_table = of_match_ptr(tps65090_of_match),
},
.probe  = tps65090_i2c_probe,
-   .remove = tps65090_i2c_remove,
.id_table   = tps65090_id_table,
 };
 
@@ -268,13 +258,3 @@ static int __init tps65090_init(void)
return i2c_add_driver(_driver);
 }
 subsys_initcall(tps65090_init);
-
-static void __exit tps65090_exit(void)
-{
-   i2c_del_driver(_driver);
-}
-module_exit(tps65090_exit);
-
-MODULE_DESCRIPTION("TPS65090 core driver");
-MODULE_AUTHOR("Venu Byravarasu ");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 15/22] mfd: tps65910: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS65910
drivers/mfd/Kconfig-bool "TI TPS65910 Power Management chip"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.
We do delete an unused moduleparam.h include though.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Tony Lindgren 
Cc: Lee Jones 
Cc: Graeme Gregory 
Cc: Jorge Eduardo Candelaria 
Cc: linux-o...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/tps65910.c | 18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index bf16cbe6fd88..aa3d472a10ff 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -1,5 +1,5 @@
 /*
- * tps65910.c  --  TI TPS6591x
+ * tps65910.c  --  TI TPS6591x chip family multi-function driver
  *
  * Copyright 2010 Texas Instruments Inc.
  *
@@ -13,8 +13,6 @@
  *
  */
 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -374,7 +372,6 @@ static const struct of_device_id tps65910_of_match[] = {
{ .compatible = "ti,tps65911", .data = (void *)TPS65911},
{ },
 };
-MODULE_DEVICE_TABLE(of, tps65910_of_match);
 
 static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
unsigned long *chip_id)
@@ -527,8 +524,6 @@ static const struct i2c_device_id tps65910_i2c_id[] = {
{ "tps65911", TPS65911 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, tps65910_i2c_id);
-
 
 static struct i2c_driver tps65910_i2c_driver = {
.driver = {
@@ -545,14 +540,3 @@ static int __init tps65910_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(tps65910_i2c_init);
-
-static void __exit tps65910_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(tps65910_i2c_exit);
-
-MODULE_AUTHOR("Graeme Gregory ");
-MODULE_AUTHOR("Jorge Eduardo Candelaria ");
-MODULE_DESCRIPTION("TPS6591x chip family multi-function driver");
-MODULE_LICENSE("GPL");
-- 
2.7.4



[PATCH 15/22] mfd: tps65910: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS65910
drivers/mfd/Kconfig-bool "TI TPS65910 Power Management chip"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.
We do delete an unused moduleparam.h include though.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Tony Lindgren 
Cc: Lee Jones 
Cc: Graeme Gregory 
Cc: Jorge Eduardo Candelaria 
Cc: linux-o...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/tps65910.c | 18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index bf16cbe6fd88..aa3d472a10ff 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -1,5 +1,5 @@
 /*
- * tps65910.c  --  TI TPS6591x
+ * tps65910.c  --  TI TPS6591x chip family multi-function driver
  *
  * Copyright 2010 Texas Instruments Inc.
  *
@@ -13,8 +13,6 @@
  *
  */
 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -374,7 +372,6 @@ static const struct of_device_id tps65910_of_match[] = {
{ .compatible = "ti,tps65911", .data = (void *)TPS65911},
{ },
 };
-MODULE_DEVICE_TABLE(of, tps65910_of_match);
 
 static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
unsigned long *chip_id)
@@ -527,8 +524,6 @@ static const struct i2c_device_id tps65910_i2c_id[] = {
{ "tps65911", TPS65911 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, tps65910_i2c_id);
-
 
 static struct i2c_driver tps65910_i2c_driver = {
.driver = {
@@ -545,14 +540,3 @@ static int __init tps65910_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(tps65910_i2c_init);
-
-static void __exit tps65910_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(tps65910_i2c_exit);
-
-MODULE_AUTHOR("Graeme Gregory ");
-MODULE_AUTHOR("Jorge Eduardo Candelaria ");
-MODULE_DESCRIPTION("TPS6591x chip family multi-function driver");
-MODULE_LICENSE("GPL");
-- 
2.7.4



[PATCH 12/22] mfd: sta2x11: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_STA2X11
drivers/mfd/Kconfig:bool "STMicroelectronics STA2X11"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the
file does export some symbols.

Cc: Lee Jones 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/sta2x11-mfd.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c
index 3aeafa228baf..cab9aabcaa1f 100644
--- a/drivers/mfd/sta2x11-mfd.c
+++ b/drivers/mfd/sta2x11-mfd.c
@@ -1,4 +1,6 @@
 /*
+ * STA2x11 mfd for GPIO, SCTL and APBREG
+ *
  * Copyright (c) 2009-2011 Wind River Systems, Inc.
  * Copyright (c) 2011 ST Microelectronics (Alessandro Rubini, Davide Ciminaghi)
  *
@@ -18,7 +20,8 @@
  */
 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -653,8 +656,3 @@ static int __init sta2x11_mfd_init(void)
  */
 subsys_initcall(sta2x11_drivers_init);
 rootfs_initcall(sta2x11_mfd_init);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Wind River");
-MODULE_DESCRIPTION("STA2x11 mfd for GPIO, SCTL and APBREG");
-MODULE_DEVICE_TABLE(pci, sta2x11_mfd_tbl);
-- 
2.7.4



[PATCH 13/22] mfd: syscon: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_SYSCON
drivers/mfd/Kconfig:bool "System Controller Register R/W Based on Regmap"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Arnd Bergmann 
Cc: Dong Aisheng 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/syscon.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index b6d05cd934e6..0ecdffb3d967 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -272,13 +272,3 @@ static int __init syscon_init(void)
return platform_driver_register(_driver);
 }
 postcore_initcall(syscon_init);
-
-static void __exit syscon_exit(void)
-{
-   platform_driver_unregister(_driver);
-}
-module_exit(syscon_exit);
-
-MODULE_AUTHOR("Dong Aisheng ");
-MODULE_DESCRIPTION("System Control driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 11/22] mfd: rc5t583: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_RC5T583
drivers/mfd/Kconfig:bool "Ricoh RC5T583 Power Management system device"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Laxman Dewangan 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/rc5t583.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c
index fd46de02b715..c5cc5cb3dde7 100644
--- a/drivers/mfd/rc5t583.c
+++ b/drivers/mfd/rc5t583.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -298,8 +297,6 @@ static const struct i2c_device_id rc5t583_i2c_id[] = {
{}
 };
 
-MODULE_DEVICE_TABLE(i2c, rc5t583_i2c_id);
-
 static struct i2c_driver rc5t583_i2c_driver = {
.driver = {
   .name = "rc5t583",
@@ -313,14 +310,3 @@ static int __init rc5t583_i2c_init(void)
return i2c_add_driver(_i2c_driver);
 }
 subsys_initcall(rc5t583_i2c_init);
-
-static void __exit rc5t583_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-
-module_exit(rc5t583_i2c_exit);
-
-MODULE_AUTHOR("Laxman Dewangan ");
-MODULE_DESCRIPTION("RICOH RC5T583 power management system device driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 09/22] mfd: htc-i2cpld: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig for this option is currently:

config HTC_I2CPLD
bool "HTC I2C PLD chip support"

...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Cory Maccarrone 
Cc: Lee Jones 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/htc-i2cpld.c | 18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c
index 01572b5e79e8..af3c66355270 100644
--- a/drivers/mfd/htc-i2cpld.c
+++ b/drivers/mfd/htc-i2cpld.c
@@ -27,7 +27,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -614,8 +613,6 @@ static const struct i2c_device_id htcpld_chip_id[] = {
{ "htcpld-chip", 0 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, htcpld_chip_id);
-
 
 static struct i2c_driver htcpld_chip_driver = {
.driver = {
@@ -643,17 +640,4 @@ static int __init htcpld_core_init(void)
/* Probe for our chips */
return platform_driver_probe(_core_driver, htcpld_core_probe);
 }
-
-static void __exit htcpld_core_exit(void)
-{
-   i2c_del_driver(_chip_driver);
-   platform_driver_unregister(_core_driver);
-}
-
-module_init(htcpld_core_init);
-module_exit(htcpld_core_exit);
-
-MODULE_AUTHOR("Cory Maccarrone ");
-MODULE_DESCRIPTION("I2C HTC PLD Driver");
-MODULE_LICENSE("GPL");
-
+device_initcall(htcpld_core_init);
-- 
2.7.4



[PATCH 10/22] mfd: max8925-core: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_MAX8925
drivers/mfd/Kconfig:bool "Maxim Semiconductor MAX8925 PMIC Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Haojian Zhuang 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/max8925-core.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c
index fd8b15cd84fd..87c724ba9793 100644
--- a/drivers/mfd/max8925-core.c
+++ b/drivers/mfd/max8925-core.c
@@ -10,7 +10,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -919,8 +919,3 @@ void max8925_device_exit(struct max8925_chip *chip)
free_irq(chip->tsc_irq, chip);
mfd_remove_devices(chip->dev);
 }
-
-
-MODULE_DESCRIPTION("PMIC Driver for Maxim MAX8925");
-MODULE_AUTHOR("Haojian Zhuang 

[PATCH 12/22] mfd: sta2x11: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_STA2X11
drivers/mfd/Kconfig:bool "STMicroelectronics STA2X11"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the
file does export some symbols.

Cc: Lee Jones 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/sta2x11-mfd.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c
index 3aeafa228baf..cab9aabcaa1f 100644
--- a/drivers/mfd/sta2x11-mfd.c
+++ b/drivers/mfd/sta2x11-mfd.c
@@ -1,4 +1,6 @@
 /*
+ * STA2x11 mfd for GPIO, SCTL and APBREG
+ *
  * Copyright (c) 2009-2011 Wind River Systems, Inc.
  * Copyright (c) 2011 ST Microelectronics (Alessandro Rubini, Davide Ciminaghi)
  *
@@ -18,7 +20,8 @@
  */
 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -653,8 +656,3 @@ static int __init sta2x11_mfd_init(void)
  */
 subsys_initcall(sta2x11_drivers_init);
 rootfs_initcall(sta2x11_mfd_init);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Wind River");
-MODULE_DESCRIPTION("STA2x11 mfd for GPIO, SCTL and APBREG");
-MODULE_DEVICE_TABLE(pci, sta2x11_mfd_tbl);
-- 
2.7.4



[PATCH 13/22] mfd: syscon: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_SYSCON
drivers/mfd/Kconfig:bool "System Controller Register R/W Based on Regmap"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Arnd Bergmann 
Cc: Dong Aisheng 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/syscon.c | 12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index b6d05cd934e6..0ecdffb3d967 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -272,13 +272,3 @@ static int __init syscon_init(void)
return platform_driver_register(_driver);
 }
 postcore_initcall(syscon_init);
-
-static void __exit syscon_exit(void)
-{
-   platform_driver_unregister(_driver);
-}
-module_exit(syscon_exit);
-
-MODULE_AUTHOR("Dong Aisheng ");
-MODULE_DESCRIPTION("System Control driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 11/22] mfd: rc5t583: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_RC5T583
drivers/mfd/Kconfig:bool "Ricoh RC5T583 Power Management system device"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Laxman Dewangan 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/rc5t583.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c
index fd46de02b715..c5cc5cb3dde7 100644
--- a/drivers/mfd/rc5t583.c
+++ b/drivers/mfd/rc5t583.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -298,8 +297,6 @@ static const struct i2c_device_id rc5t583_i2c_id[] = {
{}
 };
 
-MODULE_DEVICE_TABLE(i2c, rc5t583_i2c_id);
-
 static struct i2c_driver rc5t583_i2c_driver = {
.driver = {
   .name = "rc5t583",
@@ -313,14 +310,3 @@ static int __init rc5t583_i2c_init(void)
return i2c_add_driver(_i2c_driver);
 }
 subsys_initcall(rc5t583_i2c_init);
-
-static void __exit rc5t583_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-
-module_exit(rc5t583_i2c_exit);
-
-MODULE_AUTHOR("Laxman Dewangan ");
-MODULE_DESCRIPTION("RICOH RC5T583 power management system device driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 09/22] mfd: htc-i2cpld: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig for this option is currently:

config HTC_I2CPLD
bool "HTC I2C PLD chip support"

...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Cory Maccarrone 
Cc: Lee Jones 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/htc-i2cpld.c | 18 +-
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c
index 01572b5e79e8..af3c66355270 100644
--- a/drivers/mfd/htc-i2cpld.c
+++ b/drivers/mfd/htc-i2cpld.c
@@ -27,7 +27,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -614,8 +613,6 @@ static const struct i2c_device_id htcpld_chip_id[] = {
{ "htcpld-chip", 0 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, htcpld_chip_id);
-
 
 static struct i2c_driver htcpld_chip_driver = {
.driver = {
@@ -643,17 +640,4 @@ static int __init htcpld_core_init(void)
/* Probe for our chips */
return platform_driver_probe(_core_driver, htcpld_core_probe);
 }
-
-static void __exit htcpld_core_exit(void)
-{
-   i2c_del_driver(_chip_driver);
-   platform_driver_unregister(_core_driver);
-}
-
-module_init(htcpld_core_init);
-module_exit(htcpld_core_exit);
-
-MODULE_AUTHOR("Cory Maccarrone ");
-MODULE_DESCRIPTION("I2C HTC PLD Driver");
-MODULE_LICENSE("GPL");
-
+device_initcall(htcpld_core_init);
-- 
2.7.4



[PATCH 10/22] mfd: max8925-core: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_MAX8925
drivers/mfd/Kconfig:bool "Maxim Semiconductor MAX8925 PMIC Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Haojian Zhuang 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/max8925-core.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c
index fd8b15cd84fd..87c724ba9793 100644
--- a/drivers/mfd/max8925-core.c
+++ b/drivers/mfd/max8925-core.c
@@ -10,7 +10,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -919,8 +919,3 @@ void max8925_device_exit(struct max8925_chip *chip)
free_irq(chip->tsc_irq, chip);
mfd_remove_devices(chip->dev);
 }
-
-
-MODULE_DESCRIPTION("PMIC Driver for Maxim MAX8925");
-MODULE_AUTHOR("Haojian Zhuang 

[PATCH 07/22] mfd: da9055-core: make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_DA9055
drivers/mfd/Kconfig-bool "Dialog Semiconductor DA9055 PMIC Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

The exit function deleted here wasn't even registered with module_exit,
so it truly was dead code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the
file does export some symbols

Cc: Support Opensource 
Cc: Lee Jones 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/da9055-core.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
index 177e65a12c12..b55f13061547 100644
--- a/drivers/mfd/da9055-core.c
+++ b/drivers/mfd/da9055-core.c
@@ -11,7 +11,8 @@
  *  option) any later version.
  */
 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -416,13 +417,3 @@ int da9055_device_init(struct da9055 *da9055)
mfd_remove_devices(da9055->dev);
return ret;
 }
-
-void da9055_device_exit(struct da9055 *da9055)
-{
-   regmap_del_irq_chip(da9055->chip_irq, da9055->irq_data);
-   mfd_remove_devices(da9055->dev);
-}
-
-MODULE_DESCRIPTION("Core support for the DA9055 PMIC");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("David Dajun Chen ");
-- 
2.7.4



[PATCH 08/22] mfd: db8500-prcmu: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_DB8500_PRCMU
drivers/mfd/Kconfig:bool "ST-Ericsson DB8500 Power Reset Control Management 
Unit"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the
file does export some symbols.

Cc: Linus Walleij 
Cc: Lee Jones 
Cc: Mattias Nilsson 
Reviewed-by: Linus Walleij 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/db8500-prcmu.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index aec20e1c7d3d..65666b624ae8 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -1,4 +1,6 @@
 /*
+ * DB8500 PRCM Unit driver
+ *
  * Copyright (C) STMicroelectronics 2009
  * Copyright (C) ST-Ericsson SA 2010
  *
@@ -10,7 +12,8 @@
  * U8500 PRCM Unit interface driver
  *
  */
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -3188,9 +3191,4 @@ static int __init db8500_prcmu_init(void)
 {
return platform_driver_register(_prcmu_driver);
 }
-
 core_initcall(db8500_prcmu_init);
-
-MODULE_AUTHOR("Mattias Nilsson ");
-MODULE_DESCRIPTION("DB8500 PRCM Unit driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 06/22] mfd: da9055-i2c: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Makefile/Kconfig currently controlling compilation of this code is:

drivers/mfd/Makefile:da9055-objs := da9055-core.o da9055-i2c.o
drivers/mfd/Makefile:obj-$(CONFIG_MFD_DA9055)   += da9055.o

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Support Opensource 
Cc: Lee Jones 
Cc: David Dajun Chen 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/da9055-i2c.c | 24 ++--
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/mfd/da9055-i2c.c b/drivers/mfd/da9055-i2c.c
index 8169a5c2fa20..f4573feb9f8c 100644
--- a/drivers/mfd/da9055-i2c.c
+++ b/drivers/mfd/da9055-i2c.c
@@ -11,7 +11,7 @@
  *
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -46,15 +46,6 @@ static int da9055_i2c_probe(struct i2c_client *i2c,
return da9055_device_init(da9055);
 }
 
-static int da9055_i2c_remove(struct i2c_client *i2c)
-{
-   struct da9055 *da9055 = i2c_get_clientdata(i2c);
-
-   da9055_device_exit(da9055);
-
-   return 0;
-}
-
 /*
  * DO NOT change the device Ids. The naming is intentionally specific as both
  * the PMIC and CODEC parts of this chip are instantiated separately as I2C
@@ -66,7 +57,6 @@ static const struct i2c_device_id da9055_i2c_id[] = {
{"da9055-pmic", 0},
{ }
 };
-MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);
 
 static const struct of_device_id da9055_of_match[] = {
{ .compatible = "dlg,da9055-pmic", },
@@ -75,11 +65,11 @@ static const struct of_device_id da9055_of_match[] = {
 
 static struct i2c_driver da9055_i2c_driver = {
.probe = da9055_i2c_probe,
-   .remove = da9055_i2c_remove,
.id_table = da9055_i2c_id,
.driver = {
.name = "da9055-pmic",
.of_match_table = of_match_ptr(da9055_of_match),
+   .suppress_bind_attrs = true,
},
 };
 
@@ -96,13 +86,3 @@ static int __init da9055_i2c_init(void)
return 0;
 }
 subsys_initcall(da9055_i2c_init);
-
-static void __exit da9055_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(da9055_i2c_exit);
-
-MODULE_AUTHOR("David Dajun Chen ");
-MODULE_DESCRIPTION("I2C driver for Dialog DA9055 PMIC");
-MODULE_LICENSE("GPL");
-- 
2.7.4



[PATCH 07/22] mfd: da9055-core: make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_DA9055
drivers/mfd/Kconfig-bool "Dialog Semiconductor DA9055 PMIC Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

The exit function deleted here wasn't even registered with module_exit,
so it truly was dead code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the
file does export some symbols

Cc: Support Opensource 
Cc: Lee Jones 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/da9055-core.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c
index 177e65a12c12..b55f13061547 100644
--- a/drivers/mfd/da9055-core.c
+++ b/drivers/mfd/da9055-core.c
@@ -11,7 +11,8 @@
  *  option) any later version.
  */
 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -416,13 +417,3 @@ int da9055_device_init(struct da9055 *da9055)
mfd_remove_devices(da9055->dev);
return ret;
 }
-
-void da9055_device_exit(struct da9055 *da9055)
-{
-   regmap_del_irq_chip(da9055->chip_irq, da9055->irq_data);
-   mfd_remove_devices(da9055->dev);
-}
-
-MODULE_DESCRIPTION("Core support for the DA9055 PMIC");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("David Dajun Chen ");
-- 
2.7.4



[PATCH 08/22] mfd: db8500-prcmu: drop unused MODULE_ tags from non-modular code

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_DB8500_PRCMU
drivers/mfd/Kconfig:bool "ST-Ericsson DB8500 Power Reset Control Management 
Unit"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the
file does export some symbols.

Cc: Linus Walleij 
Cc: Lee Jones 
Cc: Mattias Nilsson 
Reviewed-by: Linus Walleij 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/db8500-prcmu.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index aec20e1c7d3d..65666b624ae8 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -1,4 +1,6 @@
 /*
+ * DB8500 PRCM Unit driver
+ *
  * Copyright (C) STMicroelectronics 2009
  * Copyright (C) ST-Ericsson SA 2010
  *
@@ -10,7 +12,8 @@
  * U8500 PRCM Unit interface driver
  *
  */
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -3188,9 +3191,4 @@ static int __init db8500_prcmu_init(void)
 {
return platform_driver_register(_prcmu_driver);
 }
-
 core_initcall(db8500_prcmu_init);
-
-MODULE_AUTHOR("Mattias Nilsson ");
-MODULE_DESCRIPTION("DB8500 PRCM Unit driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 06/22] mfd: da9055-i2c: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Makefile/Kconfig currently controlling compilation of this code is:

drivers/mfd/Makefile:da9055-objs := da9055-core.o da9055-i2c.o
drivers/mfd/Makefile:obj-$(CONFIG_MFD_DA9055)   += da9055.o

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Support Opensource 
Cc: Lee Jones 
Cc: David Dajun Chen 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/da9055-i2c.c | 24 ++--
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/mfd/da9055-i2c.c b/drivers/mfd/da9055-i2c.c
index 8169a5c2fa20..f4573feb9f8c 100644
--- a/drivers/mfd/da9055-i2c.c
+++ b/drivers/mfd/da9055-i2c.c
@@ -11,7 +11,7 @@
  *
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -46,15 +46,6 @@ static int da9055_i2c_probe(struct i2c_client *i2c,
return da9055_device_init(da9055);
 }
 
-static int da9055_i2c_remove(struct i2c_client *i2c)
-{
-   struct da9055 *da9055 = i2c_get_clientdata(i2c);
-
-   da9055_device_exit(da9055);
-
-   return 0;
-}
-
 /*
  * DO NOT change the device Ids. The naming is intentionally specific as both
  * the PMIC and CODEC parts of this chip are instantiated separately as I2C
@@ -66,7 +57,6 @@ static const struct i2c_device_id da9055_i2c_id[] = {
{"da9055-pmic", 0},
{ }
 };
-MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);
 
 static const struct of_device_id da9055_of_match[] = {
{ .compatible = "dlg,da9055-pmic", },
@@ -75,11 +65,11 @@ static const struct of_device_id da9055_of_match[] = {
 
 static struct i2c_driver da9055_i2c_driver = {
.probe = da9055_i2c_probe,
-   .remove = da9055_i2c_remove,
.id_table = da9055_i2c_id,
.driver = {
.name = "da9055-pmic",
.of_match_table = of_match_ptr(da9055_of_match),
+   .suppress_bind_attrs = true,
},
 };
 
@@ -96,13 +86,3 @@ static int __init da9055_i2c_init(void)
return 0;
 }
 subsys_initcall(da9055_i2c_init);
-
-static void __exit da9055_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(da9055_i2c_exit);
-
-MODULE_AUTHOR("David Dajun Chen ");
-MODULE_DESCRIPTION("I2C driver for Dialog DA9055 PMIC");
-MODULE_LICENSE("GPL");
-- 
2.7.4



[PATCH v2 00/22] mfd: demodularization of non-modular drivers

2018-12-02 Thread Paul Gortmaker
[v1 --> v2: add some more commits as requested by Lee (MFD maintainer),
 update the 00/NN text; re-do build and link testing on new linux-next. ]

This group of MFD drivers are all controlled by "bool" Kconfig settings,
but contain various amounts of largely pointless uses of infrastructure
related to modular operations, even though they can't be built modular.

We can easily remove/replace all of it.  We are trying to make driver
code consistent with the Makefiles/Kconfigs that control them.  This
means not using modular functions/macros for drivers that can never be
built as a module.  Some of the downfalls this oversight leads to are:

 (1) it is easy to accidentally write unused module_exit and remove code
 (2) it can be misleading when reading the source, thinking it can be
 modular when the Makefile and/or Kconfig prohibit it
 (3) it requires the include of the module.h header file which in turn
 includes nearly everything else, thus adding a lot of CPP overhead.
 (4) it gets copied/replicated into other drivers and spreads quickly.

What we see in current drivers falls into one or more of the following
categories:

1) include of  when it simply isn't needed

2) Use of MODULE_LICENSE, MODULE_DEVICE_TABLE,  MODULE_AUTHOR etc. 
   macros that are no-ops for non-modular drivers.

3) Creation of a module_exit() function that will be compiled and
   linked in but never actually called for non-modular drivers.

4) Addition of a platform_driver ".remove" function that is bound
   into the struct but will never be called for non-module use cases.

Solution to #1 --> #3 is simple ; we just delete the related code.

The solution to #4 is similar - we delete the ".remove" function and
the binding into the platform_driver struct.  However, since the same
".remove" function could also be triggered by an "unbind" (such as for
pass-through of a device to a guest instance)  - so we also explicitly
disable any unbind for the driver.

The unbind mask allows us to ensure we will see if there was some odd
corner case out there that was relying on it.  Typically it would be a
multi-port ethernet card passing a port through to a guest, so a
sensible use case in MFD drivers seems highly unlikely.  This same
solution has already been used in multiple other mainline subsystems.

Build testing was done on drivers/mfd for allyesconfig on x86_64, ARM
and ARM-64 on a recent linux-next checkout.

Paul.

---

Cc: Arnd Bergmann 
Cc: Cory Maccarrone 
Cc: David Dajun Chen 
Cc: Dong Aisheng 
Cc: Eric Miao 
Cc: Graeme Gregory 
Cc: Guennadi Liakhovetski 
Cc: Haojian Zhuang 
Cc: Jin Park 
Cc: Jorge Eduardo Candelaria 
Cc: Laxman Dewangan 
Cc: Lee Jones 
Cc: Linus Walleij 
Cc: Mark Brown 
Cc: Mattias Nilsson 
Cc: Michael Hennerich 
Cc: Mike Rapoport 
Cc: Tony Lindgren 
Cc: Venu Byravarasu 
Cc: linux-o...@vger.kernel.org
Cc: patc...@opensource.cirrus.com
Cc: Support Opensource 


Paul Gortmaker (22):
  mfd: aat2870-core: Make it explicitly non-modular
  mfd: adp5520: Make it explicitly non-modular
  mfd: as3711: Make it explicitly non-modular
  mfd: da903x: Make it explicitly non-modular
  mfd: da9052-*: Make it explicitly non-modular
  mfd: da9055-i2c: Make it explicitly non-modular
  mfd: da9055-core: make it explicitly non-modular
  mfd: db8500-prcmu: drop unused MODULE_ tags from non-modular code
  mfd: htc-i2cpld: Make it explicitly non-modular
  mfd: max8925-core: drop unused MODULE_ tags from non-modular code
  mfd: rc5t583: Make it explicitly non-modular
  mfd: sta2x11: drop unused MODULE_ tags from non-modular code
  mfd: syscon: Make it explicitly non-modular
  mfd: tps65090: Make it explicitly non-modular
  mfd: tps65910: Make it explicitly non-modular
  mfd: tps80031: Make it explicitly non-modular
  mfd: wm831x-spi: Make it explicitly non-modular
  mfd: wm831x-i2c: Make it explicitly non-modular
  mfd: wm831x-core: drop unused MODULE_ tags from non-modular code
  mfd: wm8350-i2c: Make it explicitly non-modular
  mfd: wm8350-core: drop unused MODULE_ tags from non-modular code
  mfd: wm8400-core: Make it explicitly non-modular

 drivers/mfd/aat2870-core.c| 40 +++
 drivers/mfd/adp5520.c | 30 +++--
 drivers/mfd/as3711.c  | 14 --
 drivers/mfd/da903x.c  | 26 +++--
 drivers/mfd/da9052-core.c | 11 ---
 drivers/mfd/da9052-i2c.c  | 22 ++---
 drivers/mfd/da9052-irq.c  |  1 -
 drivers/mfd/da9052-spi.c  | 22 ++---
 drivers/mfd/da9055-core.c | 13 ++---
 drivers/mfd/da9055-i2c.c  | 24 ++-
 drivers/mfd/db8500-prcmu.c| 10 --
 drivers/mfd/htc-i2cpld.c  | 18 +-
 drivers/mfd/max8925-core.c|  7 +--
 drivers/mfd/rc5t583.c | 14 --
 drivers/mfd/sta2x11-mfd.c | 10 --
 drivers/mfd/syscon.c  | 

[PATCH 05/22] mfd: da9052-*: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfigis currently controlling compilation of this code are:

mfd/Kconfig:config MFD_DA9052_SPI
mfd/Kconfig:bool "Dialog Semiconductor DA9052/53 PMIC variants with SPI"

mfd/Kconfig:config MFD_DA9052_I2C
mfd/Kconfig:bool "Dialog Semiconductor DA9052/53 PMIC variants with I2C"

drivers/mfd/Kconfig:config PMIC_DA9052
drivers/mfd/Kconfig:bool

...meaning that this code is currently not being built as a module.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
In doing so, da9052_device_exit() becomes orphaned, so it gets
removed as well.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We replace module.h with init.h where required, i.e. if the the file
did not include that already.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the files in the comments.

Cc: Support Opensource 
Cc: Lee Jones 
Cc: David Dajun Chen 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/da9052-core.c | 11 ---
 drivers/mfd/da9052-i2c.c  | 22 ++
 drivers/mfd/da9052-irq.c  |  1 -
 drivers/mfd/da9052-spi.c  | 22 ++
 include/linux/mfd/da9052/da9052.h |  1 -
 5 files changed, 4 insertions(+), 53 deletions(-)

diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 433add43a0a9..96da73ce5ae4 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -648,13 +647,3 @@ int da9052_device_init(struct da9052 *da9052, u8 chip_id)
 
return ret;
 }
-
-void da9052_device_exit(struct da9052 *da9052)
-{
-   mfd_remove_devices(da9052->dev);
-   da9052_irq_exit(da9052);
-}
-
-MODULE_AUTHOR("David Dajun Chen ");
-MODULE_DESCRIPTION("DA9052 MFD Core");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index 578e881067a5..cf881907b4b3 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -177,20 +177,12 @@ static int da9052_i2c_probe(struct i2c_client *client,
return da9052_device_init(da9052, id->driver_data);
 }
 
-static int da9052_i2c_remove(struct i2c_client *client)
-{
-   struct da9052 *da9052 = i2c_get_clientdata(client);
-
-   da9052_device_exit(da9052);
-   return 0;
-}
-
 static struct i2c_driver da9052_i2c_driver = {
.probe = da9052_i2c_probe,
-   .remove = da9052_i2c_remove,
.id_table = da9052_i2c_id,
.driver = {
.name = "da9052",
+   .suppress_bind_attrs = true,
 #ifdef CONFIG_OF
.of_match_table = dialog_dt_ids,
 #endif
@@ -210,13 +202,3 @@ static int __init da9052_i2c_init(void)
return 0;
 }
 subsys_initcall(da9052_i2c_init);
-
-static void __exit da9052_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(da9052_i2c_exit);
-
-MODULE_AUTHOR("David Dajun Chen ");
-MODULE_DESCRIPTION("I2C driver for Dialog DA9052 PMIC");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-irq.c b/drivers/mfd/da9052-irq.c
index cd4ca849ca44..6e0db46f71a9 100644
--- a/drivers/mfd/da9052-irq.c
+++ b/drivers/mfd/da9052-irq.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index fdae1288bc6d..8532afa567a1 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -60,14 +60,6 @@ static int da9052_spi_probe(struct spi_device *spi)
return da9052_device_init(da9052, id->driver_data);
 }
 
-static int da9052_spi_remove(struct spi_device *spi)
-{
-   struct da9052 *da9052 = spi_get_drvdata(spi);
-
-   da9052_device_exit(da9052);
-   return 0;
-}
-
 static const struct spi_device_id da9052_spi_id[] = {
{"da9052", DA9052},
{"da9053-aa", DA9053_AA},
@@ -79,10 +71,10 @@ static const struct spi_device_id da9052_spi_id[] = {
 
 static struct spi_driver da9052_spi_driver = {
.probe = da9052_spi_probe,
-   .remove = da9052_spi_remove,
.id_table = da9052_spi_id,
.driver = {
.name = "da9052",
+   .suppress_bind_attrs = true,
},
 };
 
@@ -99,13 +91,3 @@ static int __init da9052_spi_init(void)
return 0;
 }
 subsys_initcall(da9052_spi_init);
-
-static void __exit da9052_spi_exit(void)
-{
-   spi_unregister_driver(_spi_driver);
-}
-module_exit(da9052_spi_exit);
-
-MODULE_AUTHOR("David Dajun Chen ");
-MODULE_DESCRIPTION("SPI 

[PATCH 04/22] mfd: da903x: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config PMIC_DA903X
drivers/mfd/Kconfig-bool "Dialog Semiconductor DA9030/DA9034 PMIC Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We replace module.h with init.h and export.h ; the latter since this
file does export some syms.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Support Opensource 
Cc: Lee Jones 
Cc: Eric Miao 
Cc: Mike Rapoport 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/da903x.c | 26 +++---
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c
index 09f367571c58..78edb0558a0f 100644
--- a/drivers/mfd/da903x.c
+++ b/drivers/mfd/da903x.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -446,7 +446,6 @@ static const struct i2c_device_id da903x_id_table[] = {
{ "da9034", 1 },
{ },
 };
-MODULE_DEVICE_TABLE(i2c, da903x_id_table);
 
 static int __remove_subdev(struct device *dev, void *unused)
 {
@@ -535,20 +534,12 @@ static int da903x_probe(struct i2c_client *client,
return da903x_add_subdevs(chip, pdata);
 }
 
-static int da903x_remove(struct i2c_client *client)
-{
-   struct da903x_chip *chip = i2c_get_clientdata(client);
-
-   da903x_remove_subdevs(chip);
-   return 0;
-}
-
 static struct i2c_driver da903x_driver = {
.driver = {
-   .name   = "da903x",
+   .name   = "da903x",
+   .suppress_bind_attrs= true,
},
.probe  = da903x_probe,
-   .remove = da903x_remove,
.id_table   = da903x_id_table,
 };
 
@@ -557,14 +548,3 @@ static int __init da903x_init(void)
return i2c_add_driver(_driver);
 }
 subsys_initcall(da903x_init);
-
-static void __exit da903x_exit(void)
-{
-   i2c_del_driver(_driver);
-}
-module_exit(da903x_exit);
-
-MODULE_DESCRIPTION("PMIC Driver for Dialog Semiconductor DA9034");
-MODULE_AUTHOR("Eric Miao ");
-MODULE_AUTHOR("Mike Rapoport ");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH v2 00/22] mfd: demodularization of non-modular drivers

2018-12-02 Thread Paul Gortmaker
[v1 --> v2: add some more commits as requested by Lee (MFD maintainer),
 update the 00/NN text; re-do build and link testing on new linux-next. ]

This group of MFD drivers are all controlled by "bool" Kconfig settings,
but contain various amounts of largely pointless uses of infrastructure
related to modular operations, even though they can't be built modular.

We can easily remove/replace all of it.  We are trying to make driver
code consistent with the Makefiles/Kconfigs that control them.  This
means not using modular functions/macros for drivers that can never be
built as a module.  Some of the downfalls this oversight leads to are:

 (1) it is easy to accidentally write unused module_exit and remove code
 (2) it can be misleading when reading the source, thinking it can be
 modular when the Makefile and/or Kconfig prohibit it
 (3) it requires the include of the module.h header file which in turn
 includes nearly everything else, thus adding a lot of CPP overhead.
 (4) it gets copied/replicated into other drivers and spreads quickly.

What we see in current drivers falls into one or more of the following
categories:

1) include of  when it simply isn't needed

2) Use of MODULE_LICENSE, MODULE_DEVICE_TABLE,  MODULE_AUTHOR etc. 
   macros that are no-ops for non-modular drivers.

3) Creation of a module_exit() function that will be compiled and
   linked in but never actually called for non-modular drivers.

4) Addition of a platform_driver ".remove" function that is bound
   into the struct but will never be called for non-module use cases.

Solution to #1 --> #3 is simple ; we just delete the related code.

The solution to #4 is similar - we delete the ".remove" function and
the binding into the platform_driver struct.  However, since the same
".remove" function could also be triggered by an "unbind" (such as for
pass-through of a device to a guest instance)  - so we also explicitly
disable any unbind for the driver.

The unbind mask allows us to ensure we will see if there was some odd
corner case out there that was relying on it.  Typically it would be a
multi-port ethernet card passing a port through to a guest, so a
sensible use case in MFD drivers seems highly unlikely.  This same
solution has already been used in multiple other mainline subsystems.

Build testing was done on drivers/mfd for allyesconfig on x86_64, ARM
and ARM-64 on a recent linux-next checkout.

Paul.

---

Cc: Arnd Bergmann 
Cc: Cory Maccarrone 
Cc: David Dajun Chen 
Cc: Dong Aisheng 
Cc: Eric Miao 
Cc: Graeme Gregory 
Cc: Guennadi Liakhovetski 
Cc: Haojian Zhuang 
Cc: Jin Park 
Cc: Jorge Eduardo Candelaria 
Cc: Laxman Dewangan 
Cc: Lee Jones 
Cc: Linus Walleij 
Cc: Mark Brown 
Cc: Mattias Nilsson 
Cc: Michael Hennerich 
Cc: Mike Rapoport 
Cc: Tony Lindgren 
Cc: Venu Byravarasu 
Cc: linux-o...@vger.kernel.org
Cc: patc...@opensource.cirrus.com
Cc: Support Opensource 


Paul Gortmaker (22):
  mfd: aat2870-core: Make it explicitly non-modular
  mfd: adp5520: Make it explicitly non-modular
  mfd: as3711: Make it explicitly non-modular
  mfd: da903x: Make it explicitly non-modular
  mfd: da9052-*: Make it explicitly non-modular
  mfd: da9055-i2c: Make it explicitly non-modular
  mfd: da9055-core: make it explicitly non-modular
  mfd: db8500-prcmu: drop unused MODULE_ tags from non-modular code
  mfd: htc-i2cpld: Make it explicitly non-modular
  mfd: max8925-core: drop unused MODULE_ tags from non-modular code
  mfd: rc5t583: Make it explicitly non-modular
  mfd: sta2x11: drop unused MODULE_ tags from non-modular code
  mfd: syscon: Make it explicitly non-modular
  mfd: tps65090: Make it explicitly non-modular
  mfd: tps65910: Make it explicitly non-modular
  mfd: tps80031: Make it explicitly non-modular
  mfd: wm831x-spi: Make it explicitly non-modular
  mfd: wm831x-i2c: Make it explicitly non-modular
  mfd: wm831x-core: drop unused MODULE_ tags from non-modular code
  mfd: wm8350-i2c: Make it explicitly non-modular
  mfd: wm8350-core: drop unused MODULE_ tags from non-modular code
  mfd: wm8400-core: Make it explicitly non-modular

 drivers/mfd/aat2870-core.c| 40 +++
 drivers/mfd/adp5520.c | 30 +++--
 drivers/mfd/as3711.c  | 14 --
 drivers/mfd/da903x.c  | 26 +++--
 drivers/mfd/da9052-core.c | 11 ---
 drivers/mfd/da9052-i2c.c  | 22 ++---
 drivers/mfd/da9052-irq.c  |  1 -
 drivers/mfd/da9052-spi.c  | 22 ++---
 drivers/mfd/da9055-core.c | 13 ++---
 drivers/mfd/da9055-i2c.c  | 24 ++-
 drivers/mfd/db8500-prcmu.c| 10 --
 drivers/mfd/htc-i2cpld.c  | 18 +-
 drivers/mfd/max8925-core.c|  7 +--
 drivers/mfd/rc5t583.c | 14 --
 drivers/mfd/sta2x11-mfd.c | 10 --
 drivers/mfd/syscon.c  | 

[PATCH 05/22] mfd: da9052-*: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfigis currently controlling compilation of this code are:

mfd/Kconfig:config MFD_DA9052_SPI
mfd/Kconfig:bool "Dialog Semiconductor DA9052/53 PMIC variants with SPI"

mfd/Kconfig:config MFD_DA9052_I2C
mfd/Kconfig:bool "Dialog Semiconductor DA9052/53 PMIC variants with I2C"

drivers/mfd/Kconfig:config PMIC_DA9052
drivers/mfd/Kconfig:bool

...meaning that this code is currently not being built as a module.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
In doing so, da9052_device_exit() becomes orphaned, so it gets
removed as well.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We replace module.h with init.h where required, i.e. if the the file
did not include that already.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the files in the comments.

Cc: Support Opensource 
Cc: Lee Jones 
Cc: David Dajun Chen 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/da9052-core.c | 11 ---
 drivers/mfd/da9052-i2c.c  | 22 ++
 drivers/mfd/da9052-irq.c  |  1 -
 drivers/mfd/da9052-spi.c  | 22 ++
 include/linux/mfd/da9052/da9052.h |  1 -
 5 files changed, 4 insertions(+), 53 deletions(-)

diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 433add43a0a9..96da73ce5ae4 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -648,13 +647,3 @@ int da9052_device_init(struct da9052 *da9052, u8 chip_id)
 
return ret;
 }
-
-void da9052_device_exit(struct da9052 *da9052)
-{
-   mfd_remove_devices(da9052->dev);
-   da9052_irq_exit(da9052);
-}
-
-MODULE_AUTHOR("David Dajun Chen ");
-MODULE_DESCRIPTION("DA9052 MFD Core");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index 578e881067a5..cf881907b4b3 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -177,20 +177,12 @@ static int da9052_i2c_probe(struct i2c_client *client,
return da9052_device_init(da9052, id->driver_data);
 }
 
-static int da9052_i2c_remove(struct i2c_client *client)
-{
-   struct da9052 *da9052 = i2c_get_clientdata(client);
-
-   da9052_device_exit(da9052);
-   return 0;
-}
-
 static struct i2c_driver da9052_i2c_driver = {
.probe = da9052_i2c_probe,
-   .remove = da9052_i2c_remove,
.id_table = da9052_i2c_id,
.driver = {
.name = "da9052",
+   .suppress_bind_attrs = true,
 #ifdef CONFIG_OF
.of_match_table = dialog_dt_ids,
 #endif
@@ -210,13 +202,3 @@ static int __init da9052_i2c_init(void)
return 0;
 }
 subsys_initcall(da9052_i2c_init);
-
-static void __exit da9052_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(da9052_i2c_exit);
-
-MODULE_AUTHOR("David Dajun Chen ");
-MODULE_DESCRIPTION("I2C driver for Dialog DA9052 PMIC");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-irq.c b/drivers/mfd/da9052-irq.c
index cd4ca849ca44..6e0db46f71a9 100644
--- a/drivers/mfd/da9052-irq.c
+++ b/drivers/mfd/da9052-irq.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index fdae1288bc6d..8532afa567a1 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -60,14 +60,6 @@ static int da9052_spi_probe(struct spi_device *spi)
return da9052_device_init(da9052, id->driver_data);
 }
 
-static int da9052_spi_remove(struct spi_device *spi)
-{
-   struct da9052 *da9052 = spi_get_drvdata(spi);
-
-   da9052_device_exit(da9052);
-   return 0;
-}
-
 static const struct spi_device_id da9052_spi_id[] = {
{"da9052", DA9052},
{"da9053-aa", DA9053_AA},
@@ -79,10 +71,10 @@ static const struct spi_device_id da9052_spi_id[] = {
 
 static struct spi_driver da9052_spi_driver = {
.probe = da9052_spi_probe,
-   .remove = da9052_spi_remove,
.id_table = da9052_spi_id,
.driver = {
.name = "da9052",
+   .suppress_bind_attrs = true,
},
 };
 
@@ -99,13 +91,3 @@ static int __init da9052_spi_init(void)
return 0;
 }
 subsys_initcall(da9052_spi_init);
-
-static void __exit da9052_spi_exit(void)
-{
-   spi_unregister_driver(_spi_driver);
-}
-module_exit(da9052_spi_exit);
-
-MODULE_AUTHOR("David Dajun Chen ");
-MODULE_DESCRIPTION("SPI 

[PATCH 04/22] mfd: da903x: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config PMIC_DA903X
drivers/mfd/Kconfig-bool "Dialog Semiconductor DA9030/DA9034 PMIC Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We replace module.h with init.h and export.h ; the latter since this
file does export some syms.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Support Opensource 
Cc: Lee Jones 
Cc: Eric Miao 
Cc: Mike Rapoport 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/da903x.c | 26 +++---
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c
index 09f367571c58..78edb0558a0f 100644
--- a/drivers/mfd/da903x.c
+++ b/drivers/mfd/da903x.c
@@ -13,7 +13,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -446,7 +446,6 @@ static const struct i2c_device_id da903x_id_table[] = {
{ "da9034", 1 },
{ },
 };
-MODULE_DEVICE_TABLE(i2c, da903x_id_table);
 
 static int __remove_subdev(struct device *dev, void *unused)
 {
@@ -535,20 +534,12 @@ static int da903x_probe(struct i2c_client *client,
return da903x_add_subdevs(chip, pdata);
 }
 
-static int da903x_remove(struct i2c_client *client)
-{
-   struct da903x_chip *chip = i2c_get_clientdata(client);
-
-   da903x_remove_subdevs(chip);
-   return 0;
-}
-
 static struct i2c_driver da903x_driver = {
.driver = {
-   .name   = "da903x",
+   .name   = "da903x",
+   .suppress_bind_attrs= true,
},
.probe  = da903x_probe,
-   .remove = da903x_remove,
.id_table   = da903x_id_table,
 };
 
@@ -557,14 +548,3 @@ static int __init da903x_init(void)
return i2c_add_driver(_driver);
 }
 subsys_initcall(da903x_init);
-
-static void __exit da903x_exit(void)
-{
-   i2c_del_driver(_driver);
-}
-module_exit(da903x_exit);
-
-MODULE_DESCRIPTION("PMIC Driver for Dialog Semiconductor DA9034");
-MODULE_AUTHOR("Eric Miao ");
-MODULE_AUTHOR("Mike Rapoport ");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 03/22] mfd: as3711: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_AS3711
drivers/mfd/Kconfig:bool "AMS AS3711"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Guennadi Liakhovetski 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/as3711.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/mfd/as3711.c b/drivers/mfd/as3711.c
index 67b12417585d..7a74a874b93c 100644
--- a/drivers/mfd/as3711.c
+++ b/drivers/mfd/as3711.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -118,7 +117,6 @@ static const struct of_device_id as3711_of_match[] = {
{.compatible = "ams,as3711",},
{}
 };
-MODULE_DEVICE_TABLE(of, as3711_of_match);
 #endif
 
 static int as3711_i2c_probe(struct i2c_client *client,
@@ -202,8 +200,6 @@ static const struct i2c_device_id as3711_i2c_id[] = {
{}
 };
 
-MODULE_DEVICE_TABLE(i2c, as3711_i2c_id);
-
 static struct i2c_driver as3711_i2c_driver = {
.driver = {
   .name = "as3711",
@@ -219,13 +215,3 @@ static int __init as3711_i2c_init(void)
 }
 /* Initialise early */
 subsys_initcall(as3711_i2c_init);
-
-static void __exit as3711_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(as3711_i2c_exit);
-
-MODULE_AUTHOR("Guennadi Liakhovetski ");
-MODULE_DESCRIPTION("AS3711 PMIC driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 03/22] mfd: as3711: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_AS3711
drivers/mfd/Kconfig:bool "AMS AS3711"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Guennadi Liakhovetski 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/as3711.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/mfd/as3711.c b/drivers/mfd/as3711.c
index 67b12417585d..7a74a874b93c 100644
--- a/drivers/mfd/as3711.c
+++ b/drivers/mfd/as3711.c
@@ -16,7 +16,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -118,7 +117,6 @@ static const struct of_device_id as3711_of_match[] = {
{.compatible = "ams,as3711",},
{}
 };
-MODULE_DEVICE_TABLE(of, as3711_of_match);
 #endif
 
 static int as3711_i2c_probe(struct i2c_client *client,
@@ -202,8 +200,6 @@ static const struct i2c_device_id as3711_i2c_id[] = {
{}
 };
 
-MODULE_DEVICE_TABLE(i2c, as3711_i2c_id);
-
 static struct i2c_driver as3711_i2c_driver = {
.driver = {
   .name = "as3711",
@@ -219,13 +215,3 @@ static int __init as3711_i2c_init(void)
 }
 /* Initialise early */
 subsys_initcall(as3711_i2c_init);
-
-static void __exit as3711_i2c_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(as3711_i2c_exit);
-
-MODULE_AUTHOR("Guennadi Liakhovetski ");
-MODULE_DESCRIPTION("AS3711 PMIC driver");
-MODULE_LICENSE("GPL v2");
-- 
2.7.4



[PATCH 02/22] mfd: adp5520: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Makefile/Kconfig currently controlling compilation of this code is:

drivers/mfd/Makefile:obj-$(CONFIG_PMIC_ADP5520) += adp5520.o
drivers/mfd/Kconfig:config PMIC_ADP5520
drivers/mfd/Kconfig:bool "Analog Devices ADP5520/01 MFD PMIC Core Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_i2c_driver() uses the same init level priority as
builtin_i2c_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Michael Hennerich 
Cc: Lee Jones 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/adp5520.c | 30 +++---
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
index be0497b96720..2cdd39cb8a18 100644
--- a/drivers/mfd/adp5520.c
+++ b/drivers/mfd/adp5520.c
@@ -7,6 +7,8 @@
  *
  * Copyright 2009 Analog Devices Inc.
  *
+ * Author: Michael Hennerich 
+ *
  * Derived from da903x:
  * Copyright (C) 2008 Compulab, Ltd.
  * Mike Rapoport 
@@ -18,7 +20,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -304,18 +306,6 @@ static int adp5520_probe(struct i2c_client *client,
return ret;
 }
 
-static int adp5520_remove(struct i2c_client *client)
-{
-   struct adp5520_chip *chip = dev_get_drvdata(>dev);
-
-   if (chip->irq)
-   free_irq(chip->irq, chip);
-
-   adp5520_remove_subdevs(chip);
-   adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
-   return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int adp5520_suspend(struct device *dev)
 {
@@ -346,20 +336,14 @@ static const struct i2c_device_id adp5520_id[] = {
{ "pmic-adp5501", ID_ADP5501 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, adp5520_id);
 
 static struct i2c_driver adp5520_driver = {
.driver = {
-   .name   = "adp5520",
-   .pm = _pm,
+   .name   = "adp5520",
+   .pm = _pm,
+   .suppress_bind_attrs= true,
},
.probe  = adp5520_probe,
-   .remove = adp5520_remove,
.id_table   = adp5520_id,
 };
-
-module_i2c_driver(adp5520_driver);
-
-MODULE_AUTHOR("Michael Hennerich ");
-MODULE_DESCRIPTION("ADP5520(01) PMIC-MFD Driver");
-MODULE_LICENSE("GPL");
+builtin_i2c_driver(adp5520_driver);
-- 
2.7.4



[PATCH 02/22] mfd: adp5520: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Makefile/Kconfig currently controlling compilation of this code is:

drivers/mfd/Makefile:obj-$(CONFIG_PMIC_ADP5520) += adp5520.o
drivers/mfd/Kconfig:config PMIC_ADP5520
drivers/mfd/Kconfig:bool "Analog Devices ADP5520/01 MFD PMIC Core Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_i2c_driver() uses the same init level priority as
builtin_i2c_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Michael Hennerich 
Cc: Lee Jones 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/adp5520.c | 30 +++---
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
index be0497b96720..2cdd39cb8a18 100644
--- a/drivers/mfd/adp5520.c
+++ b/drivers/mfd/adp5520.c
@@ -7,6 +7,8 @@
  *
  * Copyright 2009 Analog Devices Inc.
  *
+ * Author: Michael Hennerich 
+ *
  * Derived from da903x:
  * Copyright (C) 2008 Compulab, Ltd.
  * Mike Rapoport 
@@ -18,7 +20,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -304,18 +306,6 @@ static int adp5520_probe(struct i2c_client *client,
return ret;
 }
 
-static int adp5520_remove(struct i2c_client *client)
-{
-   struct adp5520_chip *chip = dev_get_drvdata(>dev);
-
-   if (chip->irq)
-   free_irq(chip->irq, chip);
-
-   adp5520_remove_subdevs(chip);
-   adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
-   return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int adp5520_suspend(struct device *dev)
 {
@@ -346,20 +336,14 @@ static const struct i2c_device_id adp5520_id[] = {
{ "pmic-adp5501", ID_ADP5501 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, adp5520_id);
 
 static struct i2c_driver adp5520_driver = {
.driver = {
-   .name   = "adp5520",
-   .pm = _pm,
+   .name   = "adp5520",
+   .pm = _pm,
+   .suppress_bind_attrs= true,
},
.probe  = adp5520_probe,
-   .remove = adp5520_remove,
.id_table   = adp5520_id,
 };
-
-module_i2c_driver(adp5520_driver);
-
-MODULE_AUTHOR("Michael Hennerich ");
-MODULE_DESCRIPTION("ADP5520(01) PMIC-MFD Driver");
-MODULE_LICENSE("GPL");
+builtin_i2c_driver(adp5520_driver);
-- 
2.7.4



[PATCH 01/22] mfd: aat2870-core: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_AAT2870_CORE
drivers/mfd/Kconfig:bool "AnalogicTech AAT2870"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Jin Park 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/aat2870-core.c | 40 +++-
 1 file changed, 3 insertions(+), 37 deletions(-)

diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
index 3ba19a45f199..9d3d90d386c2 100644
--- a/drivers/mfd/aat2870-core.c
+++ b/drivers/mfd/aat2870-core.c
@@ -20,7 +20,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -349,18 +348,10 @@ static void aat2870_init_debugfs(struct aat2870_data 
*aat2870)
 "Failed to create debugfs register file\n");
 }
 
-static void aat2870_uninit_debugfs(struct aat2870_data *aat2870)
-{
-   debugfs_remove_recursive(aat2870->dentry_root);
-}
 #else
 static inline void aat2870_init_debugfs(struct aat2870_data *aat2870)
 {
 }
-
-static inline void aat2870_uninit_debugfs(struct aat2870_data *aat2870)
-{
-}
 #endif /* CONFIG_DEBUG_FS */
 
 static int aat2870_i2c_probe(struct i2c_client *client,
@@ -440,20 +431,6 @@ static int aat2870_i2c_probe(struct i2c_client *client,
return ret;
 }
 
-static int aat2870_i2c_remove(struct i2c_client *client)
-{
-   struct aat2870_data *aat2870 = i2c_get_clientdata(client);
-
-   aat2870_uninit_debugfs(aat2870);
-
-   mfd_remove_devices(aat2870->dev);
-   aat2870_disable(aat2870);
-   if (aat2870->uninit)
-   aat2870->uninit(aat2870);
-
-   return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int aat2870_i2c_suspend(struct device *dev)
 {
@@ -492,15 +469,14 @@ static const struct i2c_device_id aat2870_i2c_id_table[] 
= {
{ "aat2870", 0 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, aat2870_i2c_id_table);
 
 static struct i2c_driver aat2870_i2c_driver = {
.driver = {
-   .name   = "aat2870",
-   .pm = _pm_ops,
+   .name   = "aat2870",
+   .pm = _pm_ops,
+   .suppress_bind_attrs= true,
},
.probe  = aat2870_i2c_probe,
-   .remove = aat2870_i2c_remove,
.id_table   = aat2870_i2c_id_table,
 };
 
@@ -509,13 +485,3 @@ static int __init aat2870_init(void)
return i2c_add_driver(_i2c_driver);
 }
 subsys_initcall(aat2870_init);
-
-static void __exit aat2870_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(aat2870_exit);
-
-MODULE_DESCRIPTION("Core support for the AnalogicTech AAT2870");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Jin Park ");
-- 
2.7.4



[PATCH 01/22] mfd: aat2870-core: Make it explicitly non-modular

2018-12-02 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_AAT2870_CORE
drivers/mfd/Kconfig:bool "AnalogicTech AAT2870"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this code, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Lee Jones 
Cc: Jin Park 
Signed-off-by: Paul Gortmaker 
---
 drivers/mfd/aat2870-core.c | 40 +++-
 1 file changed, 3 insertions(+), 37 deletions(-)

diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
index 3ba19a45f199..9d3d90d386c2 100644
--- a/drivers/mfd/aat2870-core.c
+++ b/drivers/mfd/aat2870-core.c
@@ -20,7 +20,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -349,18 +348,10 @@ static void aat2870_init_debugfs(struct aat2870_data 
*aat2870)
 "Failed to create debugfs register file\n");
 }
 
-static void aat2870_uninit_debugfs(struct aat2870_data *aat2870)
-{
-   debugfs_remove_recursive(aat2870->dentry_root);
-}
 #else
 static inline void aat2870_init_debugfs(struct aat2870_data *aat2870)
 {
 }
-
-static inline void aat2870_uninit_debugfs(struct aat2870_data *aat2870)
-{
-}
 #endif /* CONFIG_DEBUG_FS */
 
 static int aat2870_i2c_probe(struct i2c_client *client,
@@ -440,20 +431,6 @@ static int aat2870_i2c_probe(struct i2c_client *client,
return ret;
 }
 
-static int aat2870_i2c_remove(struct i2c_client *client)
-{
-   struct aat2870_data *aat2870 = i2c_get_clientdata(client);
-
-   aat2870_uninit_debugfs(aat2870);
-
-   mfd_remove_devices(aat2870->dev);
-   aat2870_disable(aat2870);
-   if (aat2870->uninit)
-   aat2870->uninit(aat2870);
-
-   return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int aat2870_i2c_suspend(struct device *dev)
 {
@@ -492,15 +469,14 @@ static const struct i2c_device_id aat2870_i2c_id_table[] 
= {
{ "aat2870", 0 },
{ }
 };
-MODULE_DEVICE_TABLE(i2c, aat2870_i2c_id_table);
 
 static struct i2c_driver aat2870_i2c_driver = {
.driver = {
-   .name   = "aat2870",
-   .pm = _pm_ops,
+   .name   = "aat2870",
+   .pm = _pm_ops,
+   .suppress_bind_attrs= true,
},
.probe  = aat2870_i2c_probe,
-   .remove = aat2870_i2c_remove,
.id_table   = aat2870_i2c_id_table,
 };
 
@@ -509,13 +485,3 @@ static int __init aat2870_init(void)
return i2c_add_driver(_i2c_driver);
 }
 subsys_initcall(aat2870_init);
-
-static void __exit aat2870_exit(void)
-{
-   i2c_del_driver(_i2c_driver);
-}
-module_exit(aat2870_exit);
-
-MODULE_DESCRIPTION("Core support for the AnalogicTech AAT2870");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Jin Park ");
-- 
2.7.4



Re: [PATCH v2 1/9] mm: Introduce new vm_insert_range API

2018-12-02 Thread Souptick Joarder
Hi Mike,

On Sun, Dec 2, 2018 at 4:43 PM Mike Rapoport  wrote:
>
> On Sun, Dec 02, 2018 at 11:49:44AM +0530, Souptick Joarder wrote:
> > Previouly drivers have their own way of mapping range of
> > kernel pages/memory into user vma and this was done by
> > invoking vm_insert_page() within a loop.
> >
> > As this pattern is common across different drivers, it can
> > be generalized by creating a new function and use it across
> > the drivers.
> >
> > vm_insert_range is the new API which will be used to map a
> > range of kernel memory/pages to user vma.
> >
> > This API is tested by Heiko for Rockchip drm driver, on rk3188,
> > rk3288, rk3328 and rk3399 with graphics.
> >
> > Signed-off-by: Souptick Joarder 
> > Reviewed-by: Matthew Wilcox 
> > Tested-by: Heiko Stuebner 
> > ---
> >  include/linux/mm_types.h |  3 +++
> >  mm/memory.c  | 38 ++
> >  mm/nommu.c   |  7 +++
> >  3 files changed, 48 insertions(+)
> >
> > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> > index 5ed8f62..15ae24f 100644
> > --- a/include/linux/mm_types.h
> > +++ b/include/linux/mm_types.h
> > @@ -523,6 +523,9 @@ extern void tlb_gather_mmu(struct mmu_gather *tlb, 
> > struct mm_struct *mm,
> >  extern void tlb_finish_mmu(struct mmu_gather *tlb,
> >   unsigned long start, unsigned long end);
> >
> > +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
> > + struct page **pages, unsigned long page_count);
> > +
>
> This seem to belong to include/linux/mm.h, near vm_insert_page()

Ok, I will change it. Apart from this change does it looks good ?

>
> >  static inline void init_tlb_flush_pending(struct mm_struct *mm)
> >  {
> >   atomic_set(>tlb_flush_pending, 0);
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 15c417e..84ea46c 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -1478,6 +1478,44 @@ static int insert_page(struct vm_area_struct *vma, 
> > unsigned long addr,
> >  }
> >
> >  /**
> > + * vm_insert_range - insert range of kernel pages into user vma
> > + * @vma: user vma to map to
> > + * @addr: target user address of this page
> > + * @pages: pointer to array of source kernel pages
> > + * @page_count: number of pages need to insert into user vma
> > + *
> > + * This allows drivers to insert range of kernel pages they've allocated
> > + * into a user vma. This is a generic function which drivers can use
> > + * rather than using their own way of mapping range of kernel pages into
> > + * user vma.
> > + *
> > + * If we fail to insert any page into the vma, the function will return
> > + * immediately leaving any previously-inserted pages present.  Callers
> > + * from the mmap handler may immediately return the error as their caller
> > + * will destroy the vma, removing any successfully-inserted pages. Other
> > + * callers should make their own arrangements for calling unmap_region().
> > + *
> > + * Context: Process context. Called by mmap handlers.
> > + * Return: 0 on success and error code otherwise
> > + */
> > +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
> > + struct page **pages, unsigned long page_count)
> > +{
> > + unsigned long uaddr = addr;
> > + int ret = 0, i;
> > +
> > + for (i = 0; i < page_count; i++) {
> > + ret = vm_insert_page(vma, uaddr, pages[i]);
> > + if (ret < 0)
> > + return ret;
> > + uaddr += PAGE_SIZE;
> > + }
> > +
> > + return ret;
> > +}
> > +EXPORT_SYMBOL(vm_insert_range);
> > +
> > +/**
> >   * vm_insert_page - insert single page into user vma
> >   * @vma: user vma to map to
> >   * @addr: target user address of this page
> > diff --git a/mm/nommu.c b/mm/nommu.c
> > index 749276b..d6ef5c7 100644
> > --- a/mm/nommu.c
> > +++ b/mm/nommu.c
> > @@ -473,6 +473,13 @@ int vm_insert_page(struct vm_area_struct *vma, 
> > unsigned long addr,
> >  }
> >  EXPORT_SYMBOL(vm_insert_page);
> >
> > +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
> > + struct page **pages, unsigned long page_count)
> > +{
> > + return -EINVAL;
> > +}
> > +EXPORT_SYMBOL(vm_insert_range);
> > +
> >  /*
> >   *  sys_brk() for the most part doesn't need the global kernel
> >   *  lock, except when an application is doing something nasty
> > --
> > 1.9.1
> >
>
> --
> Sincerely yours,
> Mike.
>


Re: [PATCH v2 1/9] mm: Introduce new vm_insert_range API

2018-12-02 Thread Souptick Joarder
Hi Mike,

On Sun, Dec 2, 2018 at 4:43 PM Mike Rapoport  wrote:
>
> On Sun, Dec 02, 2018 at 11:49:44AM +0530, Souptick Joarder wrote:
> > Previouly drivers have their own way of mapping range of
> > kernel pages/memory into user vma and this was done by
> > invoking vm_insert_page() within a loop.
> >
> > As this pattern is common across different drivers, it can
> > be generalized by creating a new function and use it across
> > the drivers.
> >
> > vm_insert_range is the new API which will be used to map a
> > range of kernel memory/pages to user vma.
> >
> > This API is tested by Heiko for Rockchip drm driver, on rk3188,
> > rk3288, rk3328 and rk3399 with graphics.
> >
> > Signed-off-by: Souptick Joarder 
> > Reviewed-by: Matthew Wilcox 
> > Tested-by: Heiko Stuebner 
> > ---
> >  include/linux/mm_types.h |  3 +++
> >  mm/memory.c  | 38 ++
> >  mm/nommu.c   |  7 +++
> >  3 files changed, 48 insertions(+)
> >
> > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> > index 5ed8f62..15ae24f 100644
> > --- a/include/linux/mm_types.h
> > +++ b/include/linux/mm_types.h
> > @@ -523,6 +523,9 @@ extern void tlb_gather_mmu(struct mmu_gather *tlb, 
> > struct mm_struct *mm,
> >  extern void tlb_finish_mmu(struct mmu_gather *tlb,
> >   unsigned long start, unsigned long end);
> >
> > +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
> > + struct page **pages, unsigned long page_count);
> > +
>
> This seem to belong to include/linux/mm.h, near vm_insert_page()

Ok, I will change it. Apart from this change does it looks good ?

>
> >  static inline void init_tlb_flush_pending(struct mm_struct *mm)
> >  {
> >   atomic_set(>tlb_flush_pending, 0);
> > diff --git a/mm/memory.c b/mm/memory.c
> > index 15c417e..84ea46c 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -1478,6 +1478,44 @@ static int insert_page(struct vm_area_struct *vma, 
> > unsigned long addr,
> >  }
> >
> >  /**
> > + * vm_insert_range - insert range of kernel pages into user vma
> > + * @vma: user vma to map to
> > + * @addr: target user address of this page
> > + * @pages: pointer to array of source kernel pages
> > + * @page_count: number of pages need to insert into user vma
> > + *
> > + * This allows drivers to insert range of kernel pages they've allocated
> > + * into a user vma. This is a generic function which drivers can use
> > + * rather than using their own way of mapping range of kernel pages into
> > + * user vma.
> > + *
> > + * If we fail to insert any page into the vma, the function will return
> > + * immediately leaving any previously-inserted pages present.  Callers
> > + * from the mmap handler may immediately return the error as their caller
> > + * will destroy the vma, removing any successfully-inserted pages. Other
> > + * callers should make their own arrangements for calling unmap_region().
> > + *
> > + * Context: Process context. Called by mmap handlers.
> > + * Return: 0 on success and error code otherwise
> > + */
> > +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
> > + struct page **pages, unsigned long page_count)
> > +{
> > + unsigned long uaddr = addr;
> > + int ret = 0, i;
> > +
> > + for (i = 0; i < page_count; i++) {
> > + ret = vm_insert_page(vma, uaddr, pages[i]);
> > + if (ret < 0)
> > + return ret;
> > + uaddr += PAGE_SIZE;
> > + }
> > +
> > + return ret;
> > +}
> > +EXPORT_SYMBOL(vm_insert_range);
> > +
> > +/**
> >   * vm_insert_page - insert single page into user vma
> >   * @vma: user vma to map to
> >   * @addr: target user address of this page
> > diff --git a/mm/nommu.c b/mm/nommu.c
> > index 749276b..d6ef5c7 100644
> > --- a/mm/nommu.c
> > +++ b/mm/nommu.c
> > @@ -473,6 +473,13 @@ int vm_insert_page(struct vm_area_struct *vma, 
> > unsigned long addr,
> >  }
> >  EXPORT_SYMBOL(vm_insert_page);
> >
> > +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr,
> > + struct page **pages, unsigned long page_count)
> > +{
> > + return -EINVAL;
> > +}
> > +EXPORT_SYMBOL(vm_insert_range);
> > +
> >  /*
> >   *  sys_brk() for the most part doesn't need the global kernel
> >   *  lock, except when an application is doing something nasty
> > --
> > 1.9.1
> >
>
> --
> Sincerely yours,
> Mike.
>


Re: [PATCH v12 4/5] x86/boot: Parse SRAT table from RSDP and store immovable memory

2018-12-02 Thread Chao Fan
On Fri, Nov 30, 2018 at 09:54:33AM -0500, Masayoshi Mizuma wrote:
>On Fri, Nov 30, 2018 at 09:24:54AM +0800, Chao Fan wrote:
>> >>  /* acpitb.c */
>> >> +#ifdef CONFIG_RANDOMIZE_BASE
>> >> +/* Store the amount of immovable memory regions */
>> >> +int num_immovable_mem;
>> >> +#endif
>> >> +
>> >> +#ifdef CONFIG_EARLY_PARSE_RSDP
>> >> +void get_immovable_mem(void);
>> >
>> >> +/* There are 72 kinds of ACPI_SIG in head file of ACPI. */
>> >> +#define MAX_ACPI_SIG 72
>> >
>> >The 72 isn't the specification of ACPI, right? So the number
>> 
>> Yes, it's from  ACPI code, include/acpi/actbl*h.
>> Boris said there should be a check for the num_entries,
>> I didn't get a good idea, so I use the max number to check it.
>> So do you have some advice?
>
>Ah, got it. How about adding the check for len to prevent the wrap?
>Like as:
>
>   len = header->length;
>   if (len <= sizeof(struct acpi_table_header))
>   return NULL;
>   num_entries = (u32)((len - sizeof(struct acpi_table_header)) / size);

Hi Masa,

Your check is right, but not exactly the same.
I think what Boris said is to prevent num_entries from getting too large
and the loop getting too much.
So the 'num_entries' or 'len' can't be more than a fixed value.

Thanks,
Chao Fan

>
>Thanks,
>Masa
>
>




Re: [PATCH v12 4/5] x86/boot: Parse SRAT table from RSDP and store immovable memory

2018-12-02 Thread Chao Fan
On Fri, Nov 30, 2018 at 09:54:33AM -0500, Masayoshi Mizuma wrote:
>On Fri, Nov 30, 2018 at 09:24:54AM +0800, Chao Fan wrote:
>> >>  /* acpitb.c */
>> >> +#ifdef CONFIG_RANDOMIZE_BASE
>> >> +/* Store the amount of immovable memory regions */
>> >> +int num_immovable_mem;
>> >> +#endif
>> >> +
>> >> +#ifdef CONFIG_EARLY_PARSE_RSDP
>> >> +void get_immovable_mem(void);
>> >
>> >> +/* There are 72 kinds of ACPI_SIG in head file of ACPI. */
>> >> +#define MAX_ACPI_SIG 72
>> >
>> >The 72 isn't the specification of ACPI, right? So the number
>> 
>> Yes, it's from  ACPI code, include/acpi/actbl*h.
>> Boris said there should be a check for the num_entries,
>> I didn't get a good idea, so I use the max number to check it.
>> So do you have some advice?
>
>Ah, got it. How about adding the check for len to prevent the wrap?
>Like as:
>
>   len = header->length;
>   if (len <= sizeof(struct acpi_table_header))
>   return NULL;
>   num_entries = (u32)((len - sizeof(struct acpi_table_header)) / size);

Hi Masa,

Your check is right, but not exactly the same.
I think what Boris said is to prevent num_entries from getting too large
and the loop getting too much.
So the 'num_entries' or 'len' can't be more than a fixed value.

Thanks,
Chao Fan

>
>Thanks,
>Masa
>
>




[PATCH] mailbox: Hi3660: Fixup mailbox state machine malfunction issue

2018-12-02 Thread Kevin Wangtao
Current mailbox driver of Hi3660 release the mailbox directly
before sending a new message which may cause last message lost
and next message sending doesn't take effect actually.

This patch fixs this issue by following the right progress below,
each time before sending a message, mailbox driver will check
whether the mailbox is in ready state, if last message has been
acknowledged, the mailbox driver will clear the ack state to turn
the mailbox to ready state again.

Signed-off-by: Kevin Wangtao 
---
 drivers/mailbox/hi3660-mailbox.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/mailbox/hi3660-mailbox.c b/drivers/mailbox/hi3660-mailbox.c
index 3eea6b6..035b71a 100644
--- a/drivers/mailbox/hi3660-mailbox.c
+++ b/drivers/mailbox/hi3660-mailbox.c
@@ -38,6 +38,7 @@
 #define MBOX_AUTOMATIC_ACK 1
 
 #define MBOX_STATE_IDLEBIT(4)
+#define MBOX_STATE_READY   BIT(5)
 #define MBOX_STATE_ACK BIT(7)
 
 #define MBOX_MSG_LEN   8
@@ -91,8 +92,8 @@ static int hi3660_mbox_check_state(struct mbox_chan *chan)
unsigned long val;
unsigned int ret;
 
-   /* Mailbox is idle so directly bail out */
-   if (readl(base + MBOX_MODE_REG) & MBOX_STATE_IDLE)
+   /* Mailbox is ready to use */
+   if (readl(base + MBOX_MODE_REG) & MBOX_STATE_READY)
return 0;
 
/* Wait for acknowledge from remote */
@@ -103,9 +104,9 @@ static int hi3660_mbox_check_state(struct mbox_chan *chan)
return ret;
}
 
-   /* Ensure channel is released */
-   writel(0x, base + MBOX_IMASK_REG);
-   writel(BIT(mchan->ack_irq), base + MBOX_SRC_REG);
+   /* clear ack state, mailbox will get back to ready state */
+   writel(BIT(mchan->ack_irq), base + MBOX_ICLR_REG);
+
return 0;
 }
 
@@ -160,10 +161,6 @@ static int hi3660_mbox_startup(struct mbox_chan *chan)
 {
int ret;
 
-   ret = hi3660_mbox_check_state(chan);
-   if (ret)
-   return ret;
-
ret = hi3660_mbox_unlock(chan);
if (ret)
return ret;
@@ -183,10 +180,11 @@ static int hi3660_mbox_send_data(struct mbox_chan *chan, 
void *msg)
void __iomem *base = MBOX_BASE(mbox, ch);
u32 *buf = msg;
unsigned int i;
+   int ret;
 
-   /* Ensure channel is released */
-   writel_relaxed(0x, base + MBOX_IMASK_REG);
-   writel_relaxed(BIT(mchan->ack_irq), base + MBOX_SRC_REG);
+   ret = hi3660_mbox_check_state(chan);
+   if (ret)
+   return ret;
 
/* Clear mask for destination interrupt */
writel_relaxed(~BIT(mchan->dst_irq), base + MBOX_IMASK_REG);
-- 
2.8.1



[PATCH] mailbox: Hi3660: Fixup mailbox state machine malfunction issue

2018-12-02 Thread Kevin Wangtao
Current mailbox driver of Hi3660 release the mailbox directly
before sending a new message which may cause last message lost
and next message sending doesn't take effect actually.

This patch fixs this issue by following the right progress below,
each time before sending a message, mailbox driver will check
whether the mailbox is in ready state, if last message has been
acknowledged, the mailbox driver will clear the ack state to turn
the mailbox to ready state again.

Signed-off-by: Kevin Wangtao 
---
 drivers/mailbox/hi3660-mailbox.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/mailbox/hi3660-mailbox.c b/drivers/mailbox/hi3660-mailbox.c
index 3eea6b6..035b71a 100644
--- a/drivers/mailbox/hi3660-mailbox.c
+++ b/drivers/mailbox/hi3660-mailbox.c
@@ -38,6 +38,7 @@
 #define MBOX_AUTOMATIC_ACK 1
 
 #define MBOX_STATE_IDLEBIT(4)
+#define MBOX_STATE_READY   BIT(5)
 #define MBOX_STATE_ACK BIT(7)
 
 #define MBOX_MSG_LEN   8
@@ -91,8 +92,8 @@ static int hi3660_mbox_check_state(struct mbox_chan *chan)
unsigned long val;
unsigned int ret;
 
-   /* Mailbox is idle so directly bail out */
-   if (readl(base + MBOX_MODE_REG) & MBOX_STATE_IDLE)
+   /* Mailbox is ready to use */
+   if (readl(base + MBOX_MODE_REG) & MBOX_STATE_READY)
return 0;
 
/* Wait for acknowledge from remote */
@@ -103,9 +104,9 @@ static int hi3660_mbox_check_state(struct mbox_chan *chan)
return ret;
}
 
-   /* Ensure channel is released */
-   writel(0x, base + MBOX_IMASK_REG);
-   writel(BIT(mchan->ack_irq), base + MBOX_SRC_REG);
+   /* clear ack state, mailbox will get back to ready state */
+   writel(BIT(mchan->ack_irq), base + MBOX_ICLR_REG);
+
return 0;
 }
 
@@ -160,10 +161,6 @@ static int hi3660_mbox_startup(struct mbox_chan *chan)
 {
int ret;
 
-   ret = hi3660_mbox_check_state(chan);
-   if (ret)
-   return ret;
-
ret = hi3660_mbox_unlock(chan);
if (ret)
return ret;
@@ -183,10 +180,11 @@ static int hi3660_mbox_send_data(struct mbox_chan *chan, 
void *msg)
void __iomem *base = MBOX_BASE(mbox, ch);
u32 *buf = msg;
unsigned int i;
+   int ret;
 
-   /* Ensure channel is released */
-   writel_relaxed(0x, base + MBOX_IMASK_REG);
-   writel_relaxed(BIT(mchan->ack_irq), base + MBOX_SRC_REG);
+   ret = hi3660_mbox_check_state(chan);
+   if (ret)
+   return ret;
 
/* Clear mask for destination interrupt */
writel_relaxed(~BIT(mchan->dst_irq), base + MBOX_IMASK_REG);
-- 
2.8.1



RE: [PATCHv2 3/6] PCI: layerscape: Add the EP mode support

2018-12-02 Thread Xiaowei Bao
Hi Lorenzo,

-Original Message-
From: Lorenzo Pieralisi  
Sent: 2018年11月30日 18:55
To: Xiaowei Bao 
Cc: bhelg...@google.com; robh...@kernel.org; mark.rutl...@arm.com; 
shawn...@kernel.org; Leo Li ; kis...@ti.com; a...@arndb.de; 
gre...@linuxfoundation.org; M.h. Lian ; Mingkai Hu 
; Roy Zang ; 
kstew...@linuxfoundation.org; cyrille.pitc...@free-electrons.com; 
pombreda...@nexb.com; shawn@rock-chips.com; niklas.cas...@axis.com; 
linux-...@vger.kernel.org; devicet...@vger.kernel.org; 
linux-kernel@vger.kernel.org; linux-arm-ker...@lists.infradead.org; 
linuxppc-...@lists.ozlabs.org
Subject: Re: [PATCHv2 3/6] PCI: layerscape: Add the EP mode support

On Mon, Nov 05, 2018 at 04:46:50PM +0800, Xiaowei Bao wrote:
> Add the EP mode support.
> 
> Signed-off-by: Xiaowei Bao 
> ---
> v2:
>  - Add the SoC specific compatibles.
> 
>  .../devicetree/bindings/pci/layerscape-pci.txt |3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)

Wrong commit $SUBJECT, this is not PCI code, it is a DT binding update, I will 
have a look at the rest of the series to see if I can update this patch or you 
will do it with the next respin.

Lorenzo
[Xiaowei Bao] HI Lorenzo, thanks a lot, I will send V3 patch to modify the 
commits. 

> diff --git a/Documentation/devicetree/bindings/pci/layerscape-pci.txt 
> b/Documentation/devicetree/bindings/pci/layerscape-pci.txt
> index 66df1e8..9c090c7 100644
> --- a/Documentation/devicetree/bindings/pci/layerscape-pci.txt
> +++ b/Documentation/devicetree/bindings/pci/layerscape-pci.txt
> @@ -13,12 +13,15 @@ information.
>  
>  Required properties:
>  - compatible: should contain the platform identifier such as:
> +  RC mode:
>  "fsl,ls1021a-pcie", "snps,dw-pcie"
>  "fsl,ls2080a-pcie", "fsl,ls2085a-pcie", "snps,dw-pcie"
>  "fsl,ls2088a-pcie"
>  "fsl,ls1088a-pcie"
>  "fsl,ls1046a-pcie"
>  "fsl,ls1012a-pcie"
> +  EP mode:
> +"fsl,ls1046a-pcie-ep", "fsl,ls-pcie-ep"
>  - reg: base addresses and lengths of the PCIe controller register blocks.
>  - interrupts: A list of interrupt outputs of the controller. Must contain an
>entry for each entry in the interrupt-names property.
> --
> 1.7.1
> 


RE: [PATCHv2 3/6] PCI: layerscape: Add the EP mode support

2018-12-02 Thread Xiaowei Bao
Hi Lorenzo,

-Original Message-
From: Lorenzo Pieralisi  
Sent: 2018年11月30日 18:55
To: Xiaowei Bao 
Cc: bhelg...@google.com; robh...@kernel.org; mark.rutl...@arm.com; 
shawn...@kernel.org; Leo Li ; kis...@ti.com; a...@arndb.de; 
gre...@linuxfoundation.org; M.h. Lian ; Mingkai Hu 
; Roy Zang ; 
kstew...@linuxfoundation.org; cyrille.pitc...@free-electrons.com; 
pombreda...@nexb.com; shawn@rock-chips.com; niklas.cas...@axis.com; 
linux-...@vger.kernel.org; devicet...@vger.kernel.org; 
linux-kernel@vger.kernel.org; linux-arm-ker...@lists.infradead.org; 
linuxppc-...@lists.ozlabs.org
Subject: Re: [PATCHv2 3/6] PCI: layerscape: Add the EP mode support

On Mon, Nov 05, 2018 at 04:46:50PM +0800, Xiaowei Bao wrote:
> Add the EP mode support.
> 
> Signed-off-by: Xiaowei Bao 
> ---
> v2:
>  - Add the SoC specific compatibles.
> 
>  .../devicetree/bindings/pci/layerscape-pci.txt |3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)

Wrong commit $SUBJECT, this is not PCI code, it is a DT binding update, I will 
have a look at the rest of the series to see if I can update this patch or you 
will do it with the next respin.

Lorenzo
[Xiaowei Bao] HI Lorenzo, thanks a lot, I will send V3 patch to modify the 
commits. 

> diff --git a/Documentation/devicetree/bindings/pci/layerscape-pci.txt 
> b/Documentation/devicetree/bindings/pci/layerscape-pci.txt
> index 66df1e8..9c090c7 100644
> --- a/Documentation/devicetree/bindings/pci/layerscape-pci.txt
> +++ b/Documentation/devicetree/bindings/pci/layerscape-pci.txt
> @@ -13,12 +13,15 @@ information.
>  
>  Required properties:
>  - compatible: should contain the platform identifier such as:
> +  RC mode:
>  "fsl,ls1021a-pcie", "snps,dw-pcie"
>  "fsl,ls2080a-pcie", "fsl,ls2085a-pcie", "snps,dw-pcie"
>  "fsl,ls2088a-pcie"
>  "fsl,ls1088a-pcie"
>  "fsl,ls1046a-pcie"
>  "fsl,ls1012a-pcie"
> +  EP mode:
> +"fsl,ls1046a-pcie-ep", "fsl,ls-pcie-ep"
>  - reg: base addresses and lengths of the PCIe controller register blocks.
>  - interrupts: A list of interrupt outputs of the controller. Must contain an
>entry for each entry in the interrupt-names property.
> --
> 1.7.1
> 


RE: [PATCHv2 5/6] pci: layerscape: Add the EP mode support.

2018-12-02 Thread Xiaowei Bao
Hi Lorenzo,

-Original Message-
From: Lorenzo Pieralisi  
Sent: 2018年12月1日 0:22
To: Xiaowei Bao 
Cc: bhelg...@google.com; robh...@kernel.org; mark.rutl...@arm.com; 
shawn...@kernel.org; Leo Li ; kis...@ti.com; a...@arndb.de; 
gre...@linuxfoundation.org; M.h. Lian ; Mingkai Hu 
; Roy Zang ; 
kstew...@linuxfoundation.org; cyrille.pitc...@free-electrons.com; 
pombreda...@nexb.com; shawn@rock-chips.com; niklas.cas...@axis.com; 
linux-...@vger.kernel.org; devicet...@vger.kernel.org; 
linux-kernel@vger.kernel.org; linux-arm-ker...@lists.infradead.org; 
linuxppc-...@lists.ozlabs.org
Subject: Re: [PATCHv2 5/6] pci: layerscape: Add the EP mode support.

On Mon, Nov 05, 2018 at 04:46:52PM +0800, Xiaowei Bao wrote:
> Add the PCIe EP mode support for layerscape platform.
> 
> Signed-off-by: Xiaowei Bao 
> ---
> v2:
>  - remove the EP mode check function.
> 
>  drivers/pci/controller/dwc/Makefile|2 +-
>  drivers/pci/controller/dwc/pci-layerscape-ep.c |  147 
> 
>  2 files changed, 148 insertions(+), 1 deletions(-)  create mode 
> 100644 drivers/pci/controller/dwc/pci-layerscape-ep.c
> 
> diff --git a/drivers/pci/controller/dwc/Makefile 
> b/drivers/pci/controller/dwc/Makefile
> index 5d2ce72..b26d617 100644
> --- a/drivers/pci/controller/dwc/Makefile
> +++ b/drivers/pci/controller/dwc/Makefile
> @@ -8,7 +8,7 @@ obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
>  obj-$(CONFIG_PCI_IMX6) += pci-imx6.o
>  obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
>  obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone-dw.o pci-keystone.o
> -obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
> +obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o pci-layerscape-ep.o
>  obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
>  obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
>  obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o diff --git 
> a/drivers/pci/controller/dwc/pci-layerscape-ep.c 
> b/drivers/pci/controller/dwc/pci-layerscape-ep.c
> new file mode 100644
> index 000..289618b
> --- /dev/null
> +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c
> @@ -0,0 +1,147 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * PCIe controller EP driver for Freescale Layerscape SoCs
> + *
> + * Copyright (C) 2018 NXP Semiconductor.
> + *
> + * Author: Xiaowei Bao   */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "pcie-designware.h"
> +
> +#define PCIE_DBI2_OFFSET 0x1000  /* DBI2 base address*/
> +
> +struct ls_pcie_ep {
> + struct dw_pcie  *pci;
> +};

I am not really sure why you need an additional struct.
[Xiaowei Bao] thanks a lot for your comments, I defined this structure in order 
to add NXP's new chip PCIe EP driver in the future, because other platforms may 
have some errata to be solved. The structure of defining an LX platform will be 
more flexible. I can use the driver of the DW platform directly. Just need to 
modify the DTS, but for the future development of all NXP platform EP drivers, 
thus adding a new file.

> +#define to_ls_pcie_ep(x) dev_get_drvdata((x)->dev)

Unused.

> +
> +static int ls_pcie_establish_link(struct dw_pcie *pci) {
> + return 0;
> +}
> +
> +static const struct dw_pcie_ops ls_pcie_ep_ops = {
> + .start_link = ls_pcie_establish_link, };
> +
> +static const struct of_device_id ls_pcie_ep_of_match[] = {
> + { .compatible = "fsl,ls-pcie-ep",},
> + { },
> +};
> +
> +static void ls_pcie_ep_init(struct dw_pcie_ep *ep) {
> + struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> + struct pci_epc *epc = ep->epc;
> + enum pci_barno bar;
> +
> + for (bar = BAR_0; bar <= BAR_5; bar++)
> + dw_pcie_ep_reset_bar(pci, bar);
> +
> + epc->features |= EPC_FEATURE_NO_LINKUP_NOTIFIER; }
> +
> +static int ls_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
> +   enum pci_epc_irq_type type, u16 
> interrupt_num) {
> + struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> +
> + switch (type) {
> + case PCI_EPC_IRQ_LEGACY:
> + return dw_pcie_ep_raise_legacy_irq(ep, func_no);
> + case PCI_EPC_IRQ_MSI:
> + return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
> + case PCI_EPC_IRQ_MSIX:
> + return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num);
> + default:
> + dev_err(pci->dev, "UNKNOWN IRQ type\n");
> + }
> +
> + return 0;

So if it falls through to the default, we log an error but return 0 ? This does 
not make much sense.

I know you probably copy/pasted code from DWC platform, that code must be fixed 
too I suppose.

Lorenzo
[Xiaowei Bao] Thanks a lot for your comments, I will send the v3 patch fix it.

> +}
> +
> +static struct dw_pcie_ep_ops pcie_ep_ops = {
> + .ep_init = ls_pcie_ep_init,
> + .raise_irq = ls_pcie_ep_raise_irq,
> +};
> +
> +static int __init ls_add_pcie_ep(struct ls_pcie_ep *pcie,
> + struct 

RE: [PATCHv2 5/6] pci: layerscape: Add the EP mode support.

2018-12-02 Thread Xiaowei Bao
Hi Lorenzo,

-Original Message-
From: Lorenzo Pieralisi  
Sent: 2018年12月1日 0:22
To: Xiaowei Bao 
Cc: bhelg...@google.com; robh...@kernel.org; mark.rutl...@arm.com; 
shawn...@kernel.org; Leo Li ; kis...@ti.com; a...@arndb.de; 
gre...@linuxfoundation.org; M.h. Lian ; Mingkai Hu 
; Roy Zang ; 
kstew...@linuxfoundation.org; cyrille.pitc...@free-electrons.com; 
pombreda...@nexb.com; shawn@rock-chips.com; niklas.cas...@axis.com; 
linux-...@vger.kernel.org; devicet...@vger.kernel.org; 
linux-kernel@vger.kernel.org; linux-arm-ker...@lists.infradead.org; 
linuxppc-...@lists.ozlabs.org
Subject: Re: [PATCHv2 5/6] pci: layerscape: Add the EP mode support.

On Mon, Nov 05, 2018 at 04:46:52PM +0800, Xiaowei Bao wrote:
> Add the PCIe EP mode support for layerscape platform.
> 
> Signed-off-by: Xiaowei Bao 
> ---
> v2:
>  - remove the EP mode check function.
> 
>  drivers/pci/controller/dwc/Makefile|2 +-
>  drivers/pci/controller/dwc/pci-layerscape-ep.c |  147 
> 
>  2 files changed, 148 insertions(+), 1 deletions(-)  create mode 
> 100644 drivers/pci/controller/dwc/pci-layerscape-ep.c
> 
> diff --git a/drivers/pci/controller/dwc/Makefile 
> b/drivers/pci/controller/dwc/Makefile
> index 5d2ce72..b26d617 100644
> --- a/drivers/pci/controller/dwc/Makefile
> +++ b/drivers/pci/controller/dwc/Makefile
> @@ -8,7 +8,7 @@ obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
>  obj-$(CONFIG_PCI_IMX6) += pci-imx6.o
>  obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
>  obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone-dw.o pci-keystone.o
> -obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
> +obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o pci-layerscape-ep.o
>  obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
>  obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
>  obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o diff --git 
> a/drivers/pci/controller/dwc/pci-layerscape-ep.c 
> b/drivers/pci/controller/dwc/pci-layerscape-ep.c
> new file mode 100644
> index 000..289618b
> --- /dev/null
> +++ b/drivers/pci/controller/dwc/pci-layerscape-ep.c
> @@ -0,0 +1,147 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * PCIe controller EP driver for Freescale Layerscape SoCs
> + *
> + * Copyright (C) 2018 NXP Semiconductor.
> + *
> + * Author: Xiaowei Bao   */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "pcie-designware.h"
> +
> +#define PCIE_DBI2_OFFSET 0x1000  /* DBI2 base address*/
> +
> +struct ls_pcie_ep {
> + struct dw_pcie  *pci;
> +};

I am not really sure why you need an additional struct.
[Xiaowei Bao] thanks a lot for your comments, I defined this structure in order 
to add NXP's new chip PCIe EP driver in the future, because other platforms may 
have some errata to be solved. The structure of defining an LX platform will be 
more flexible. I can use the driver of the DW platform directly. Just need to 
modify the DTS, but for the future development of all NXP platform EP drivers, 
thus adding a new file.

> +#define to_ls_pcie_ep(x) dev_get_drvdata((x)->dev)

Unused.

> +
> +static int ls_pcie_establish_link(struct dw_pcie *pci) {
> + return 0;
> +}
> +
> +static const struct dw_pcie_ops ls_pcie_ep_ops = {
> + .start_link = ls_pcie_establish_link, };
> +
> +static const struct of_device_id ls_pcie_ep_of_match[] = {
> + { .compatible = "fsl,ls-pcie-ep",},
> + { },
> +};
> +
> +static void ls_pcie_ep_init(struct dw_pcie_ep *ep) {
> + struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> + struct pci_epc *epc = ep->epc;
> + enum pci_barno bar;
> +
> + for (bar = BAR_0; bar <= BAR_5; bar++)
> + dw_pcie_ep_reset_bar(pci, bar);
> +
> + epc->features |= EPC_FEATURE_NO_LINKUP_NOTIFIER; }
> +
> +static int ls_pcie_ep_raise_irq(struct dw_pcie_ep *ep, u8 func_no,
> +   enum pci_epc_irq_type type, u16 
> interrupt_num) {
> + struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
> +
> + switch (type) {
> + case PCI_EPC_IRQ_LEGACY:
> + return dw_pcie_ep_raise_legacy_irq(ep, func_no);
> + case PCI_EPC_IRQ_MSI:
> + return dw_pcie_ep_raise_msi_irq(ep, func_no, interrupt_num);
> + case PCI_EPC_IRQ_MSIX:
> + return dw_pcie_ep_raise_msix_irq(ep, func_no, interrupt_num);
> + default:
> + dev_err(pci->dev, "UNKNOWN IRQ type\n");
> + }
> +
> + return 0;

So if it falls through to the default, we log an error but return 0 ? This does 
not make much sense.

I know you probably copy/pasted code from DWC platform, that code must be fixed 
too I suppose.

Lorenzo
[Xiaowei Bao] Thanks a lot for your comments, I will send the v3 patch fix it.

> +}
> +
> +static struct dw_pcie_ep_ops pcie_ep_ops = {
> + .ep_init = ls_pcie_ep_init,
> + .raise_irq = ls_pcie_ep_raise_irq,
> +};
> +
> +static int __init ls_add_pcie_ep(struct ls_pcie_ep *pcie,
> + struct 

<    1   2   3   4   5   6   7   >