Re: [PATCH] staging: rtlwifi: Use proper enum for return in halmac_parse_psd_data_88xx

2019-02-20 Thread Nicholas Mc Guire
On Wed, Feb 20, 2019 at 10:25:24PM -0700, Nathan Chancellor wrote:
> Clang warns:
> 
> drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c:2472:11:
> warning: implicit conversion from enumeration type 'enum
> halmac_cmd_process_status' to different enumeration type 'enum
> halmac_ret_status' [-Wenum-conversion]
> return HALMAC_CMD_PROCESS_ERROR;
> ~~ ^~~~
> 1 warning generated.
> 
yup - my bad I somehow managed to end up in halmac_cmd_process_status
rather than halmac_ret_status - HALMAC_RET_MALLOC_FAIL makes sense here.

interesting that gcc did not fuss at this.

thx!
hofrat

> Fix this by using the proper enum for allocation failures,
> HALMAC_RET_MALLOC_FAIL, which is used in the rest of this file.
> 
> Fixes: e4b08e16b7d9 ("staging: r8822be: check kzalloc return or bail")
> Link: https://github.com/ClangBuiltLinux/linux/issues/375
> Signed-off-by: Nathan Chancellor 

Reviewed-by: Nicholas Mc Guire 

> ---
>  drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c 
> b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c
> index ec742da030db..ddbeff8224ab 100644
> --- a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c
> +++ b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c
> @@ -2469,7 +2469,7 @@ halmac_parse_psd_data_88xx(struct halmac_adapter 
> *halmac_adapter, u8 *c2h_buf,
>   if (!psd_set->data) {
>   psd_set->data = kzalloc(psd_set->data_size, GFP_KERNEL);
>   if (!psd_set->data)
> - return HALMAC_CMD_PROCESS_ERROR;
> + return HALMAC_RET_MALLOC_FAIL;
>   }
>  
>   if (segment_id == 0)
> -- 
> 2.21.0.rc1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtlwifi: Use proper enum for return in halmac_parse_psd_data_88xx

2019-02-20 Thread Nathan Chancellor
Clang warns:

drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c:2472:11:
warning: implicit conversion from enumeration type 'enum
halmac_cmd_process_status' to different enumeration type 'enum
halmac_ret_status' [-Wenum-conversion]
return HALMAC_CMD_PROCESS_ERROR;
~~ ^~~~
1 warning generated.

Fix this by using the proper enum for allocation failures,
HALMAC_RET_MALLOC_FAIL, which is used in the rest of this file.

Fixes: e4b08e16b7d9 ("staging: r8822be: check kzalloc return or bail")
Link: https://github.com/ClangBuiltLinux/linux/issues/375
Signed-off-by: Nathan Chancellor 
---
 drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c 
b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c
index ec742da030db..ddbeff8224ab 100644
--- a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c
+++ b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c
@@ -2469,7 +2469,7 @@ halmac_parse_psd_data_88xx(struct halmac_adapter 
*halmac_adapter, u8 *c2h_buf,
if (!psd_set->data) {
psd_set->data = kzalloc(psd_set->data_size, GFP_KERNEL);
if (!psd_set->data)
-   return HALMAC_CMD_PROCESS_ERROR;
+   return HALMAC_RET_MALLOC_FAIL;
}
 
if (segment_id == 0)
-- 
2.21.0.rc1

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


Re: [RESEND PATCH 3/7] mm/gup: Change GUP fast to use flags rather than a write 'bool'

2019-02-20 Thread Souptick Joarder
Hi Ira,

On Wed, Feb 20, 2019 at 11:01 AM  wrote:
>
> From: Ira Weiny 
>
> To facilitate additional options to get_user_pages_fast() change the
> singular write parameter to be gup_flags.
>
> This patch does not change any functionality.  New functionality will
> follow in subsequent patches.
>
> Some of the get_user_pages_fast() call sites were unchanged because they
> already passed FOLL_WRITE or 0 for the write parameter.
>
> Signed-off-by: Ira Weiny 
> ---
>  arch/mips/mm/gup.c | 11 ++-
>  arch/powerpc/kvm/book3s_64_mmu_hv.c|  4 ++--
>  arch/powerpc/kvm/e500_mmu.c|  2 +-
>  arch/powerpc/mm/mmu_context_iommu.c|  4 ++--
>  arch/s390/kvm/interrupt.c  |  2 +-
>  arch/s390/mm/gup.c | 12 ++--
>  arch/sh/mm/gup.c   | 11 ++-
>  arch/sparc/mm/gup.c|  9 +
>  arch/x86/kvm/paging_tmpl.h |  2 +-
>  arch/x86/kvm/svm.c |  2 +-
>  drivers/fpga/dfl-afu-dma-region.c  |  2 +-
>  drivers/gpu/drm/via/via_dmablit.c  |  3 ++-
>  drivers/infiniband/hw/hfi1/user_pages.c|  3 ++-
>  drivers/misc/genwqe/card_utils.c   |  2 +-
>  drivers/misc/vmw_vmci/vmci_host.c  |  2 +-
>  drivers/misc/vmw_vmci/vmci_queue_pair.c|  6 --
>  drivers/platform/goldfish/goldfish_pipe.c  |  3 ++-
>  drivers/rapidio/devices/rio_mport_cdev.c   |  4 +++-
>  drivers/sbus/char/oradax.c |  2 +-
>  drivers/scsi/st.c  |  3 ++-
>  drivers/staging/gasket/gasket_page_table.c |  4 ++--
>  drivers/tee/tee_shm.c  |  2 +-
>  drivers/vfio/vfio_iommu_spapr_tce.c|  3 ++-
>  drivers/vhost/vhost.c  |  2 +-
>  drivers/video/fbdev/pvr2fb.c   |  2 +-
>  drivers/virt/fsl_hypervisor.c  |  2 +-
>  drivers/xen/gntdev.c   |  2 +-
>  fs/orangefs/orangefs-bufmap.c  |  2 +-
>  include/linux/mm.h |  4 ++--
>  kernel/futex.c |  2 +-
>  lib/iov_iter.c |  7 +--
>  mm/gup.c   | 10 +-
>  mm/util.c  |  8 
>  net/ceph/pagevec.c |  2 +-
>  net/rds/info.c |  2 +-
>  net/rds/rdma.c |  3 ++-
>  36 files changed, 81 insertions(+), 65 deletions(-)
>
> diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c
> index 0d14e0d8eacf..4c2b4483683c 100644
> --- a/arch/mips/mm/gup.c
> +++ b/arch/mips/mm/gup.c
> @@ -235,7 +235,7 @@ int __get_user_pages_fast(unsigned long start, int 
> nr_pages, int write,
>   * get_user_pages_fast() - pin user pages in memory
>   * @start: starting user address
>   * @nr_pages:  number of pages from start to pin
> - * @write: whether pages will be written to
> + * @gup_flags: flags modifying pin behaviour
>   * @pages: array that receives pointers to the pages pinned.
>   * Should be at least nr_pages long.
>   *
> @@ -247,8 +247,8 @@ int __get_user_pages_fast(unsigned long start, int 
> nr_pages, int write,
>   * requested. If nr_pages is 0 or negative, returns 0. If no pages
>   * were pinned, returns -errno.
>   */
> -int get_user_pages_fast(unsigned long start, int nr_pages, int write,
> -   struct page **pages)
> +int get_user_pages_fast(unsigned long start, int nr_pages,
> +   unsigned int gup_flags, struct page **pages)
>  {
> struct mm_struct *mm = current->mm;
> unsigned long addr, len, end;
> @@ -273,7 +273,8 @@ int get_user_pages_fast(unsigned long start, int 
> nr_pages, int write,
> next = pgd_addr_end(addr, end);
> if (pgd_none(pgd))
> goto slow;
> -   if (!gup_pud_range(pgd, addr, next, write, pages, ))
> +   if (!gup_pud_range(pgd, addr, next, gup_flags & FOLL_WRITE,
> +  pages, ))
> goto slow;
> } while (pgdp++, addr = next, addr != end);
> local_irq_enable();
> @@ -289,7 +290,7 @@ int get_user_pages_fast(unsigned long start, int 
> nr_pages, int write,
> pages += nr;
>
> ret = get_user_pages_unlocked(start, (end - start) >> PAGE_SHIFT,
> - pages, write ? FOLL_WRITE : 0);
> + pages, gup_flags);
>
> /* Have to be a bit careful with return values */
> if (nr > 0) {
> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c 
> b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> index bd2dcfbf00cd..8fcb0a921e46 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> @@ -582,7 +582,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, 
> struct kvm_vcpu *vcpu,
> /* 

[PATCH 1/2] staging: erofs: no need to take page lock in readdir

2019-02-20 Thread Gao Xiang
VFS will take inode_lock for readdir, therefore no need to
take page lock in readdir at all just as the majority of
other generic filesystems.

Signed-off-by: Gao Xiang 
---
 drivers/staging/erofs/dir.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
index e1955703ab8f..8f8ac9675921 100644
--- a/drivers/staging/erofs/dir.c
+++ b/drivers/staging/erofs/dir.c
@@ -98,7 +98,6 @@ static int erofs_readdir(struct file *f, struct dir_context 
*ctx)
if (IS_ERR(dentry_page))
continue;
 
-   lock_page(dentry_page);
de = (struct erofs_dirent *)kmap(dentry_page);
 
nameoff = le16_to_cpu(de->nameoff);
@@ -128,7 +127,6 @@ static int erofs_readdir(struct file *f, struct dir_context 
*ctx)
 skip_this:
kunmap(dentry_page);
 
-   unlock_page(dentry_page);
put_page(dentry_page);
 
ctx->pos = blknr_to_addr(i) + ofs;
-- 
2.14.4

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


[PATCH 2/2] staging: erofs: switch to ->iterate_shared()

2019-02-20 Thread Gao Xiang
After commit 6192269444eb ("introduce a parallel variant of ->iterate()"),
readdir can be done without taking exclusive inode lock of course.

Signed-off-by: Gao Xiang 
---
 drivers/staging/erofs/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/erofs/dir.c b/drivers/staging/erofs/dir.c
index 8f8ac9675921..829f7b12e0dc 100644
--- a/drivers/staging/erofs/dir.c
+++ b/drivers/staging/erofs/dir.c
@@ -142,6 +142,6 @@ static int erofs_readdir(struct file *f, struct dir_context 
*ctx)
 const struct file_operations erofs_dir_fops = {
.llseek = generic_file_llseek,
.read   = generic_read_dir,
-   .iterate= erofs_readdir,
+   .iterate_shared = erofs_readdir,
 };
 
-- 
2.14.4

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


[PATCH net-next v3 7/8] net: Remove SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT

2019-02-20 Thread Florian Fainelli
Now that we have converted the bridge code and the drivers to check for
bridge port(s) flags at the time we try to set them, there is no need
for a get() -> set() sequence anymore and
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT therefore becomes unused.

Reviewed-by: Ido Schimmel 
Signed-off-by: Florian Fainelli 
---
 Documentation/networking/switchdev.txt   |  6 ++
 .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 11 +--
 drivers/net/ethernet/rocker/rocker_main.c| 14 +-
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c  | 10 +-
 include/net/switchdev.h  |  2 --
 net/dsa/slave.c  | 16 +---
 6 files changed, 6 insertions(+), 53 deletions(-)

diff --git a/Documentation/networking/switchdev.txt 
b/Documentation/networking/switchdev.txt
index f3244d87512a..79c8b0f16aee 100644
--- a/Documentation/networking/switchdev.txt
+++ b/Documentation/networking/switchdev.txt
@@ -232,10 +232,8 @@ Learning_sync attribute enables syncing of the 
learned/forgotten FDB entry to
 the bridge's FDB.  It's possible, but not optimal, to enable learning on the
 device port and on the bridge port, and disable learning_sync.
 
-To support learning and learning_sync port attributes, the driver implements
-switchdev op switchdev_port_attr_get/set for
-SWITCHDEV_ATTR_PORT_ID_BRIDGE_FLAGS. The driver should initialize the 
attributes
-to the hardware defaults.
+To support learning, the driver implements switchdev op
+switchdev_port_attr_get/set for SWITCHDEV_ATTR_PORT_ID_BRIDGE_FLAGS.
 
 FDB Ageing
 ^^
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 9a8798f74d2b..bbb5a406232e 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -434,16 +434,7 @@ static void mlxsw_sp_bridge_vlan_put(struct 
mlxsw_sp_bridge_vlan *bridge_vlan)
 static int mlxsw_sp_port_attr_get(struct net_device *dev,
  struct switchdev_attr *attr)
 {
-   switch (attr->id) {
-   case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
-   attr->u.brport_flags_support = BR_LEARNING | BR_FLOOD |
-  BR_MCAST_FLOOD;
-   break;
-   default:
-   return -EOPNOTSUPP;
-   }
-
-   return 0;
+   return -EOPNOTSUPP;
 }
 
 static int
diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index 25129f7b5583..6b8273e2057d 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2069,19 +2069,7 @@ static const struct net_device_ops 
rocker_port_netdev_ops = {
 static int rocker_port_attr_get(struct net_device *dev,
struct switchdev_attr *attr)
 {
-   const struct rocker_port *rocker_port = netdev_priv(dev);
-   int err = 0;
-
-   switch (attr->id) {
-   case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
-   err = 
rocker_world_port_attr_bridge_flags_support_get(rocker_port,
- 
>u.brport_flags_support);
-   break;
-   default:
-   return -EOPNOTSUPP;
-   }
-
-   return err;
+   return -EOPNOTSUPP;
 }
 
 static int rocker_port_attr_set(struct net_device *dev,
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 331625137717..de4dcabbc29a 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -643,15 +643,7 @@ static void ethsw_teardown_irqs(struct fsl_mc_device 
*sw_dev)
 static int swdev_port_attr_get(struct net_device *netdev,
   struct switchdev_attr *attr)
 {
-   switch (attr->id) {
-   case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
-   attr->u.brport_flags_support = BR_LEARNING | BR_FLOOD;
-   break;
-   default:
-   return -EOPNOTSUPP;
-   }
-
-   return 0;
+   return -EOPNOTSUPP;
 }
 
 static int port_attr_stp_state_set(struct net_device *netdev,
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index de72b0a3867f..0f352019ef99 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -45,7 +45,6 @@ enum switchdev_attr_id {
SWITCHDEV_ATTR_ID_UNDEFINED,
SWITCHDEV_ATTR_ID_PORT_STP_STATE,
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
-   SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS,
SWITCHDEV_ATTR_ID_PORT_MROUTER,
SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
@@ -63,7 +62,6 @@ struct switchdev_attr {
union {
u8 stp_state;   /* PORT_STP_STATE */
unsigned long 

[PATCH net-next v3 8/8] net: Get rid of switchdev_port_attr_get()

2019-02-20 Thread Florian Fainelli
With the bridge no longer calling switchdev_port_attr_get() to obtain
the supported bridge port flags from a driver but instead trying to set
the bridge port flags directly and relying on driver to reject
unsupported configurations, we can effectively get rid of
switchdev_port_attr_get() entirely since this was the only place where
it was called.

Signed-off-by: Florian Fainelli 
---
 Documentation/networking/switchdev.txt   | 2 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 7 ---
 drivers/net/ethernet/rocker/rocker_main.c| 7 ---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c  | 7 ---
 include/net/switchdev.h  | 8 
 net/dsa/slave.c  | 7 ---
 6 files changed, 1 insertion(+), 37 deletions(-)

diff --git a/Documentation/networking/switchdev.txt 
b/Documentation/networking/switchdev.txt
index 79c8b0f16aee..413abbae952f 100644
--- a/Documentation/networking/switchdev.txt
+++ b/Documentation/networking/switchdev.txt
@@ -233,7 +233,7 @@ the bridge's FDB.  It's possible, but not optimal, to 
enable learning on the
 device port and on the bridge port, and disable learning_sync.
 
 To support learning, the driver implements switchdev op
-switchdev_port_attr_get/set for SWITCHDEV_ATTR_PORT_ID_BRIDGE_FLAGS.
+switchdev_port_attr_set for SWITCHDEV_ATTR_PORT_ID_{PRE}_BRIDGE_FLAGS.
 
 FDB Ageing
 ^^
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index bbb5a406232e..766f5b5f1cf5 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -431,12 +431,6 @@ static void mlxsw_sp_bridge_vlan_put(struct 
mlxsw_sp_bridge_vlan *bridge_vlan)
mlxsw_sp_bridge_vlan_destroy(bridge_vlan);
 }
 
-static int mlxsw_sp_port_attr_get(struct net_device *dev,
- struct switchdev_attr *attr)
-{
-   return -EOPNOTSUPP;
-}
-
 static int
 mlxsw_sp_port_bridge_vlan_stp_set(struct mlxsw_sp_port *mlxsw_sp_port,
  struct mlxsw_sp_bridge_vlan *bridge_vlan,
@@ -1945,7 +1939,6 @@ static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct 
mlxsw_sp *mlxsw_sp,
 }
 
 static const struct switchdev_ops mlxsw_sp_port_switchdev_ops = {
-   .switchdev_port_attr_get= mlxsw_sp_port_attr_get,
.switchdev_port_attr_set= mlxsw_sp_port_attr_set,
 };
 
diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index 6b8273e2057d..8200fbf91306 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2066,12 +2066,6 @@ static const struct net_device_ops 
rocker_port_netdev_ops = {
  * swdev interface
  /
 
-static int rocker_port_attr_get(struct net_device *dev,
-   struct switchdev_attr *attr)
-{
-   return -EOPNOTSUPP;
-}
-
 static int rocker_port_attr_set(struct net_device *dev,
const struct switchdev_attr *attr,
struct switchdev_trans *trans)
@@ -2148,7 +2142,6 @@ static int rocker_port_obj_del(struct net_device *dev,
 }
 
 static const struct switchdev_ops rocker_port_switchdev_ops = {
-   .switchdev_port_attr_get= rocker_port_attr_get,
.switchdev_port_attr_set= rocker_port_attr_set,
 };
 
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index de4dcabbc29a..018399ee8731 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -640,12 +640,6 @@ static void ethsw_teardown_irqs(struct fsl_mc_device 
*sw_dev)
fsl_mc_free_irqs(sw_dev);
 }
 
-static int swdev_port_attr_get(struct net_device *netdev,
-  struct switchdev_attr *attr)
-{
-   return -EOPNOTSUPP;
-}
-
 static int port_attr_stp_state_set(struct net_device *netdev,
   struct switchdev_trans *trans,
   u8 state)
@@ -932,7 +926,6 @@ static int swdev_port_obj_del(struct net_device *netdev,
 }
 
 static const struct switchdev_ops ethsw_port_switchdev_ops = {
-   .switchdev_port_attr_get= swdev_port_attr_get,
.switchdev_port_attr_set= swdev_port_attr_set,
 };
 
diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 0f352019ef99..45310ddf2d7e 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -179,8 +179,6 @@ switchdev_notifier_info_to_extack(const struct 
switchdev_notifier_info *info)
 #ifdef CONFIG_NET_SWITCHDEV
 
 void switchdev_deferred_process(void);
-int switchdev_port_attr_get(struct net_device *dev,
-   struct switchdev_attr *attr);
 int switchdev_port_attr_set(struct net_device 

[PATCH net-next v3 6/8] net: bridge: Stop calling switchdev_port_attr_get()

2019-02-20 Thread Florian Fainelli
Now that all switchdev drivers have been converted to check the
SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS flags and report flags that they
do not support accordingly, we can migrate the bridge code to try to set
that attribute first, check the results and then do the actual setting.

Signed-off-by: Florian Fainelli 
---
 net/bridge/br_switchdev.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index db9e8ab96d48..af57c4a2b78a 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -64,21 +64,19 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p,
 {
struct switchdev_attr attr = {
.orig_dev = p->dev,
-   .id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
+   .id = SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS,
+   .u.brport_flags = mask,
};
int err;
 
if (mask & ~BR_PORT_FLAGS_HW_OFFLOAD)
return 0;
 
-   err = switchdev_port_attr_get(p->dev, );
+   err = switchdev_port_attr_set(p->dev, );
if (err == -EOPNOTSUPP)
return 0;
-   if (err)
-   return err;
 
-   /* Check if specific bridge flag attribute offload is supported */
-   if (!(attr.u.brport_flags_support & mask)) {
+   if (err) {
br_warn(p->br, "bridge flag offload is not supported %u(%s)\n",
(unsigned int)p->port_no, p->dev->name);
return -EOPNOTSUPP;
@@ -87,6 +85,7 @@ int br_switchdev_set_port_flag(struct net_bridge_port *p,
attr.id = SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS;
attr.flags = SWITCHDEV_F_DEFER;
attr.u.brport_flags = flags;
+
err = switchdev_port_attr_set(p->dev, );
if (err) {
br_warn(p->br, "error setting offload flag on port %u(%s)\n",
-- 
2.17.1

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


[PATCH net-next v3 5/8] rocker: Check Handle PORT_PRE_BRIDGE_FLAGS

2019-02-20 Thread Florian Fainelli
In preparation for getting rid of switchdev_port_attr_get(), have rocker
check for the bridge flags being set through switchdev_port_attr_set()
with the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute identifier.

Signed-off-by: Florian Fainelli 
---
 drivers/net/ethernet/rocker/rocker_main.c | 55 +--
 1 file changed, 41 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c 
b/drivers/net/ethernet/rocker/rocker_main.c
index 5ce8d5aba603..25129f7b5583 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -1566,34 +1566,57 @@ static int rocker_world_port_attr_stp_state_set(struct 
rocker_port *rocker_port,
 }
 
 static int
-rocker_world_port_attr_bridge_flags_set(struct rocker_port *rocker_port,
-   unsigned long brport_flags,
-   struct switchdev_trans *trans)
+rocker_world_port_attr_bridge_flags_support_get(const struct rocker_port *
+   rocker_port,
+   unsigned long *
+   p_brport_flags_support)
 {
struct rocker_world_ops *wops = rocker_port->rocker->wops;
 
+   if (!wops->port_attr_bridge_flags_support_get)
+   return -EOPNOTSUPP;
+   return wops->port_attr_bridge_flags_support_get(rocker_port,
+   p_brport_flags_support);
+}
+
+static int
+rocker_world_port_attr_pre_bridge_flags_set(struct rocker_port *rocker_port,
+   unsigned long brport_flags,
+   struct switchdev_trans *trans)
+{
+   struct rocker_world_ops *wops = rocker_port->rocker->wops;
+   unsigned long brport_flags_s;
+   int err;
+
if (!wops->port_attr_bridge_flags_set)
return -EOPNOTSUPP;
 
-   if (switchdev_trans_ph_prepare(trans))
-   return 0;
+   err = rocker_world_port_attr_bridge_flags_support_get(rocker_port,
+ _flags_s);
+   if (err)
+   return err;
 
-   return wops->port_attr_bridge_flags_set(rocker_port, brport_flags,
-   trans);
+   if (brport_flags & ~brport_flags_s)
+   return -EINVAL;
+
+   return 0;
 }
 
 static int
-rocker_world_port_attr_bridge_flags_support_get(const struct rocker_port *
-   rocker_port,
-   unsigned long *
-   p_brport_flags_support)
+rocker_world_port_attr_bridge_flags_set(struct rocker_port *rocker_port,
+   unsigned long brport_flags,
+   struct switchdev_trans *trans)
 {
struct rocker_world_ops *wops = rocker_port->rocker->wops;
 
-   if (!wops->port_attr_bridge_flags_support_get)
+   if (!wops->port_attr_bridge_flags_set)
return -EOPNOTSUPP;
-   return wops->port_attr_bridge_flags_support_get(rocker_port,
-   p_brport_flags_support);
+
+   if (switchdev_trans_ph_prepare(trans))
+   return 0;
+
+   return wops->port_attr_bridge_flags_set(rocker_port, brport_flags,
+   trans);
 }
 
 static int
@@ -2074,6 +2097,10 @@ static int rocker_port_attr_set(struct net_device *dev,
   attr->u.stp_state,
   trans);
break;
+   case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
+   err = rocker_world_port_attr_pre_bridge_flags_set(rocker_port,
+ 
attr->u.brport_flags,
+ trans);
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
err = rocker_world_port_attr_bridge_flags_set(rocker_port,
  
attr->u.brport_flags,
-- 
2.17.1

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


[PATCH net-next v3 3/8] staging: fsl-dpaa2: ethsw: Handle PORT_PRE_BRIDGE_FLAGS

2019-02-20 Thread Florian Fainelli
In preparation for removing SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
handle the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute and check
that the bridge port flags being configured are supported.

Signed-off-by: Florian Fainelli 
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 1b3943b71254..331625137717 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -666,6 +666,16 @@ static int port_attr_stp_state_set(struct net_device 
*netdev,
return ethsw_port_set_stp_state(port_priv, state);
 }
 
+static int port_attr_br_flags_pre_set(struct net_device *netdev,
+ struct switchdev_trans *trans,
+ unsigned long flags)
+{
+   if (flags & ~(BR_LEARNING | BR_FLOOD))
+   return -EINVAL;
+
+   return 0;
+}
+
 static int port_attr_br_flags_set(struct net_device *netdev,
  struct switchdev_trans *trans,
  unsigned long flags)
@@ -698,6 +708,10 @@ static int swdev_port_attr_set(struct net_device *netdev,
err = port_attr_stp_state_set(netdev, trans,
  attr->u.stp_state);
break;
+   case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
+   err = port_attr_br_flags_pre_set(netdev, trans,
+attr->u.brport_flags);
+   break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
err = port_attr_br_flags_set(netdev, trans,
 attr->u.brport_flags);
-- 
2.17.1

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


[PATCH net-next v3 0/8] net: Get rid of switchdev_port_attr_get()

2019-02-20 Thread Florian Fainelli
Hi all,

This patch series splits the removal of the switchdev_ops that was
proposed a few times before and first tackles the easy part which is the
removal of the single call to switchdev_port_attr_get() within the
bridge code.

As suggestd by Ido, this patch series adds a
SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS which is used in the same
context as the caller of switchdev_port_attr_set(), so not deferred, and
then the operation is carried out in deferred context with setting a
support bridge port flag.

Follow-up patches will do the switchdev_ops removal after introducing
the proper helpers for the switchdev blocking notifier to work across
stacked devices (unlike the previous submissions).

David this does depend on Russell's "[PATCH net-next v5 0/3] net: dsa:
mv88e6xxx: fix IPv6".

Changes in v3:

- rebased against net-next/master after Russell's IPv6 changes to DSA
- ignore prepare/commit phase for PRE_BRIDGE_FLAGS since we don't
  want to trigger the WARN() in net/switchdev/switchdev.c in the commit
  phase

Changes in v2:

- differentiate callers not supporting switchdev_port_attr_set() from
  the driver not being able to support specific bridge flags

- pass "mask" instead of "flags" for the PRE_BRIDGE_FLAGS check

- skip prepare phase for PRE_BRIDGE_FLAGS

- corrected documentation a bit more

- tested bridge_vlan_aware.sh with veth/VRF

Florian Fainelli (8):
  net: switchdev: Add PORT_PRE_BRIDGE_FLAGS
  mlxsw: spectrum: Handle PORT_PRE_BRIDGE_FLAGS
  staging: fsl-dpaa2: ethsw: Handle PORT_PRE_BRIDGE_FLAGS
  net: dsa: Add setter for SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS
  rocker: Check Handle PORT_PRE_BRIDGE_FLAGS
  net: bridge: Stop calling switchdev_port_attr_get()
  net: Remove SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT
  net: Get rid of switchdev_port_attr_get()

 Documentation/networking/switchdev.txt|  6 +-
 .../mellanox/mlxsw/spectrum_switchdev.c   | 32 
 drivers/net/ethernet/rocker/rocker_main.c | 74 ++-
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c   | 29 
 include/net/switchdev.h   | 13 +---
 net/bridge/br_switchdev.c | 11 ++-
 net/dsa/dsa_priv.h|  2 +
 net/dsa/port.c| 12 +++
 net/dsa/slave.c   | 25 +--
 9 files changed, 98 insertions(+), 106 deletions(-)

-- 
2.17.1

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


[PATCH net-next v3 2/8] mlxsw: spectrum: Handle PORT_PRE_BRIDGE_FLAGS

2019-02-20 Thread Florian Fainelli
In preparation for getting rid of switchdev_port_attr_get(), have mlxsw
check for the bridge flags being set through switchdev_port_attr_set()
when the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute identifier is
used.

Signed-off-by: Florian Fainelli 
---
 .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c 
b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index 1f492b7dbea8..9a8798f74d2b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -595,6 +595,17 @@ mlxsw_sp_bridge_port_learning_set(struct mlxsw_sp_port 
*mlxsw_sp_port,
return err;
 }
 
+static int mlxsw_sp_port_attr_br_pre_flags_set(struct mlxsw_sp_port
+  *mlxsw_sp_port,
+  struct switchdev_trans *trans,
+  unsigned long brport_flags)
+{
+   if (brport_flags & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD))
+   return -EINVAL;
+
+   return 0;
+}
+
 static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
   struct switchdev_trans *trans,
   struct net_device *orig_dev,
@@ -841,6 +852,11 @@ static int mlxsw_sp_port_attr_set(struct net_device *dev,
   attr->orig_dev,
   attr->u.stp_state);
break;
+   case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
+   err = mlxsw_sp_port_attr_br_pre_flags_set(mlxsw_sp_port,
+ trans,
+ attr->u.brport_flags);
+   break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
err = mlxsw_sp_port_attr_br_flags_set(mlxsw_sp_port, trans,
  attr->orig_dev,
-- 
2.17.1

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


[PATCH net-next v3 1/8] net: switchdev: Add PORT_PRE_BRIDGE_FLAGS

2019-02-20 Thread Florian Fainelli
In preparation for removing switchdev_port_attr_get(), introduce
PORT_PRE_BRIDGE_FLAGS which will be called through
switchdev_port_attr_set(), in the caller's context (possibly atomic) and
which must be checked by the switchdev driver in order to return whether
the operation is supported or not.

This is entirely analoguous to how the BRIDGE_FLAGS_SUPPORT works,
except it goes through a set() instead of get().

Signed-off-by: Florian Fainelli 
---
 include/net/switchdev.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 5e87b54c5dc5..de72b0a3867f 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -46,6 +46,7 @@ enum switchdev_attr_id {
SWITCHDEV_ATTR_ID_PORT_STP_STATE,
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
+   SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS,
SWITCHDEV_ATTR_ID_PORT_MROUTER,
SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME,
SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING,
@@ -61,7 +62,7 @@ struct switchdev_attr {
void (*complete)(struct net_device *dev, int err, void *priv);
union {
u8 stp_state;   /* PORT_STP_STATE */
-   unsigned long brport_flags; /* PORT_BRIDGE_FLAGS */
+   unsigned long brport_flags; /* 
PORT_{PRE}_BRIDGE_FLAGS */
unsigned long brport_flags_support; /* 
PORT_BRIDGE_FLAGS_SUPPORT */
bool mrouter;   /* PORT_MROUTER */
clock_t ageing_time;/* BRIDGE_AGEING_TIME */
-- 
2.17.1

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


[PATCH net-next v3 4/8] net: dsa: Add setter for SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS

2019-02-20 Thread Florian Fainelli
In preparation for removing SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
add support for a function that processes the
SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS and
SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attributes and returns not
supported for any flag set, since DSA does not currently support
toggling those bridge port attributes (yet).

Signed-off-by: Florian Fainelli 
---
 net/dsa/dsa_priv.h |  2 ++
 net/dsa/port.c | 12 
 net/dsa/slave.c|  4 
 3 files changed, 18 insertions(+)

diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h
index f4f99ec29f5d..47a1d1379d15 100644
--- a/net/dsa/dsa_priv.h
+++ b/net/dsa/dsa_priv.h
@@ -160,6 +160,8 @@ int dsa_port_mdb_add(const struct dsa_port *dp,
 struct switchdev_trans *trans);
 int dsa_port_mdb_del(const struct dsa_port *dp,
 const struct switchdev_obj_port_mdb *mdb);
+int dsa_port_pre_bridge_flags(const struct dsa_port *dp, unsigned long flags,
+ struct switchdev_trans *trans);
 int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
  struct switchdev_trans *trans);
 int dsa_port_vlan_add(struct dsa_port *dp,
diff --git a/net/dsa/port.c b/net/dsa/port.c
index 7bc2a5ad95c6..e9b5b50f8cf1 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -187,6 +187,18 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t 
ageing_clock,
return dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, );
 }
 
+int dsa_port_pre_bridge_flags(const struct dsa_port *dp, unsigned long flags,
+ struct switchdev_trans *trans)
+{
+   struct dsa_switch *ds = dp->ds;
+
+   if (!ds->ops->port_egress_floods ||
+   (flags & ~(BR_FLOOD | BR_MCAST_FLOOD)))
+   return -EINVAL;
+
+   return 0;
+}
+
 int dsa_port_bridge_flags(const struct dsa_port *dp, unsigned long flags,
  struct switchdev_trans *trans)
 {
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 85dc68611002..44cc4e50dd5a 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -295,6 +295,10 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
ret = dsa_port_ageing_time(dp, attr->u.ageing_time, trans);
break;
+   case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
+   ret = dsa_port_pre_bridge_flags(dp, attr->u.brport_flags,
+   trans);
+   break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, trans);
break;
-- 
2.17.1

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


[PATCH v2 4/4] media: imx: Don't register IPU subdevs/links if CSI port missing

2019-02-20 Thread Steve Longerbeam
The second IPU internal sub-devices were being registered and links
to them created even when the second IPU is not present. This is wrong
for i.MX6 S/DL and i.MX53 which have only a single IPU.

Fixes: e130291212df5 ("[media] media: Add i.MX media core driver")

Signed-off-by: Steve Longerbeam 
Reviewed-by: Philipp Zabel 
Cc: sta...@vger.kernel.org
---
 drivers/staging/media/imx/imx-media-dev.c |  7 ---
 .../staging/media/imx/imx-media-internal-sd.c | 22 ++-
 drivers/staging/media/imx/imx-media-of.c  | 58 +--
 drivers/staging/media/imx/imx-media.h |  3 +-
 drivers/staging/media/imx/imx7-media-csi.c|  2 +-
 5 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-dev.c 
b/drivers/staging/media/imx/imx-media-dev.c
index fc35508d9396..10a63a4fa90b 100644
--- a/drivers/staging/media/imx/imx-media-dev.c
+++ b/drivers/staging/media/imx/imx-media-dev.c
@@ -477,13 +477,6 @@ static int imx_media_probe(struct platform_device *pdev)
goto cleanup;
}
 
-   ret = imx_media_add_ipu_internal_subdevs(imxmd);
-   if (ret) {
-   v4l2_err(>v4l2_dev,
-"add_ipu_internal_subdevs failed with %d\n", ret);
-   goto cleanup;
-   }
-
ret = imx_media_dev_notifier_register(imxmd);
if (ret)
goto del_int;
diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c 
b/drivers/staging/media/imx/imx-media-internal-sd.c
index e620f4adb755..dc510dcfe160 100644
--- a/drivers/staging/media/imx/imx-media-internal-sd.c
+++ b/drivers/staging/media/imx/imx-media-internal-sd.c
@@ -298,13 +298,14 @@ static int add_internal_subdev(struct imx_media_dev 
*imxmd,
 }
 
 /* adds the internal subdevs in one ipu */
-static int add_ipu_internal_subdevs(struct imx_media_dev *imxmd, int ipu_id)
+int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd,
+  int ipu_id)
 {
enum isd_enum i;
+   int ret;
 
for (i = 0; i < num_isd; i++) {
const struct internal_subdev *isd = _subdev[i];
-   int ret;
 
/*
 * the CSIs are represented in the device-tree, so those
@@ -322,25 +323,10 @@ static int add_ipu_internal_subdevs(struct imx_media_dev 
*imxmd, int ipu_id)
}
 
if (ret)
-   return ret;
+   goto remove;
}
 
return 0;
-}
-
-int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd)
-{
-   int ret;
-
-   ret = add_ipu_internal_subdevs(imxmd, 0);
-   if (ret)
-   goto remove;
-
-   ret = add_ipu_internal_subdevs(imxmd, 1);
-   if (ret)
-   goto remove;
-
-   return 0;
 
 remove:
imx_media_remove_ipu_internal_subdevs(imxmd);
diff --git a/drivers/staging/media/imx/imx-media-of.c 
b/drivers/staging/media/imx/imx-media-of.c
index a26bdeb1af34..12383f4785ad 100644
--- a/drivers/staging/media/imx/imx-media-of.c
+++ b/drivers/staging/media/imx/imx-media-of.c
@@ -23,36 +23,25 @@
 int imx_media_of_add_csi(struct imx_media_dev *imxmd,
 struct device_node *csi_np)
 {
-   int ret;
-
if (!of_device_is_available(csi_np)) {
dev_dbg(imxmd->md.dev, "%s: %pOFn not enabled\n", __func__,
csi_np);
-   /* unavailable is not an error */
-   return 0;
+   return -ENODEV;
}
 
/* add CSI fwnode to async notifier */
-   ret = imx_media_add_async_subdev(imxmd, of_fwnode_handle(csi_np), NULL);
-   if (ret) {
-   if (ret == -EEXIST) {
-   /* already added, everything is fine */
-   return 0;
-   }
-
-   /* other error, can't continue */
-   return ret;
-   }
-
-   return 0;
+   return imx_media_add_async_subdev(imxmd, of_fwnode_handle(csi_np),
+ NULL);
 }
 EXPORT_SYMBOL_GPL(imx_media_of_add_csi);
 
 int imx_media_add_of_subdevs(struct imx_media_dev *imxmd,
 struct device_node *np)
 {
+   bool ipu_found[2] = {false, false};
struct device_node *csi_np;
int i, ret;
+   u32 ipu_id;
 
for (i = 0; ; i++) {
csi_np = of_parse_phandle(np, "ports", i);
@@ -60,12 +49,43 @@ int imx_media_add_of_subdevs(struct imx_media_dev *imxmd,
break;
 
ret = imx_media_of_add_csi(imxmd, csi_np);
-   of_node_put(csi_np);
-   if (ret)
-   return ret;
+   if (ret) {
+   /* unavailable or already added is not an error */
+   if (ret == -ENODEV || ret == -EEXIST) {
+   of_node_put(csi_np);
+   continue;
+   

[PATCH v2 3/4] media: imx: Rename functions that add IPU-internal subdevs

2019-02-20 Thread Steve Longerbeam
For the functions that add and remove the internal IPU subdevice
descriptors, rename them to make clear they are the subdevs internal
to the IPU. Also rename the platform data structure for the internal
IPU subdevices. No functional changes.

Signed-off-by: Steve Longerbeam 
Acked-by: Philipp Zabel 
Cc: sta...@vger.kernel.org
---
 drivers/staging/media/imx/imx-ic-common.c |  2 +-
 drivers/staging/media/imx/imx-media-dev.c |  8 
 drivers/staging/media/imx/imx-media-internal-sd.c | 12 ++--
 drivers/staging/media/imx/imx-media-vdic.c|  2 +-
 drivers/staging/media/imx/imx-media.h |  6 +++---
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/media/imx/imx-ic-common.c 
b/drivers/staging/media/imx/imx-ic-common.c
index 765919487a73..90a926891eb9 100644
--- a/drivers/staging/media/imx/imx-ic-common.c
+++ b/drivers/staging/media/imx/imx-ic-common.c
@@ -26,7 +26,7 @@ static struct imx_ic_ops *ic_ops[IC_NUM_OPS] = {
 
 static int imx_ic_probe(struct platform_device *pdev)
 {
-   struct imx_media_internal_sd_platformdata *pdata;
+   struct imx_media_ipu_internal_sd_pdata *pdata;
struct imx_ic_priv *priv;
int ret;
 
diff --git a/drivers/staging/media/imx/imx-media-dev.c 
b/drivers/staging/media/imx/imx-media-dev.c
index 28a3d23aad5b..fc35508d9396 100644
--- a/drivers/staging/media/imx/imx-media-dev.c
+++ b/drivers/staging/media/imx/imx-media-dev.c
@@ -477,10 +477,10 @@ static int imx_media_probe(struct platform_device *pdev)
goto cleanup;
}
 
-   ret = imx_media_add_internal_subdevs(imxmd);
+   ret = imx_media_add_ipu_internal_subdevs(imxmd);
if (ret) {
v4l2_err(>v4l2_dev,
-"add_internal_subdevs failed with %d\n", ret);
+"add_ipu_internal_subdevs failed with %d\n", ret);
goto cleanup;
}
 
@@ -491,7 +491,7 @@ static int imx_media_probe(struct platform_device *pdev)
return 0;
 
 del_int:
-   imx_media_remove_internal_subdevs(imxmd);
+   imx_media_remove_ipu_internal_subdevs(imxmd);
 cleanup:
v4l2_async_notifier_cleanup(>notifier);
v4l2_device_unregister(>v4l2_dev);
@@ -508,7 +508,7 @@ static int imx_media_remove(struct platform_device *pdev)
v4l2_info(>v4l2_dev, "Removing imx-media\n");
 
v4l2_async_notifier_unregister(>notifier);
-   imx_media_remove_internal_subdevs(imxmd);
+   imx_media_remove_ipu_internal_subdevs(imxmd);
v4l2_async_notifier_cleanup(>notifier);
media_device_unregister(>md);
v4l2_device_unregister(>v4l2_dev);
diff --git a/drivers/staging/media/imx/imx-media-internal-sd.c 
b/drivers/staging/media/imx/imx-media-internal-sd.c
index 5e10d95e5529..e620f4adb755 100644
--- a/drivers/staging/media/imx/imx-media-internal-sd.c
+++ b/drivers/staging/media/imx/imx-media-internal-sd.c
@@ -1,7 +1,7 @@
 /*
  * Media driver for Freescale i.MX5/6 SOC
  *
- * Adds the internal subdevices and the media links between them.
+ * Adds the IPU internal subdevices and the media links between them.
  *
  * Copyright (c) 2016 Mentor Graphics Inc.
  *
@@ -192,7 +192,7 @@ static struct v4l2_subdev *find_sink(struct imx_media_dev 
*imxmd,
 
/*
 * retrieve IPU id from subdev name, note: can't get this from
-* struct imx_media_internal_sd_platformdata because if src is
+* struct imx_media_ipu_internal_sd_pdata because if src is
 * a CSI, it has different struct ipu_client_platformdata which
 * does not contain IPU id.
 */
@@ -270,7 +270,7 @@ static int add_internal_subdev(struct imx_media_dev *imxmd,
   const struct internal_subdev *isd,
   int ipu_id)
 {
-   struct imx_media_internal_sd_platformdata pdata;
+   struct imx_media_ipu_internal_sd_pdata pdata;
struct platform_device_info pdevinfo = {};
struct platform_device *pdev;
 
@@ -328,7 +328,7 @@ static int add_ipu_internal_subdevs(struct imx_media_dev 
*imxmd, int ipu_id)
return 0;
 }
 
-int imx_media_add_internal_subdevs(struct imx_media_dev *imxmd)
+int imx_media_add_ipu_internal_subdevs(struct imx_media_dev *imxmd)
 {
int ret;
 
@@ -343,11 +343,11 @@ int imx_media_add_internal_subdevs(struct imx_media_dev 
*imxmd)
return 0;
 
 remove:
-   imx_media_remove_internal_subdevs(imxmd);
+   imx_media_remove_ipu_internal_subdevs(imxmd);
return ret;
 }
 
-void imx_media_remove_internal_subdevs(struct imx_media_dev *imxmd)
+void imx_media_remove_ipu_internal_subdevs(struct imx_media_dev *imxmd)
 {
struct imx_media_async_subdev *imxasd;
struct v4l2_async_subdev *asd;
diff --git a/drivers/staging/media/imx/imx-media-vdic.c 
b/drivers/staging/media/imx/imx-media-vdic.c
index 2808662e2597..8a9af4688fd4 100644
--- a/drivers/staging/media/imx/imx-media-vdic.c
+++ 

[PATCH v2 1/4] media: imx: csi: Allow unknown nearest upstream entities

2019-02-20 Thread Steve Longerbeam
On i.MX6, the nearest upstream entity to the CSI can only be the
CSI video muxes or the Synopsys DW MIPI CSI-2 receiver.

However the i.MX53 has no CSI video muxes or a MIPI CSI-2 receiver.
So allow for the nearest upstream entity to the CSI to be something
other than those.

Fixes: bf3cfaa712e5c ("media: staging/imx: get CSI bus type from nearest
upstream entity")

Signed-off-by: Steve Longerbeam 
Cc: sta...@vger.kernel.org
---
 drivers/staging/media/imx/imx-media-csi.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 3b7517348666..41965d8b56c4 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -154,9 +154,10 @@ static inline bool requires_passthrough(struct 
v4l2_fwnode_endpoint *ep,
 /*
  * Parses the fwnode endpoint from the source pad of the entity
  * connected to this CSI. This will either be the entity directly
- * upstream from the CSI-2 receiver, or directly upstream from the
- * video mux. The endpoint is needed to determine the bus type and
- * bus config coming into the CSI.
+ * upstream from the CSI-2 receiver, directly upstream from the
+ * video mux, or directly upstream from the CSI itself. The endpoint
+ * is needed to determine the bus type and bus config coming into
+ * the CSI.
  */
 static int csi_get_upstream_endpoint(struct csi_priv *priv,
 struct v4l2_fwnode_endpoint *ep)
@@ -172,7 +173,8 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv,
if (!priv->src_sd)
return -EPIPE;
 
-   src = >src_sd->entity;
+   sd = priv->src_sd;
+   src = >entity;
 
if (src->function == MEDIA_ENT_F_VID_MUX) {
/*
@@ -186,6 +188,14 @@ static int csi_get_upstream_endpoint(struct csi_priv *priv,
src = >entity;
}
 
+   /*
+* If the source is neither the video mux nor the CSI-2 receiver,
+* get the source pad directly upstream from CSI itself.
+*/
+   if (src->function != MEDIA_ENT_F_VID_MUX &&
+   sd->grp_id != IMX_MEDIA_GRP_ID_CSI2)
+   src = >sd.entity;
+
/* get source pad of entity directly upstream from src */
pad = imx_media_find_upstream_pad(priv->md, src, 0);
if (IS_ERR(pad))
-- 
2.17.1

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


[PATCH v2 2/4] media: imx: Clear fwnode link struct for each endpoint iteration

2019-02-20 Thread Steve Longerbeam
In imx_media_create_csi_of_links(), the 'struct v4l2_fwnode_link' must
be cleared for each endpoint iteration, otherwise if the remote port
has no "reg" property, link.remote_port will not be reset to zero.
This was discovered on the i.MX53 SMD board, since the OV5642 connects
directly to ipu1_csi0 and has a single source port with no "reg"
property.

Fixes: 621b08eabcddb ("media: staging/imx: remove static media link arrays")

Signed-off-by: Steve Longerbeam 
Cc: sta...@vger.kernel.org
---
 drivers/staging/media/imx/imx-media-of.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-of.c 
b/drivers/staging/media/imx/imx-media-of.c
index 03446335ac03..a26bdeb1af34 100644
--- a/drivers/staging/media/imx/imx-media-of.c
+++ b/drivers/staging/media/imx/imx-media-of.c
@@ -145,15 +145,18 @@ int imx_media_create_csi_of_links(struct imx_media_dev 
*imxmd,
  struct v4l2_subdev *csi)
 {
struct device_node *csi_np = csi->dev->of_node;
-   struct fwnode_handle *fwnode, *csi_ep;
-   struct v4l2_fwnode_link link;
struct device_node *ep;
-   int ret;
-
-   link.local_node = of_fwnode_handle(csi_np);
-   link.local_port = CSI_SINK_PAD;
 
for_each_child_of_node(csi_np, ep) {
+   struct fwnode_handle *fwnode, *csi_ep;
+   struct v4l2_fwnode_link link;
+   int ret;
+
+   memset(, 0, sizeof(link));
+
+   link.local_node = of_fwnode_handle(csi_np);
+   link.local_port = CSI_SINK_PAD;
+
csi_ep = of_fwnode_handle(ep);
 
fwnode = fwnode_graph_get_remote_endpoint(csi_ep);
-- 
2.17.1

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


RE: [PATCH] MAINTAINERS: Add mailing list for Hyper-V CORE AND DRIVERS

2019-02-20 Thread Haiyang Zhang



> -Original Message-
> From: Greg KH 
> Sent: Wednesday, February 20, 2019 2:52 PM
> To: Haiyang Zhang 
> Cc: sas...@kernel.org; linux-hyp...@vger.kernel.org;
> de...@linuxdriverproject.org; Stephen Hemminger
> ; linux-ker...@vger.kernel.org
> Subject: Re: [PATCH] MAINTAINERS: Add mailing list for Hyper-V CORE AND
> DRIVERS
> 
> On Wed, Feb 20, 2019 at 07:48:23PM +, Haiyang Zhang wrote:
> > From: Haiyang Zhang 
> >
> > The new mailing list is: linux-hyp...@vger.kernel.org
> >
> > Signed-off-by: Haiyang Zhang 
> > ---
> >  MAINTAINERS | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS index
> > 86aa227b5782..ef65de3cfe1b 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -7137,6 +7137,7 @@ M:Haiyang Zhang 
> >  M: Stephen Hemminger 
> >  M: Sasha Levin 
> >  T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
> > +L: linux-hyp...@vger.kernel.org
> >  L: de...@linuxdriverproject.org
> 
> Why not just drop the linuxdriverproject one when you do this?
> 
> I for one will not mind :)

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


Re: [PATCH] MAINTAINERS: Add mailing list for Hyper-V CORE AND DRIVERS

2019-02-20 Thread Greg KH
On Wed, Feb 20, 2019 at 07:48:23PM +, Haiyang Zhang wrote:
> From: Haiyang Zhang 
> 
> The new mailing list is: linux-hyp...@vger.kernel.org
> 
> Signed-off-by: Haiyang Zhang 
> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 86aa227b5782..ef65de3cfe1b 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7137,6 +7137,7 @@ M:  Haiyang Zhang 
>  M:   Stephen Hemminger 
>  M:   Sasha Levin 
>  T:   git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
> +L:   linux-hyp...@vger.kernel.org
>  L:   de...@linuxdriverproject.org

Why not just drop the linuxdriverproject one when you do this?

I for one will not mind :)

thanks,

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


[PATCH] MAINTAINERS: Add mailing list for Hyper-V CORE AND DRIVERS

2019-02-20 Thread Haiyang Zhang
From: Haiyang Zhang 

The new mailing list is: linux-hyp...@vger.kernel.org

Signed-off-by: Haiyang Zhang 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 86aa227b5782..ef65de3cfe1b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7137,6 +7137,7 @@ M:Haiyang Zhang 
 M: Stephen Hemminger 
 M: Sasha Levin 
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
+L: linux-hyp...@vger.kernel.org
 L: de...@linuxdriverproject.org
 S: Supported
 F: Documentation/networking/device_drivers/microsoft/netvsc.txt
-- 
2.19.1

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


Re: [RESEND PATCH 3/7] mm/gup: Change GUP fast to use flags rather than a write 'bool'

2019-02-20 Thread Mike Marshall
Hi Ira

Martin and I looked at your patch and agree that it doesn't change
functionality for Orangefs.

Reviewed-by: Mike Marshall 



On Wed, Feb 20, 2019 at 12:32 AM  wrote:
>
> From: Ira Weiny 
>
> To facilitate additional options to get_user_pages_fast() change the
> singular write parameter to be gup_flags.
>
> This patch does not change any functionality.  New functionality will
> follow in subsequent patches.
>
> Some of the get_user_pages_fast() call sites were unchanged because they
> already passed FOLL_WRITE or 0 for the write parameter.
>
> Signed-off-by: Ira Weiny 
> ---
>  arch/mips/mm/gup.c | 11 ++-
>  arch/powerpc/kvm/book3s_64_mmu_hv.c|  4 ++--
>  arch/powerpc/kvm/e500_mmu.c|  2 +-
>  arch/powerpc/mm/mmu_context_iommu.c|  4 ++--
>  arch/s390/kvm/interrupt.c  |  2 +-
>  arch/s390/mm/gup.c | 12 ++--
>  arch/sh/mm/gup.c   | 11 ++-
>  arch/sparc/mm/gup.c|  9 +
>  arch/x86/kvm/paging_tmpl.h |  2 +-
>  arch/x86/kvm/svm.c |  2 +-
>  drivers/fpga/dfl-afu-dma-region.c  |  2 +-
>  drivers/gpu/drm/via/via_dmablit.c  |  3 ++-
>  drivers/infiniband/hw/hfi1/user_pages.c|  3 ++-
>  drivers/misc/genwqe/card_utils.c   |  2 +-
>  drivers/misc/vmw_vmci/vmci_host.c  |  2 +-
>  drivers/misc/vmw_vmci/vmci_queue_pair.c|  6 --
>  drivers/platform/goldfish/goldfish_pipe.c  |  3 ++-
>  drivers/rapidio/devices/rio_mport_cdev.c   |  4 +++-
>  drivers/sbus/char/oradax.c |  2 +-
>  drivers/scsi/st.c  |  3 ++-
>  drivers/staging/gasket/gasket_page_table.c |  4 ++--
>  drivers/tee/tee_shm.c  |  2 +-
>  drivers/vfio/vfio_iommu_spapr_tce.c|  3 ++-
>  drivers/vhost/vhost.c  |  2 +-
>  drivers/video/fbdev/pvr2fb.c   |  2 +-
>  drivers/virt/fsl_hypervisor.c  |  2 +-
>  drivers/xen/gntdev.c   |  2 +-
>  fs/orangefs/orangefs-bufmap.c  |  2 +-
>  include/linux/mm.h |  4 ++--
>  kernel/futex.c |  2 +-
>  lib/iov_iter.c |  7 +--
>  mm/gup.c   | 10 +-
>  mm/util.c  |  8 
>  net/ceph/pagevec.c |  2 +-
>  net/rds/info.c |  2 +-
>  net/rds/rdma.c |  3 ++-
>  36 files changed, 81 insertions(+), 65 deletions(-)
>
> diff --git a/arch/mips/mm/gup.c b/arch/mips/mm/gup.c
> index 0d14e0d8eacf..4c2b4483683c 100644
> --- a/arch/mips/mm/gup.c
> +++ b/arch/mips/mm/gup.c
> @@ -235,7 +235,7 @@ int __get_user_pages_fast(unsigned long start, int 
> nr_pages, int write,
>   * get_user_pages_fast() - pin user pages in memory
>   * @start: starting user address
>   * @nr_pages:  number of pages from start to pin
> - * @write: whether pages will be written to
> + * @gup_flags: flags modifying pin behaviour
>   * @pages: array that receives pointers to the pages pinned.
>   * Should be at least nr_pages long.
>   *
> @@ -247,8 +247,8 @@ int __get_user_pages_fast(unsigned long start, int 
> nr_pages, int write,
>   * requested. If nr_pages is 0 or negative, returns 0. If no pages
>   * were pinned, returns -errno.
>   */
> -int get_user_pages_fast(unsigned long start, int nr_pages, int write,
> -   struct page **pages)
> +int get_user_pages_fast(unsigned long start, int nr_pages,
> +   unsigned int gup_flags, struct page **pages)
>  {
> struct mm_struct *mm = current->mm;
> unsigned long addr, len, end;
> @@ -273,7 +273,8 @@ int get_user_pages_fast(unsigned long start, int 
> nr_pages, int write,
> next = pgd_addr_end(addr, end);
> if (pgd_none(pgd))
> goto slow;
> -   if (!gup_pud_range(pgd, addr, next, write, pages, ))
> +   if (!gup_pud_range(pgd, addr, next, gup_flags & FOLL_WRITE,
> +  pages, ))
> goto slow;
> } while (pgdp++, addr = next, addr != end);
> local_irq_enable();
> @@ -289,7 +290,7 @@ int get_user_pages_fast(unsigned long start, int 
> nr_pages, int write,
> pages += nr;
>
> ret = get_user_pages_unlocked(start, (end - start) >> PAGE_SHIFT,
> - pages, write ? FOLL_WRITE : 0);
> + pages, gup_flags);
>
> /* Have to be a bit careful with return values */
> if (nr > 0) {
> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c 
> b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> index bd2dcfbf00cd..8fcb0a921e46 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
> +++ 

Re: [RESEND PATCH 0/7] Add FOLL_LONGTERM to GUP fast and use it

2019-02-20 Thread Ira Weiny
On Wed, Feb 20, 2019 at 07:19:30AM -0800, Christoph Hellwig wrote:
> On Tue, Feb 19, 2019 at 09:30:33PM -0800, ira.we...@intel.com wrote:
> > From: Ira Weiny 
> > 
> > Resending these as I had only 1 minor comment which I believe we have 
> > covered
> > in this series.  I was anticipating these going through the mm tree as they
> > depend on a cleanup patch there and the IB changes are very minor.  But they
> > could just as well go through the IB tree.
> > 
> > NOTE: This series depends on my clean up patch to remove the write parameter
> > from gup_fast_permitted()[1]
> > 
> > HFI1, qib, and mthca, use get_user_pages_fast() due to it performance
> > advantages.  These pages can be held for a significant time.  But
> > get_user_pages_fast() does not protect against mapping of FS DAX pages.
> 
> This I don't get - if you do lock down long term mappings performance
> of the actual get_user_pages call shouldn't matter to start with.
> 
> What do I miss?

A couple of points.

First "longterm" is a relative thing and at this point is probably a misnomer.
This is really flagging a pin which is going to be given to hardware and can't
move.  I've thought of a couple of alternative names but I think we have to
settle on if we are going to use FL_LAYOUT or something else to solve the
"longterm" problem.  Then I think we can change the flag to a better name.

Second, It depends on how often you are registering memory.  I have spoken with
some RDMA users who consider MR in the performance path...  For the overall
application performance.  I don't have the numbers as the tests for HFI1 were
done a long time ago.  But there was a significant advantage.  Some of which is
probably due to the fact that you don't have to hold mmap_sem.

Finally, architecturally I think it would be good for everyone to use *_fast.
There are patches submitted to the RDMA list which would allow the use of
*_fast (they reworking the use of mmap_sem) and as soon as they are accepted
I'll submit a patch to convert the RDMA core as well.  Also to this point
others are looking to use *_fast.[2]

As an asside, Jasons pointed out in my previous submission that *_fast and
*_unlocked look very much the same.  I agree and I think further cleanup will
be coming.  But I'm focused on getting the final solution for DAX at the
moment.

Ira

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


RE: [PATCH v2 2/2] Drivers: hv: vmbus: Return -EINVAL if monitor_allocated not set

2019-02-20 Thread Michael Kelley
From: Kimberly Brown   Sent: Monday, February 18, 2019 
9:38 PM
> 
> There are two methods for signaling the host: the monitor page mechanism
> and hypercalls. The monitor page mechanism is used by performance
> critical channels (storage, networking, etc.) because it provides
> improved throughput. However, latency is increased. Monitor pages are
> allocated to these channels.
> 
> Monitor pages are not allocated to channels that do not use the monitor
> page mechanism. Therefore, these channels do not have a valid monitor id
> or valid monitor page data. In these cases, some of the "_show"
> functions return incorrect data. They return an invalid monitor id and
> data that is beyond the bounds of the hv_monitor_page array fields.
> 
> The "channel->offermsg.monitor_allocated" value can be used to determine
> whether monitor pages have been allocated to a channel. In the affected
> "_show" functions, verify that "channel->offermsg.monitor_allocated" is
> set before accessing the monitor id or the monitor page data. If
> "channel->offermsg.monitor_allocated" is not set, return -EINVAL.
> 
> Signed-off-by: Kimberly Brown 
>

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


RE: [PATCH v2 1/2] Drivers: hv: vmbus: Change server monitor_pages index to 0

2019-02-20 Thread Michael Kelley
From: Kimberly Brown   Sent: Monday, February 18, 2019 
9:38 PM
> 
> Change the monitor_pages index in server_monitor_pending_show() to '0'.
> '0' is the correct monitor_pages index for the server. A comment for the
> monitor_pages field in the vmbus_connection struct definition indicates
> that the 1st page is for parent->child notifications. In addition, the
> server_monitor_latency_show() and server_monitor_conn_id_show()
> functions use monitor_pages index '0'.
> 
> Signed-off-by: Kimberly Brown 
> Acked-by: Stephen Hemminger 
> ---
>  drivers/hv/vmbus_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

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


Re: [RESEND PATCH 0/7] Add FOLL_LONGTERM to GUP fast and use it

2019-02-20 Thread Christoph Hellwig
On Tue, Feb 19, 2019 at 09:30:33PM -0800, ira.we...@intel.com wrote:
> From: Ira Weiny 
> 
> Resending these as I had only 1 minor comment which I believe we have covered
> in this series.  I was anticipating these going through the mm tree as they
> depend on a cleanup patch there and the IB changes are very minor.  But they
> could just as well go through the IB tree.
> 
> NOTE: This series depends on my clean up patch to remove the write parameter
> from gup_fast_permitted()[1]
> 
> HFI1, qib, and mthca, use get_user_pages_fast() due to it performance
> advantages.  These pages can be held for a significant time.  But
> get_user_pages_fast() does not protect against mapping of FS DAX pages.

This I don't get - if you do lock down long term mappings performance
of the actual get_user_pages call shouldn't matter to start with.

What do I miss?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:iio:ad7152: Rename misspelled RESEVERD -> RESERVED

2019-02-20 Thread Jonathan Cameron
...
> 
> Thanks for answering Jonathan and Stefan.
> 
> I would like to contribute with the ad7150 driver. Could you please
> give me some hints on what can I do to move this driver
> out of staging?
> 
> I note that device registration (devm_iio_device_register) is not
> the last function called at probe function. Should I change order
> to call dev_info before the device registration?
No on this one. Dev_info is just a message print, so there is nothing
to unwind, hence order doesn't matter. Also in this case it is saying
that the probe really succeeded and as devm_iio_device_register
can fail, it should be after that.  However, there is a pretty strong
argument that the print doesn't add anything and should be dropped
anyway.

> 
> Also did not see any device tree documentation at
> Documentation/devicetree/bindings/iio for AD7150 driver.
Agreed. That needs writing.

As for the driver:

> /*
>  * AD7150 capacitive sensor driver supporting AD7150/1/6
>  *
>  * Copyright 2010-2011 Analog Devices Inc.
>  *
>  * Licensed under the GPL-2 or later.

Convert to SPDX.  Note that it's inconsistent between here and below
though.  See recent clarifying patches from Analog and go with what
they said there.  Make sure you include a reference to that thread
in the patch as legal minefields if it isn't clear what your justification
is.

>  */
> 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> 
> #include 
> #include 
> #include 
> /*
>  * AD7150 registers definition
>  */
> 
> #define AD7150_STATUS  0
It's not clear what is a register address and what a field entry here.
There are various ways of doing that. One I like would be

#define AD7150_STATUS_REG0
#define   AD7150_STATUS_OUT1 BIT(3)
etc.  So use REG to make the register addresses clear
and then use indentation to highlight what is a field name.

> #define AD7150_STATUS_OUT1 BIT(3)
> #define AD7150_STATUS_OUT2 BIT(5)
> #define AD7150_CH1_DATA_HIGH   1
> #define AD7150_CH2_DATA_HIGH   3
> #define AD7150_CH1_AVG_HIGH5
> #define AD7150_CH2_AVG_HIGH7
> #define AD7150_CH1_SENSITIVITY 9
> #define AD7150_CH1_THR_HOLD_H  9
> #define AD7150_CH1_TIMEOUT 10
> #define AD7150_CH1_SETUP   11
> #define AD7150_CH2_SENSITIVITY 12
> #define AD7150_CH2_THR_HOLD_H  12
> #define AD7150_CH2_TIMEOUT 13
> #define AD7150_CH2_SETUP   14
> #define AD7150_CFG 15
> #define AD7150_CFG_FIX BIT(7)
> #define AD7150_PD_TIMER16
> #define AD7150_CH1_CAPDAC  17
> #define AD7150_CH2_CAPDAC  18
> #define AD7150_SN3 19
> #define AD7150_SN2 20
> #define AD7150_SN1 21
> #define AD7150_SN0 22
> #define AD7150_ID  23
> 
> /**
>  * struct ad7150_chip_info - instance specific chip data
>  * @client: i2c client for this device
>  * @current_event: device always has one type of event enabled.
>  *This element stores the event code of the current one.
>  * @threshold: thresholds for simple capacitance value events
>  * @thresh_sensitivity: threshold for simple capacitance offset
>  *from 'average' value.
>  * @mag_sensitity: threshold for magnitude of capacitance offset from
>  *from 'average' value.
>  * @thresh_timeout: a timeout, in samples from the moment an
>  *adaptive threshold event occurs to when the average
>  *value jumps to current value.
>  * @mag_timeout: a timeout, in sample from the moment an
>  *adaptive magnitude event occurs to when the average
>  *value jumps to the current value.
>  * @old_state: store state from previous event, allowing confirmation
>  *of new condition.
>  * @conversion_mode: the current conversion mode.
>  * @state_lock: ensure consistent state of this structure wrt the
>  *hardware.
>  */
> struct ad7150_chip_info {
>   struct i2c_client *client;
>   u64 current_event;
>   u16 threshold[2][2];
>   u8 thresh_sensitivity[2][2];
>   u8 mag_sensitivity[2][2];
>   u8 thresh_timeout[2][2];
>   u8 mag_timeout[2][2];
>   int old_state;
>   char *conversion_mode;
>   struct mutex state_lock;
> };
> 
> /*
>  * sysfs nodes

It is both a single line comment and inaccurate.  Have a general
clean up of comments to remove those that don't add anything.

>  */
> 
> static const u8 ad7150_addresses[][6] = {
>   { AD7150_CH1_DATA_HIGH, AD7150_CH1_AVG_HIGH,
> AD7150_CH1_SETUP, AD7150_CH1_THR_HOLD_H,
> AD7150_CH1_SENSITIVITY, AD7150_CH1_TIMEOUT },
>   { AD7150_CH2_DATA_HIGH, AD7150_CH2_AVG_HIGH,
> AD7150_CH2_SETUP, AD7150_CH2_THR_HOLD_H,
> AD7150_CH2_SENSITIVITY, AD7150_CH2_TIMEOUT },
> };
> 
> static int ad7150_read_raw(struct iio_dev *indio_dev,
>  struct iio_chan_spec const *chan,
>  int *val,
>  int *val2,
>   

[driver-core:driver-core-testing 64/64] htmldocs: include/linux/device.h:866: warning: Function parameter or member 'supplier_preactivated' not described in 'device_link'

2019-02-20 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
driver-core-testing
head:   36003d4cf57ca431fb3f94d317bcca426a2394d6
commit: 36003d4cf57ca431fb3f94d317bcca426a2394d6 [64/64] driver core: Fix 
PM-runtime for links added during consumer probe
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick 
(https://www.imagemagick.org)
   include/linux/rcupdate_wait.h:1: warning: no structured comments found
   include/linux/rcutree.h:1: warning: no structured comments found
   kernel/rcu/tree.c:710: warning: Excess function parameter 'irq' description 
in 'rcu_nmi_exit'
   include/linux/gfp.h:1: warning: no structured comments found
   include/net/cfg80211.h:4687: warning: Function parameter or member 
'wext.ibss' not described in 'wireless_dev'
   include/net/cfg80211.h:4687: warning: Function parameter or member 
'wext.connect' not described in 'wireless_dev'
   include/net/cfg80211.h:4687: warning: Function parameter or member 
'wext.keys' not described in 'wireless_dev'
   include/net/cfg80211.h:4687: warning: Function parameter or member 'wext.ie' 
not described in 'wireless_dev'
   include/net/cfg80211.h:4687: warning: Function parameter or member 
'wext.ie_len' not described in 'wireless_dev'
   include/net/cfg80211.h:4687: warning: Function parameter or member 
'wext.bssid' not described in 'wireless_dev'
   include/net/cfg80211.h:4687: warning: Function parameter or member 
'wext.ssid' not described in 'wireless_dev'
   include/net/cfg80211.h:4687: warning: Function parameter or member 
'wext.default_key' not described in 'wireless_dev'
   include/net/cfg80211.h:4687: warning: Function parameter or member 
'wext.default_mgmt_key' not described in 'wireless_dev'
   include/net/cfg80211.h:4687: warning: Function parameter or member 
'wext.prev_bssid_valid' not described in 'wireless_dev'
   include/net/mac80211.h:2393: warning: Function parameter or member 
'radiotap_timestamp.units_pos' not described in 'ieee80211_hw'
   include/net/mac80211.h:2393: warning: Function parameter or member 
'radiotap_timestamp.accuracy' not described in 'ieee80211_hw'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.rates' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.rts_cts_rate_idx' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.use_rts' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.use_cts_prot' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.short_preamble' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.skip_table' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.jiffies' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.vif' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.hw_key' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.flags' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'control.enqueue_time' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 'ack' not 
described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'ack.cookie' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'status.rates' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'status.ack_signal' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'status.ampdu_ack_len' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'status.ampdu_len' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'status.antenna' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'status.tx_time' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'status.is_valid_ack_signal' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'status.status_driver_data' not described in 'ieee80211_tx_info'
   include/net/mac80211.h:1004: warning: Function parameter or member 
'driver_rates' not described in 

[PATCH] staging: octeon-usb: fix misspelled "re-enable"

2019-02-20 Thread Sumit Pundir
Fixes misspelled "re-enable" in comment. Reported by checkpatch.pl

Signed-off-by: Sumit Pundir 
---
 drivers/staging/octeon-usb/octeon-hcd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.h 
b/drivers/staging/octeon-usb/octeon-hcd.h
index 769c36cf6614..ae7ae50071ae 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.h
+++ b/drivers/staging/octeon-usb/octeon-hcd.h
@@ -1797,7 +1797,7 @@ union cvmx_usbnx_usbp_ctl_status {
 *  This is a test signal. When the USB Core is
 *  powered up (not in Susned Mode), an automatic
 *  tester can use this to disable phy_clock and
-*  free_clk, then re-eanable them with an aligned
+*  free_clk, then re-enable them with an aligned
 *  phase.
 *  '1': The phy_clk and free_clk outputs are
 *  disabled. "0": The phy_clock and free_clk outputs
-- 
2.17.1

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


Re: [PATCH v2 2/2] staging: iio: frequency: ad9834: Move phase and scale to standard iio attribute

2019-02-20 Thread Jonathan Cameron
On Thu, 14 Feb 2019 18:41:30 +0200
Beniamin Bia  wrote:

> The custom phase and scale attributes were moved to standard iio types.
> 
> Signed-off-by: Beniamin Bia 
Hi, 

This hits the same fundamental questions of ABI as the FSK
elements in the previous patch, just now for Phase Shift Keying.

Unfortunately this ABI element is a strong part of the reason
these DDS chips have languished in staging a long time.
It is not easy to generalize.  On that note, we also want to
take into account any other chips that will want to share ABI with
this one as we define it.

Jonathan

> ---
> Changes in v2:
>   -the personal email address was replaced by the work email
>   -separate define for every phase channel
>   -enum used for write_phase functions
>   -phase variables were replaced by an array
> 
>  drivers/staging/iio/frequency/ad9834.c | 53 --
>  1 file changed, 32 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/staging/iio/frequency/ad9834.c 
> b/drivers/staging/iio/frequency/ad9834.c
> index 561617046c20..4366b6121154 100644
> --- a/drivers/staging/iio/frequency/ad9834.c
> +++ b/drivers/staging/iio/frequency/ad9834.c
> @@ -82,6 +82,7 @@ struct ad9834_state {
>   struct mutexlock;   /* protect sensor state */
>  
>   unsigned long   frequency[2];
> + unsigned long   phase[2];
>  
>   /*
>* DMA (thus cache coherency maintenance) requires the
> @@ -113,6 +114,8 @@ enum ad9834_supported_device_ids {
>   .output = 1,\
>   .channel = (chan),  \
>   .info_mask_separate = BIT(IIO_CHAN_INFO_FREQUENCY)  \
> + | BIT(IIO_CHAN_INFO_PHASE),\
> + .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),   \
>  }
>  
>  static const struct iio_chan_spec ad9833_channels[] = {
> @@ -172,13 +175,26 @@ static int ad9834_write_frequency(struct ad9834_state 
> *st,
>  }
>  
>  static int ad9834_write_phase(struct ad9834_state *st,
> -   unsigned long addr, unsigned long phase)
> +   enum ad9834_ch_addr addr,
> +   unsigned long phase)
>  {
> + int ret;
> +
>   if (phase > BIT(AD9834_PHASE_BITS))
>   return -EINVAL;
> - st->data = cpu_to_be16(addr | phase);
>  
> - return spi_sync(st->spi, >msg);
> + if (addr == AD9834_CHANNEL_ADDRESS0)
> + st->data = cpu_to_be16(AD9834_REG_PHASE0 | phase);
> + else
> + st->data = cpu_to_be16(AD9834_REG_PHASE1 | phase);
> +
> + ret = spi_sync(st->spi, >msg);
> + if (ret)
> + return ret;
> +
> + st->phase[(int)addr] = phase;
> +
> + return 0;
>  }
>  
>  static int ad9834_read_raw(struct iio_dev *indio_dev,
> @@ -191,6 +207,13 @@ static int ad9834_read_raw(struct iio_dev *indio_dev,
>   case IIO_CHAN_INFO_FREQUENCY:
>   *val = st->frequency[chan->channel];
>   return IIO_VAL_INT;
> + case IIO_CHAN_INFO_PHASE:
> + *val = st->phase[chan->channel];
> + return IIO_VAL_INT;
> + case IIO_CHAN_INFO_SCALE:
> + /*1 hz */
> + *val = 1;
> + return IIO_VAL_INT;
>   }
>  
>   return -EINVAL;
> @@ -207,6 +230,10 @@ static int ad9834_write_raw(struct iio_dev *indio_dev,
>   return ad9834_write_frequency(st,
> (enum 
> ad9834_ch_addr)chan->channel,
> val);
> + case IIO_CHAN_INFO_PHASE:
> + return ad9834_write_phase(st,
> +   (enum ad9834_ch_addr)chan->channel,
> +   val);
>   default:
>   return  -EINVAL;
>   }
> @@ -231,10 +258,6 @@ static ssize_t ad9834_write(struct device *dev,
>  
>   mutex_lock(>lock);
>   switch ((u32)this_attr->address) {
> - case AD9834_REG_PHASE0:
> - case AD9834_REG_PHASE1:
> - ret = ad9834_write_phase(st, this_attr->address, val);
> - break;
>   case AD9834_OPBITEN:
>   if (st->control & AD9834_MODE) {
>   ret = -EINVAL;  /* AD9843 reserved mode */
> @@ -394,12 +417,8 @@ static 
> IIO_DEVICE_ATTR(out_altvoltage0_out1_wavetype_available, 0444,
>   */
>  
>  static IIO_DEV_ATTR_FREQSYMBOL(0, 0200, NULL, ad9834_write, AD9834_FSEL);
> -static IIO_CONST_ATTR_FREQ_SCALE(0, "1"); /* 1Hz */
>  
> -static IIO_DEV_ATTR_PHASE(0, 0, 0200, NULL, ad9834_write, AD9834_REG_PHASE0);
> -static IIO_DEV_ATTR_PHASE(0, 1, 0200, NULL, ad9834_write, AD9834_REG_PHASE1);
>  static IIO_DEV_ATTR_PHASESYMBOL(0, 0200, NULL, ad9834_write, AD9834_PSEL);
> -static IIO_CONST_ATTR_PHASE_SCALE(0, "0.0015339808"); /* 2PI/2^12 rad*/
>  
>  static IIO_DEV_ATTR_PINCONTROL_EN(0, 0200, NULL,
>   

Re: [PATCH v2 1/2] staging: iio: frequency: ad9834: Move frequency to standard iio types

2019-02-20 Thread Jonathan Cameron
On Thu, 14 Feb 2019 18:41:29 +0200
Beniamin Bia  wrote:

> Frequency attribute is added with a standard type from iio framework
> instead of custom attribute. This is a small step towards removing any
> unnecessary custom attribute. Ad9834 will diverge from ad9833 in the
> future, that is why we have two identical arrays for ad9834 and 9833.
> 
> Signed-off-by: Beniamin Bia 
Hi Beniamin

When you make a change like this, please explain in detail how the ABI
changes.  Here I'm not sure we can actually map it to channels like this.
We are controlling the two frequencies of FSK not independent channels.

The ABI around this needs very careful thinking out.  I would document
your proposed ABI first and share that.  Once we reach agreement on the
ABI, the actual code should be more straight forward!

Thanks,

Jonathan

> ---
> Changes in v2:
>   -the personal email address was replaced by the work email
>   -separate define for frequency channel
>   -address field from channel specification was removed
>   -frequency variables were replaced by an array
>   -specified in comment why we have differente chan_spec for ad9834 and 
> ad9833
>   -enum used for write_frequency function
> 
>  drivers/staging/iio/frequency/ad9834.c | 110 -
>  1 file changed, 91 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/staging/iio/frequency/ad9834.c 
> b/drivers/staging/iio/frequency/ad9834.c
> index f036f75d1f22..561617046c20 100644
> --- a/drivers/staging/iio/frequency/ad9834.c
> +++ b/drivers/staging/iio/frequency/ad9834.c
> @@ -81,6 +81,8 @@ struct ad9834_state {
>   struct spi_message  freq_msg;
>   struct mutexlock;   /* protect sensor state */
>  
> + unsigned long   frequency[2];
> +
>   /*
>* DMA (thus cache coherency maintenance) requires the
>* transfer buffers to live in their own cache lines.
> @@ -89,6 +91,11 @@ struct ad9834_state {
>   __be16  freq_data[2];
>  };
>  
> +enum ad9834_ch_addr {
> + AD9834_CHANNEL_ADDRESS0,
> + AD9834_CHANNEL_ADDRESS1,
> +};
> +
>  /**
>   * ad9834_supported_device_ids:
>   */
> @@ -100,6 +107,24 @@ enum ad9834_supported_device_ids {
>   ID_AD9838,
>  };
>  
> +#define AD9833_CHANNEL(chan) {   
> \
> + .type = IIO_ALTVOLTAGE, \
> + .indexed = 1,   \
> + .output = 1,\
> + .channel = (chan),  \
> + .info_mask_separate = BIT(IIO_CHAN_INFO_FREQUENCY)  \
> +}
> +
> +static const struct iio_chan_spec ad9833_channels[] = {
> + AD9833_CHANNEL(0),
> + AD9833_CHANNEL(1),
> +};
> +
> +static const struct iio_chan_spec ad9834_channels[] = {
> + AD9833_CHANNEL(0),
> + AD9833_CHANNEL(1),
> +};
> +
>  static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long 
> fout)
>  {
>   unsigned long long freqreg = (u64)fout * (u64)BIT(AD9834_FREQ_BITS);
> @@ -109,10 +134,12 @@ static unsigned int ad9834_calc_freqreg(unsigned long 
> mclk, unsigned long fout)
>  }
>  
>  static int ad9834_write_frequency(struct ad9834_state *st,
> -   unsigned long addr, unsigned long fout)
> +   enum ad9834_ch_addr addr,
> +   unsigned long fout)
>  {
>   unsigned long clk_freq;
>   unsigned long regval;
> + int ret;
>  
>   clk_freq = clk_get_rate(st->mclk);
>  
> @@ -121,13 +148,27 @@ static int ad9834_write_frequency(struct ad9834_state 
> *st,
>  
>   regval = ad9834_calc_freqreg(clk_freq, fout);
>  
> - st->freq_data[0] = cpu_to_be16(addr | (regval &
> -RES_MASK(AD9834_FREQ_BITS / 2)));
> - st->freq_data[1] = cpu_to_be16(addr | ((regval >>
> -(AD9834_FREQ_BITS / 2)) &
> -RES_MASK(AD9834_FREQ_BITS / 2)));
> + if (addr == AD9834_CHANNEL_ADDRESS0) {

So this if statement picks between the two addresses with no other differences?
That's fine, but use a local variable for the register address to simplify
the code.

> + st->freq_data[0] = cpu_to_be16(AD9834_REG_FREQ0 | (regval &
> +RES_MASK(AD9834_FREQ_BITS / 2)));
> + st->freq_data[1] = cpu_to_be16(AD9834_REG_FREQ0 | ((regval >>
> +(AD9834_FREQ_BITS / 2)) &
> +RES_MASK(AD9834_FREQ_BITS / 2)));
> + } else {
> + st->freq_data[0] = cpu_to_be16(AD9834_REG_FREQ1 | (regval &
> +RES_MASK(AD9834_FREQ_BITS / 2)));
> + st->freq_data[1] = cpu_to_be16(AD9834_REG_FREQ1 | ((regval >>

Re: [PATCH v14 05/13] media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7

2019-02-20 Thread Rui Miguel Silva

Hi Hans,
On Wed 20 Feb 2019 at 08:56, Hans Verkuil wrote:

On 2/6/19 4:13 PM, Rui Miguel Silva wrote:
Adds MIPI CSI-2 subdev for i.MX7 to connect with sensors with a 
MIPI

CSI-2 interface.

Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/Makefile |1 +
 drivers/staging/media/imx/imx7-mipi-csis.c | 1186 
 

 2 files changed, 1187 insertions(+)
 create mode 100644 drivers/staging/media/imx/imx7-mipi-csis.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile

index 074f016d3519..d2d909a36239 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += 
imx-media-csi.o

 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
 
 obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o

+obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-mipi-csis.o
diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c 
b/drivers/staging/media/imx/imx7-mipi-csis.c

new file mode 100644
index ..516d308dc44b
--- /dev/null
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -0,0 +1,1186 @@





+static int mipi_csi_registered(struct v4l2_subdev *mipi_sd)
+{
+   struct csi_state *state = mipi_sd_to_csis_state(mipi_sd);
+   unsigned int i;
+   int ret;
+
+   for (i = 0; i < CSIS_PADS_NUM; i++) {
+   state->pads[i].flags = (i == CSIS_PAD_SINK) ?
+   MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
+   }
+
+   /* set a default mbus format  */
+   ret = imx_media_init_mbus_fmt(>format_mbus,
+ MIPI_CSIS_DEF_PIX_HEIGHT,
+ MIPI_CSIS_DEF_PIX_WIDTH, 0,
+ V4L2_FIELD_NONE, NULL);
+   if (ret)
+   return ret;
+
+	return media_entity_pads_init(_sd->entity, 
CSIS_PADS_NUM,

+ state->pads);
+}
+
+static const struct v4l2_subdev_core_ops mipi_csis_core_ops = 
{

+   .log_status = mipi_csis_log_status,
+};
+
+static const struct media_entity_operations 
mipi_csis_entity_ops = {

+   .link_setup = mipi_csis_link_setup,
+   .link_validate  = v4l2_subdev_link_validate,
+};
+
+static const struct v4l2_subdev_video_ops mipi_csis_video_ops 
= {

+   .s_stream   = mipi_csis_s_stream,
+};
+
+static const struct v4l2_subdev_pad_ops mipi_csis_pad_ops = {
+   .init_cfg   = mipi_csis_init_cfg,
+   .get_fmt= mipi_csis_get_fmt,
+   .set_fmt= mipi_csis_set_fmt,
+};
+
+static const struct v4l2_subdev_ops mipi_csis_subdev_ops = {
+   .core   = _csis_core_ops,
+   .video  = _csis_video_ops,
+   .pad= _csis_pad_ops,
+};
+
+static const struct v4l2_subdev_internal_ops 
mipi_csis_internal_ops = {

+   .registered = mipi_csi_registered,
+};


This struct is not used, and therefor mipi_csi_registered() is 
never called

either. Should it be called or can this be removed?


Good question :), I will get back to you on this one later.

---
Cheers,
Rui

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


Re: [PATCH 2/2] media: imx7-media-csi: get rid of unused var

2019-02-20 Thread Rui Miguel Silva

Oi Mauro,
On Tue 19 Feb 2019 at 13:24, Mauro Carvalho Chehab wrote:
	drivers/staging/media/imx/imx7-media-csi.c: In function 
'imx7_csi_enum_mbus_code':
	drivers/staging/media/imx/imx7-media-csi.c:926:33: 
warning: variable 'in_cc' set but not used 
[-Wunused-but-set-variable]

  const struct imx_media_pixfmt *in_cc;
 ^

Signed-off-by: Mauro Carvalho Chehab 



Acked-by: Rui Miguel Silva 

---
Cheers,
Rui


---
 drivers/staging/media/imx/imx7-media-csi.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
b/drivers/staging/media/imx/imx7-media-csi.c

index 0b1788d79ce9..3fba7c27c0ec 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -923,7 +923,6 @@ static int imx7_csi_enum_mbus_code(struct 
v4l2_subdev *sd,
    struct 
 v4l2_subdev_mbus_code_enum *code)

 {
struct imx7_csi *csi = v4l2_get_subdevdata(sd);
-   const struct imx_media_pixfmt *in_cc;
struct v4l2_mbus_framefmt *in_fmt;
int ret = 0;
 
@@ -931,8 +930,6 @@ static int imx7_csi_enum_mbus_code(struct 
v4l2_subdev *sd,
 
 	in_fmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SINK, 
 code->which);
 
-	in_cc = imx_media_find_mbus_format(in_fmt->code, 
CS_SEL_ANY, true);

-
switch (code->pad) {
case IMX7_CSI_PAD_SINK:
 		ret = imx_media_enum_mbus_format(>code, 
 code->index,


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


Re: [PATCH 1/2] media: imx7-media-csi: don't store a floating pointer

2019-02-20 Thread Rui Miguel Silva

Oi Mauro,
On Tue 19 Feb 2019 at 13:24, Mauro Carvalho Chehab wrote:

if imx7_csi_try_fmt() fails, outcc variable won't be
initialized and csi->cc[IMX7_CSI_PAD_SRC] would be pointing
to a random location.

Signed-off-by: Mauro Carvalho Chehab 



Thanks for this, looks good.
Reviewed-by: Rui Miguel Silva 

---
Cheers,
Rui


---
 drivers/staging/media/imx/imx7-media-csi.c | 18 
 +++---

 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
b/drivers/staging/media/imx/imx7-media-csi.c

index d775e259fece..0b1788d79ce9 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -980,10 +980,10 @@ static int imx7_csi_get_fmt(struct 
v4l2_subdev *sd,

return ret;
 }
 
-static void imx7_csi_try_fmt(struct imx7_csi *csi,

-struct v4l2_subdev_pad_config *cfg,
-struct v4l2_subdev_format *sdformat,
-const struct imx_media_pixfmt **cc)
+static int imx7_csi_try_fmt(struct imx7_csi *csi,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_format *sdformat,
+   const struct imx_media_pixfmt **cc)
 {
const struct imx_media_pixfmt *in_cc;
struct v4l2_mbus_framefmt *in_fmt;
@@ -992,7 +992,7 @@ static void imx7_csi_try_fmt(struct imx7_csi 
*csi,

in_fmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SINK,
 sdformat->which);
if (!in_fmt)
-   return;
+   return -EINVAL;
 
 	switch (sdformat->pad) {

case IMX7_CSI_PAD_SRC:
@@ -1023,8 +1023,10 @@ static void imx7_csi_try_fmt(struct 
imx7_csi *csi,

   false);
break;
default:
+   return -EINVAL;
break;
}
+   return 0;
 }
 
 static int imx7_csi_set_fmt(struct v4l2_subdev *sd,
@@ -1067,8 +1069,10 @@ static int imx7_csi_set_fmt(struct 
v4l2_subdev *sd,

format.pad = IMX7_CSI_PAD_SRC;
format.which = sdformat->which;
format.format = sdformat->format;
-   imx7_csi_try_fmt(csi, cfg, , );
-
+   if (imx7_csi_try_fmt(csi, cfg, , )) {
+   ret = -EINVAL;
+   goto out_unlock;
+   }
 		outfmt = imx7_csi_get_format(csi, cfg, 
 IMX7_CSI_PAD_SRC,

 sdformat->which);
*outfmt = format.format;


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


Re: [PATCH] staging: erofs: remove rcu_read_lock() in erofs_try_to_free_cached_page

2019-02-20 Thread Gao Xiang



On 2019/2/20 18:20, Greg Kroah-Hartman wrote:
> On Wed, Feb 20, 2019 at 10:38:53AM +0800, Gao Xiang wrote:
>> Hi Greg,
>>
>> Could you consider take some time on these two patches for linux-5.1-rc1?
>>  1) staging: erofs: fix race of initializing xattrs of a inode at the same 
>> time
>>  2) staging: erofs: remove rcu_read_lock() in erofs_try_to_free_cached_page
>>
>> It will be of great help, especially patch 1 (it could cause potential 
>> memleak
>> in the race condition without it).
> 
> Ok, I'll queue them up now, I was waiting for reviewed-by tags from
> others to show up :)

Thanks! :)
Gao Xiang

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


Re: [PATCH] staging: erofs: remove rcu_read_lock() in erofs_try_to_free_cached_page

2019-02-20 Thread Greg Kroah-Hartman
On Wed, Feb 20, 2019 at 10:38:53AM +0800, Gao Xiang wrote:
> Hi Greg,
> 
> Could you consider take some time on these two patches for linux-5.1-rc1?
>  1) staging: erofs: fix race of initializing xattrs of a inode at the same 
> time
>  2) staging: erofs: remove rcu_read_lock() in erofs_try_to_free_cached_page
> 
> It will be of great help, especially patch 1 (it could cause potential memleak
> in the race condition without it).

Ok, I'll queue them up now, I was waiting for reviewed-by tags from
others to show up :)

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


Re: [PATCH v14 05/13] media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7

2019-02-20 Thread Hans Verkuil
On 2/6/19 4:13 PM, Rui Miguel Silva wrote:
> Adds MIPI CSI-2 subdev for i.MX7 to connect with sensors with a MIPI
> CSI-2 interface.
> 
> Signed-off-by: Rui Miguel Silva 
> ---
>  drivers/staging/media/imx/Makefile |1 +
>  drivers/staging/media/imx/imx7-mipi-csis.c | 1186 
>  2 files changed, 1187 insertions(+)
>  create mode 100644 drivers/staging/media/imx/imx7-mipi-csis.c
> 
> diff --git a/drivers/staging/media/imx/Makefile 
> b/drivers/staging/media/imx/Makefile
> index 074f016d3519..d2d909a36239 100644
> --- a/drivers/staging/media/imx/Makefile
> +++ b/drivers/staging/media/imx/Makefile
> @@ -14,3 +14,4 @@ obj-$(CONFIG_VIDEO_IMX_CSI) += imx-media-csi.o
>  obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o
>  
>  obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o
> +obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-mipi-csis.o
> diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c 
> b/drivers/staging/media/imx/imx7-mipi-csis.c
> new file mode 100644
> index ..516d308dc44b
> --- /dev/null
> +++ b/drivers/staging/media/imx/imx7-mipi-csis.c
> @@ -0,0 +1,1186 @@



> +static int mipi_csi_registered(struct v4l2_subdev *mipi_sd)
> +{
> + struct csi_state *state = mipi_sd_to_csis_state(mipi_sd);
> + unsigned int i;
> + int ret;
> +
> + for (i = 0; i < CSIS_PADS_NUM; i++) {
> + state->pads[i].flags = (i == CSIS_PAD_SINK) ?
> + MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
> + }
> +
> + /* set a default mbus format  */
> + ret = imx_media_init_mbus_fmt(>format_mbus,
> +   MIPI_CSIS_DEF_PIX_HEIGHT,
> +   MIPI_CSIS_DEF_PIX_WIDTH, 0,
> +   V4L2_FIELD_NONE, NULL);
> + if (ret)
> + return ret;
> +
> + return media_entity_pads_init(_sd->entity, CSIS_PADS_NUM,
> +   state->pads);
> +}
> +
> +static const struct v4l2_subdev_core_ops mipi_csis_core_ops = {
> + .log_status = mipi_csis_log_status,
> +};
> +
> +static const struct media_entity_operations mipi_csis_entity_ops = {
> + .link_setup = mipi_csis_link_setup,
> + .link_validate  = v4l2_subdev_link_validate,
> +};
> +
> +static const struct v4l2_subdev_video_ops mipi_csis_video_ops = {
> + .s_stream   = mipi_csis_s_stream,
> +};
> +
> +static const struct v4l2_subdev_pad_ops mipi_csis_pad_ops = {
> + .init_cfg   = mipi_csis_init_cfg,
> + .get_fmt= mipi_csis_get_fmt,
> + .set_fmt= mipi_csis_set_fmt,
> +};
> +
> +static const struct v4l2_subdev_ops mipi_csis_subdev_ops = {
> + .core   = _csis_core_ops,
> + .video  = _csis_video_ops,
> + .pad= _csis_pad_ops,
> +};
> +
> +static const struct v4l2_subdev_internal_ops mipi_csis_internal_ops = {
> + .registered = mipi_csi_registered,
> +};

This struct is not used, and therefor mipi_csi_registered() is never called
either. Should it be called or can this be removed?

Regards,

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