[patch] staging: gdm724x: fix a couple array overflows

2017-02-07 Thread Dan Carpenter
The find_dev_index() function is frustrating.  If you give it an invalid
index then it returns 0.  That was the intent except there is an
off-by-one so it can return MAX_NIC_TYPE which is one higher than we
want.

There is one caller which had a sanity check to catch invalid returns,
but the other two callers assumed that index was valid.

My feeling is that when we are given invalid indexes, that should be
treated like an error and we abandon what we were doing.

Signed-off-by: Dan Carpenter 
---
Not tested.

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index a182757544c8..02b269ac25e5 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -560,13 +560,13 @@ void gdm_lte_event_exit(void)
}
 }
 
-static u8 find_dev_index(u32 nic_type)
+static int find_dev_index(u32 nic_type)
 {
u8 index;
 
index = (u8)(nic_type & 0x000f);
-   if (index > MAX_NIC_TYPE)
-   index = 0;
+   if (index >= MAX_NIC_TYPE)
+   return -EINVAL;
 
return index;
 }
@@ -695,7 +695,7 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, 
char *buf, int len)
u16 hci_len;
u16 cmd_evt;
u32 nic_type;
-   u8 index;
+   int index;
 
hci_len = gdm_dev16_to_cpu(endian, multi_sdu->len);
num_packet = gdm_dev16_to_cpu(endian, multi_sdu->num_packet);
@@ -717,13 +717,13 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev 
*phy_dev, char *buf, int len)
}
 
index = find_dev_index(nic_type);
-   if (index < MAX_NIC_TYPE) {
-   dev = phy_dev->dev[index];
-   gdm_lte_netif_rx(dev, (char *)sdu->data,
-(int)(hci_len - 12), nic_type);
-   } else {
+   if (index < 0) {
pr_err("rx sdu invalid nic_type :%x\n", nic_type);
+   return;
}
+   dev = phy_dev->dev[index];
+   gdm_lte_netif_rx(dev, (char *)sdu->data,
+(int)(hci_len - 12), nic_type);
 
data += ((hci_len + 3) & 0xfffc) + HCI_HEADER_SIZE;
}
@@ -763,7 +763,7 @@ static int gdm_lte_receive_pkt(struct phy_dev *phy_dev, 
char *buf, int len)
int ret = 0;
u16 cmd_evt;
u32 nic_type;
-   u8 index;
+   int index;
 
if (!len)
return ret;
@@ -779,6 +779,8 @@ static int gdm_lte_receive_pkt(struct phy_dev *phy_dev, 
char *buf, int len)
sdu = (struct sdu *)hci->data;
nic_type = gdm_dev32_to_cpu(endian, sdu->nic_type);
index = find_dev_index(nic_type);
+   if (index < 0)
+   return index;
dev = phy_dev->dev[index];
gdm_lte_netif_rx(dev, hci->data, len, nic_type);
break;
@@ -794,6 +796,8 @@ static int gdm_lte_receive_pkt(struct phy_dev *phy_dev, 
char *buf, int len)
pdn_table = (struct hci_pdn_table_ind *)buf;
nic_type = gdm_dev32_to_cpu(endian, pdn_table->nic_type);
index = find_dev_index(nic_type);
+   if (index < 0)
+   return index;
dev = phy_dev->dev[index];
gdm_lte_pdn_table(dev, buf, len);
/* Fall through */
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: sm750fb: Replace POKE32 and PEEK32 by inline functions

2017-02-07 Thread Matthieu Simon
POKE32 and PEEK32 have been replaced by inlined functions poke32 and
peek32.
Having inline functions instead of macros help to get the correct
type-checking and avoid the possible precedence issues reported by
checkpatch.

Signed-off-by: Matthieu Simon 
---
 drivers/staging/sm750fb/ddk750_chip.c|  42 ++---
 drivers/staging/sm750fb/ddk750_chip.h|  13 +++-
 drivers/staging/sm750fb/ddk750_display.c |  44 ++---
 drivers/staging/sm750fb/ddk750_hwi2c.c   |  38 ++--
 drivers/staging/sm750fb/ddk750_mode.c|  38 ++--
 drivers/staging/sm750fb/ddk750_power.c   |  26 
 drivers/staging/sm750fb/ddk750_power.h   |   4 +-
 drivers/staging/sm750fb/ddk750_swi2c.c   |  34 +--
 drivers/staging/sm750fb/sm750_cursor.c   |  12 ++--
 drivers/staging/sm750fb/sm750_hw.c   | 102 +++
 10 files changed, 180 insertions(+), 173 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 9aaf1fdad08d..10cf7295dc6c 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -38,7 +38,7 @@ static unsigned int get_mxclk_freq(void)
if (sm750_get_chip_type() == SM750LE)
return MHz(130);
 
-   pll_reg = PEEK32(MXCLK_PLL_CTRL);
+   pll_reg = peek32(MXCLK_PLL_CTRL);
M = (pll_reg & PLL_CTRL_M_MASK) >> PLL_CTRL_M_SHIFT;
N = (pll_reg & PLL_CTRL_N_MASK) >> PLL_CTRL_M_SHIFT;
OD = (pll_reg & PLL_CTRL_OD_MASK) >> PLL_CTRL_OD_SHIFT;
@@ -78,7 +78,7 @@ static void set_chip_clock(unsigned int frequency)
ulActualMxClk = sm750_calc_pll_value(frequency, );
 
/* Master Clock Control: MXCLK_PLL */
-   POKE32(MXCLK_PLL_CTRL, sm750_format_pll_reg());
+   poke32(MXCLK_PLL_CTRL, sm750_format_pll_reg());
}
 }
 
@@ -105,7 +105,7 @@ static void set_memory_clock(unsigned int frequency)
divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
 
/* Set the corresponding divisor in the register. */
-   reg = PEEK32(CURRENT_GATE) & ~CURRENT_GATE_M2XCLK_MASK;
+   reg = peek32(CURRENT_GATE) & ~CURRENT_GATE_M2XCLK_MASK;
switch (divisor) {
default:
case 1:
@@ -157,7 +157,7 @@ static void set_master_clock(unsigned int frequency)
divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency);
 
/* Set the corresponding divisor in the register. */
-   reg = PEEK32(CURRENT_GATE) & ~CURRENT_GATE_MCLK_MASK;
+   reg = peek32(CURRENT_GATE) & ~CURRENT_GATE_MCLK_MASK;
switch (divisor) {
default:
case 3:
@@ -188,12 +188,12 @@ unsigned int ddk750_get_vm_size(void)
return SZ_64M;
 
/* for 750,always use power mode0*/
-   reg = PEEK32(MODE0_GATE);
+   reg = peek32(MODE0_GATE);
reg |= MODE0_GATE_GPIO;
-   POKE32(MODE0_GATE, reg);
+   poke32(MODE0_GATE, reg);
 
/* get frame buffer size from GPIO */
-   reg = PEEK32(MISC_CTRL) & MISC_CTRL_LOCALMEM_SIZE_MASK;
+   reg = peek32(MISC_CTRL) & MISC_CTRL_LOCALMEM_SIZE_MASK;
switch (reg) {
case MISC_CTRL_LOCALMEM_SIZE_8M:
data = SZ_8M;  break; /* 8  Mega byte */
@@ -219,15 +219,15 @@ int ddk750_init_hw(struct initchip_param *pInitParam)
sm750_set_power_mode(pInitParam->powerMode);
 
/* Enable display power gate & LOCALMEM power gate*/
-   reg = PEEK32(CURRENT_GATE);
+   reg = peek32(CURRENT_GATE);
reg |= (CURRENT_GATE_DISPLAY | CURRENT_GATE_LOCALMEM);
sm750_set_current_gate(reg);
 
if (sm750_get_chip_type() != SM750LE) {
/*  set panel pll and graphic mode via mmio_88 */
-   reg = PEEK32(VGA_CONFIGURATION);
+   reg = peek32(VGA_CONFIGURATION);
reg |= (VGA_CONFIGURATION_PLL | VGA_CONFIGURATION_MODE);
-   POKE32(VGA_CONFIGURATION, reg);
+   poke32(VGA_CONFIGURATION, reg);
} else {
 #if defined(__i386__) || defined(__x86_64__)
/* set graphic mode via IO method */
@@ -252,36 +252,36 @@ int ddk750_init_hw(struct initchip_param *pInitParam)
 * The memory should be resetted after changing the MXCLK.
 */
if (pInitParam->resetMemory == 1) {
-   reg = PEEK32(MISC_CTRL);
+   reg = peek32(MISC_CTRL);
reg &= ~MISC_CTRL_LOCALMEM_RESET;
-   POKE32(MISC_CTRL, reg);
+   poke32(MISC_CTRL, reg);
 
reg |= MISC_CTRL_LOCALMEM_RESET;
-   POKE32(MISC_CTRL, reg);
+   poke32(MISC_CTRL, reg);
}
 
if (pInitParam->setAllEngOff == 1) {
sm750_enable_2d_engine(0);
 
/* Disable Overlay, if a former application left it on */
-   reg = 

Re: [lustre-devel] [PATCH 10/60] staging: lustre: obdclass: add more info to sysfs version string

2017-02-07 Thread Greg Kroah-Hartman
On Wed, Feb 08, 2017 at 01:04:52AM +, Dilger, Andreas wrote:
> 
> > On Feb 3, 2017, at 03:33, Greg Kroah-Hartman  
> > wrote:
> > 
> > On Sat, Jan 28, 2017 at 07:04:38PM -0500, James Simmons wrote:
> >> From: Andreas Dilger 
> >> 
> >> Update the sysfs "version" file to print "lustre: " with
> >> the version number.
> >> 
> >> Signed-off-by: Andreas Dilger 
> >> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5969
> >> Reviewed-on: http://review.whamcloud.com/16721
> >> Reviewed-by: James Simmons 
> >> Reviewed-by: Dmitry Eremin 
> >> Reviewed-by: Oleg Drokin 
> >> Signed-off-by: James Simmons 
> >> ---
> >> drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
> >> b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> >> index 9f5e829..22e6d1f 100644
> >> --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> >> +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
> >> @@ -208,7 +208,7 @@ struct miscdevice obd_psdev = {
> >> static ssize_t version_show(struct kobject *kobj, struct attribute *attr,
> >>char *buf)
> >> {
> >> -  return sprintf(buf, "%s\n", LUSTRE_VERSION_STRING);
> >> +  return sprintf(buf, "lustre: %s\n", LUSTRE_VERSION_STRING);
> >> }
> > 
> > Why?  You "know" this is lustre, why say it again?  Doesn't this affect
> > userspace tools?
> 
> It included "lustre: " as a prefix until commit 8b8284450569 when the code
> moved from /proc to /sys, and is what the userspace tools expect.  Formerly
> there were multiple strings printed in this file, each with a different 
> prefix,
> but the "lustre: " prefix was dropped in the move to sysfs.
> 
> That didn't matter until a userspace patch to stop using 
> ioctl(IOC_GET_VERSION)
> and instead get the version from the existing /proc or /sys files, so that we
> can deprecate and eventually drop the IOC_GET_VERSION ioctl completely.
> 
> So this patch is returning to the previous format of the /proc file, but if
> there is a big objection to this patch we can also change the userspace tools
> to live with or without this prefix now that there is only a single value 
> here.

Think about it, it's a sysfs file, which should only have one value to
start with, and you are opening it from userspace knowing exactly where
it is (somewhere in the lustre subtree), so of course you know it is
"lustre"...

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


Re: [PATCH v2] staging: rtl8712: rtl8712: fix sparse warnings

2017-02-07 Thread Dan Carpenter
On Wed, Feb 08, 2017 at 01:23:15AM +, Carlos Palminha wrote:
> Fixed sparse warnings
> * No need to convert from le32, pointers for structure with same endianness 
> (cast from restricted __le32)
> * Need to convert bitwise operation for le32 structure (invalid assignment 
> from int to __le32)
> 
> Signed-off-by: Carlos Palminha 
> ---
> Changes v1->v2:
> * Clarify patch description to ensure confidence
> 
>  drivers/staging/rtl8712/rtl8712_xmit.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c 
> b/drivers/staging/rtl8712/rtl8712_xmit.c
> index c4f03a602a2e..67713643c923 100644
> --- a/drivers/staging/rtl8712/rtl8712_xmit.c
> +++ b/drivers/staging/rtl8712/rtl8712_xmit.c
> @@ -561,19 +561,19 @@ static void update_txdesc(struct xmit_frame 
> *pxmitframe, uint *pmem, int sz)
> 
>   ptxdesc_mp = _mp;
>   /* offset 8 */
> - ptxdesc->txdw2 = cpu_to_le32(ptxdesc_mp->txdw2);
> + ptxdesc->txdw2 = ptxdesc_mp->txdw2;

Nah...  The original is done deliberately.  When I'm reviewing this
patch I can see that now.

Just leave this as-is.

regards,
dan carpenter


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


Re: [PATCH] staging: rtl8712: rtl8712: fix sparse warnings

2017-02-07 Thread Dan Carpenter
On Wed, Feb 08, 2017 at 01:19:39AM +, Carlos Palminha wrote:
> 
> 
> On 08-02-2017 00:58, Dan Carpenter wrote:
> >On Wed, Feb 08, 2017 at 12:47:22AM +, Carlos Palminha wrote:
> >>Fixed the following sparse warnings:
> >>* cast from restricted __le32
> >>* invalid assignment from int to __le32
> >>
> >
> >The changelog doesn't give me any confidence that you understand the
> >implications of this patch.  You silenced the warning but I think you
> >may be introducing bugs (I haven't done a thourough review).
> >
> >regards,
> >dan carpenter
> >
> true... i was short on words.
> will resend v2 with better description.

I'm pretty sure the original code is correct and just the sparse
annotations are wrong.

regards,
dan carpenter

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


Re: [PATCH] staging: vc04_services: remove unused functions

2017-02-07 Thread Michael Zoran
On Wed, 2017-02-08 at 01:19 +0300, Dan Carpenter wrote:
> On Tue, Feb 07, 2017 at 01:13:34PM -0800, Eric Anholt wrote:
> > Dan Carpenter  writes:
> > 
> > > There is a bunch of vc04_services that we're still looking to
> > > merge in
> > > the near future.  Please hold off deleting these until we are
> > > further
> > > along on that.
> > 
> > Checking the downstream tree, these are actually dead.
> 
> Ahh...  Thanks.  In that case, of course, fine let's remove them.
> 
> regards,
> dan carpenter
> 

I made a table awhile ago as to which entry points are being used by
what.  Most of the entry points are indeed only being used by those
other drivers which exist mostly to support a debugging tool called
vcdbg(which I didn't find that useful).

The other drivers are small drivers, but I'm not sure bringing them
here makes much sense either especially since they are mostly to
support that debugging tool.  Which complicates things because probably
half the driver could be otherwise deleted instantly.

I attached a list of driver exports and which drivers are using them.



interface/vchiq_arm/vchiq_connected.c:EXPORT_SYMBOL(vchiq_add_connected_callback)
   --  Github(vc_cma/vc_cma.c & vc_sm/vmcs_sm.c)
interface/vchiq_arm/vchiq_kern_lib.c:EXPORT_SYMBOL(vchiq_initialise)
--  Github(vc_cma/vc_cma.c)
interface/vchiq_arm/vchiq_kern_lib.c:EXPORT_SYMBOL(vchiq_shutdown)  
--  Github(vc_cma/vc_cma.c)
interface/vchiq_arm/vchiq_kern_lib.c:EXPORT_SYMBOL(vchiq_connect)   
--  Github(vc_cma/vc_cma.c)
interface/vchiq_arm/vchiq_kern_lib.c:EXPORT_SYMBOL(vchiq_add_service)   
--  Internal Only
interface/vchiq_arm/vchiq_kern_lib.c:EXPORT_SYMBOL(vchiq_open_service)  
--  Github(vc_cma/vc_cma.c)
interface/vchiq_arm/vchiq_kern_lib.c:EXPORT_SYMBOL(vchiq_queue_bulk_transmit)   
--  Internal Only
interface/vchiq_arm/vchiq_kern_lib.c:EXPORT_SYMBOL(vchiq_queue_bulk_receive)
--  Internal Only
interface/vchiq_arm/vchiq_kern_lib.c:EXPORT_SYMBOL(vchiq_bulk_transmit) 
--  Internal Only
interface/vchiq_arm/vchiq_kern_lib.c:EXPORT_SYMBOL(vchiq_bulk_receive)  
--  Internal Only
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_msg_peek)   
--  Github(vc_sm/vc_vchi_sm.c)
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_msg_remove) 
--  Github(vc_sm/vc_vchi_sm.c)
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_msg_queue)  
--  bcm2835/mmal-vchiq.c, bcm2835-audio/bcm2835-vchiq.c, 
Github(vc_sm/vc_vchi_sm.c)
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_bulk_queue_receive) 
--  bcm2835/mmal-vchiq.c
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_bulk_queue_transmit)
--  bcm2835-audio/bcm2835-vchiq.c
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_msg_dequeue)
--  bcm2835-audio/bcm2835-vchiq.c
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_held_msg_release)   
--  bcm2835/mmal-vchiq.c
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_msg_hold)   
--  bcm2835/mmal-vchiq.c
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_initialise) 
--  bcm2835/mmal-vchiq.c, bcm2835-audio/bcm2835-vchiq.c, 
Github(vc_sm/vmcs_sm.c)
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_connect)
--  bcm2835/mmal-vchiq.c, Github(vc_sm/vmcs_sm.c)
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_disconnect) 
--  Internal Only
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_service_open)   
--  bcm2835/mmal-vchiq.c, Github(vc_sm/vc_vchi_sm.c)
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_service_create) 
--  Internal Only
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_service_close)  
--  Github(vc_sm/vc_vchi_sm.c)
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_service_destroy)
--  Internal Only
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_service_set_option) 
--  Internal Only
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_get_peer_version)   
--  bcm2835-audio/bcm2835-vchiq.c
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_service_use)
--  bcm2835/mmal-vchiq.c, bcm2835-audio/bcm2835-vchiq.c, 
Github(vc_sm/vc_vchi_sm.c)
interface/vchiq_arm/vchiq_shim.c:EXPORT_SYMBOL(vchi_service_release)
--  bcm2835/mmal-vchiq.c, bcm2835-audio/bcm2835-vchiq.c
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: rtl8712: rtl8712: fix sparse warnings

2017-02-07 Thread Carlos Palminha
Fixed sparse warnings
* No need to convert from le32, pointers for structure with same endianness 
(cast from restricted __le32)
* Need to convert bitwise operation for le32 structure (invalid assignment from 
int to __le32)

Signed-off-by: Carlos Palminha 
---
Changes v1->v2:
* Clarify patch description to ensure confidence

 drivers/staging/rtl8712/rtl8712_xmit.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c 
b/drivers/staging/rtl8712/rtl8712_xmit.c
index c4f03a602a2e..67713643c923 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -561,19 +561,19 @@ static void update_txdesc(struct xmit_frame *pxmitframe, 
uint *pmem, int sz)

ptxdesc_mp = _mp;
/* offset 8 */
-   ptxdesc->txdw2 = cpu_to_le32(ptxdesc_mp->txdw2);
+   ptxdesc->txdw2 = ptxdesc_mp->txdw2;
if (bmcst)
ptxdesc->txdw2 |= cpu_to_le32(BMC);
ptxdesc->txdw2 |= cpu_to_le32(BK);
/* offset 16 */
-   ptxdesc->txdw4 = cpu_to_le32(ptxdesc_mp->txdw4);
+   ptxdesc->txdw4 = ptxdesc_mp->txdw4;
/* offset 20 */
-   ptxdesc->txdw5 = cpu_to_le32(ptxdesc_mp->txdw5);
+   ptxdesc->txdw5 = ptxdesc_mp->txdw5;
pattrib->pctrl = 0;/* reset to zero; */
}
} else if (pxmitframe->frame_tag == MGNT_FRAMETAG) {
/* offset 4 */
-   ptxdesc->txdw1 |= (0x05) & 0x1f;/*CAM_ID(MAC_ID), default=5;*/
+   ptxdesc->txdw1 |= cpu_to_le32((0x05) & 0x1f);/*CAM_ID(MAC_ID), 
default=5;*/
qsel = (uint)(pattrib->qsel & 0x001f);
ptxdesc->txdw1 |= cpu_to_le32((qsel << QSEL_SHT) & 0x1f00);
ptxdesc->txdw1 |= cpu_to_le32(BIT(16));/* Non-QoS */
--
2.11.0

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


Re: [PATCH] staging: rtl8712: rtl8712: fix sparse warnings

2017-02-07 Thread Carlos Palminha



On 08-02-2017 00:58, Dan Carpenter wrote:

On Wed, Feb 08, 2017 at 12:47:22AM +, Carlos Palminha wrote:

Fixed the following sparse warnings:
* cast from restricted __le32
* invalid assignment from int to __le32



The changelog doesn't give me any confidence that you understand the
implications of this patch.  You silenced the warning but I think you
may be introducing bugs (I haven't done a thourough review).

regards,
dan carpenter


true... i was short on words.
will resend v2 with better description.

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


Re: [lustre-devel] [PATCH 10/60] staging: lustre: obdclass: add more info to sysfs version string

2017-02-07 Thread Dilger, Andreas

> On Feb 3, 2017, at 03:33, Greg Kroah-Hartman  
> wrote:
> 
> On Sat, Jan 28, 2017 at 07:04:38PM -0500, James Simmons wrote:
>> From: Andreas Dilger 
>> 
>> Update the sysfs "version" file to print "lustre: " with
>> the version number.
>> 
>> Signed-off-by: Andreas Dilger 
>> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5969
>> Reviewed-on: http://review.whamcloud.com/16721
>> Reviewed-by: James Simmons 
>> Reviewed-by: Dmitry Eremin 
>> Reviewed-by: Oleg Drokin 
>> Signed-off-by: James Simmons 
>> ---
>> drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c 
>> b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>> index 9f5e829..22e6d1f 100644
>> --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>> +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
>> @@ -208,7 +208,7 @@ struct miscdevice obd_psdev = {
>> static ssize_t version_show(struct kobject *kobj, struct attribute *attr,
>>  char *buf)
>> {
>> -return sprintf(buf, "%s\n", LUSTRE_VERSION_STRING);
>> +return sprintf(buf, "lustre: %s\n", LUSTRE_VERSION_STRING);
>> }
> 
> Why?  You "know" this is lustre, why say it again?  Doesn't this affect
> userspace tools?

It included "lustre: " as a prefix until commit 8b8284450569 when the code
moved from /proc to /sys, and is what the userspace tools expect.  Formerly
there were multiple strings printed in this file, each with a different prefix,
but the "lustre: " prefix was dropped in the move to sysfs.

That didn't matter until a userspace patch to stop using ioctl(IOC_GET_VERSION)
and instead get the version from the existing /proc or /sys files, so that we
can deprecate and eventually drop the IOC_GET_VERSION ioctl completely.

So this patch is returning to the previous format of the /proc file, but if
there is a big objection to this patch we can also change the userspace tools
to live with or without this prefix now that there is only a single value here.

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation







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


Re: [PATCH] staging: rtl8712: rtl8712: fix sparse warnings

2017-02-07 Thread Dan Carpenter
On Wed, Feb 08, 2017 at 12:47:22AM +, Carlos Palminha wrote:
> Fixed the following sparse warnings:
> * cast from restricted __le32
> * invalid assignment from int to __le32
> 

The changelog doesn't give me any confidence that you understand the
implications of this patch.  You silenced the warning but I think you
may be introducing bugs (I haven't done a thourough review).

regards,
dan carpenter

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


[PATCH] staging: rtl8712: rtl8712: fix sparse warnings

2017-02-07 Thread Carlos Palminha
Fixed the following sparse warnings:
* cast from restricted __le32
* invalid assignment from int to __le32

Signed-off-by: Carlos Palminha 
---
 drivers/staging/rtl8712/rtl8712_xmit.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_xmit.c 
b/drivers/staging/rtl8712/rtl8712_xmit.c
index c4f03a602a2e..67713643c923 100644
--- a/drivers/staging/rtl8712/rtl8712_xmit.c
+++ b/drivers/staging/rtl8712/rtl8712_xmit.c
@@ -561,19 +561,19 @@ static void update_txdesc(struct xmit_frame *pxmitframe, 
uint *pmem, int sz)

ptxdesc_mp = _mp;
/* offset 8 */
-   ptxdesc->txdw2 = cpu_to_le32(ptxdesc_mp->txdw2);
+   ptxdesc->txdw2 = ptxdesc_mp->txdw2;
if (bmcst)
ptxdesc->txdw2 |= cpu_to_le32(BMC);
ptxdesc->txdw2 |= cpu_to_le32(BK);
/* offset 16 */
-   ptxdesc->txdw4 = cpu_to_le32(ptxdesc_mp->txdw4);
+   ptxdesc->txdw4 = ptxdesc_mp->txdw4;
/* offset 20 */
-   ptxdesc->txdw5 = cpu_to_le32(ptxdesc_mp->txdw5);
+   ptxdesc->txdw5 = ptxdesc_mp->txdw5;
pattrib->pctrl = 0;/* reset to zero; */
}
} else if (pxmitframe->frame_tag == MGNT_FRAMETAG) {
/* offset 4 */
-   ptxdesc->txdw1 |= (0x05) & 0x1f;/*CAM_ID(MAC_ID), default=5;*/
+   ptxdesc->txdw1 |= cpu_to_le32((0x05) & 0x1f);/*CAM_ID(MAC_ID), 
default=5;*/
qsel = (uint)(pattrib->qsel & 0x001f);
ptxdesc->txdw1 |= cpu_to_le32((qsel << QSEL_SHT) & 0x1f00);
ptxdesc->txdw1 |= cpu_to_le32(BIT(16));/* Non-QoS */
--
2.11.0

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


[PATCH v3] staging: bcm2835-audio: Remove the initialization of static pointers.

2017-02-07 Thread AbdAllah-MEZITI
In C a static pointer will be initialized to NULL.
The §6.7.8 of the ISO/IEC 9899:1999 (E) document says that:
If an object that has static storage duration is not initialized
explicitly, then:
 __ if it has pointer type, it is initialized to a null pointer.

Signed-off-by: AbdAllah-MEZITI 

v2: -fix the line-wrapping of the changelog.
-fix the ref. documentation: C99 standards release,
and not the draft.
-this patch is the Task 10 Eudyptula Challenge
that only fix one code style problem.
v3: -fix the subject prefix: must be based on the previous submissions.
---
 drivers/staging/bcm2835-audio/bcm2835.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index a84d74d..265fe55 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -28,8 +28,8 @@
  * to debug if we run into issues
  */
 
-static struct snd_card *g_card = NULL;
-static struct bcm2835_chip *g_chip = NULL;
+static struct snd_card *g_card;
+static struct bcm2835_chip *g_chip;
 
 static int snd_bcm2835_free(struct bcm2835_chip *chip)
 {
-- 
2.7.4

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


Re: [PATCH v2] somedriver: remove the initialization of static pointers.

2017-02-07 Thread Florian Fainelli
On 02/07/2017 01:55 PM, AbdAllah-MEZITI wrote:
> In C a static pointer will be initialized to NULL.
> The §6.7.8 of the ISO/IEC 9899:1999 (E) document says that:
> If an object that has static storage duration is not initialized
> explicitly, then:
>  __ if it has pointer type, it is initialized to a null pointer.

The commit subject should be based on previous submissions, if you do a
git log --oneline drivers/staging/bcm2835-audio/bcm2835.c you will see
that the most frequent subject used was:

Staging: bcm2835-audio:

So you should utilize the same subject prefix, and make your prefix be
something like:

Staging: bcm2835-audio: Remove the initialization of static pointers

> 
> Signed-off-by: AbdAllah-MEZITI 
> 
> v2: -fix the line-wrapping of the changelog.
> -fix the ref. documentation: C99 standards release,
>   and not the draft.
> -this patch is the Task 10 Eudyptula Challenge
>   that only fix one code style problem.
> ---
>  drivers/staging/bcm2835-audio/bcm2835.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
> b/drivers/staging/bcm2835-audio/bcm2835.c
> index a84d74d..265fe55 100644
> --- a/drivers/staging/bcm2835-audio/bcm2835.c
> +++ b/drivers/staging/bcm2835-audio/bcm2835.c
> @@ -28,8 +28,8 @@
>   * to debug if we run into issues
>   */
>  
> -static struct snd_card *g_card = NULL;
> -static struct bcm2835_chip *g_chip = NULL;
> +static struct snd_card *g_card;
> +static struct bcm2835_chip *g_chip;
>  
>  static int snd_bcm2835_free(struct bcm2835_chip *chip)
>  {
> 


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


Re: [PATCH v3 13/24] platform: add video-multiplexer subdevice driver

2017-02-07 Thread Laurent Pinchart
Hi Benoit,

On Tuesday 07 Feb 2017 07:36:48 Benoit Parrot wrote:
> Laurent Pinchart wrote on Tue [2017-Feb-07 12:26:32 +0200]:
> > On Monday 06 Feb 2017 15:10:46 Steve Longerbeam wrote:
> >> On 02/06/2017 02:33 PM, Laurent Pinchart wrote:
> >>> On Monday 06 Feb 2017 10:50:22 Hans Verkuil wrote:
>  On 02/05/2017 04:48 PM, Laurent Pinchart wrote:
> > On Tuesday 24 Jan 2017 18:07:55 Steve Longerbeam wrote:
> >> On 01/24/2017 04:02 AM, Philipp Zabel wrote:
> >>> On Fri, 2017-01-20 at 15:03 +0100, Hans Verkuil wrote:
> > +
> > +int vidsw_g_mbus_config(struct v4l2_subdev *sd, struct
> > v4l2_mbus_config *cfg)
> > 
> > [snip]
> > 
>  I am not certain this op is needed at all. In the current kernel
>  this op is only used by soc_camera, pxa_camera and omap3isp
>  (somewhat dubious). Normally this information should come from the
>  device tree and there should be no need for this op.
>  
>  My (tentative) long-term plan was to get rid of this op.
>  
>  If you don't need it, then I recommend it is removed.
> >> 
> >> Hi Hans, the imx-media driver was only calling g_mbus_config to the
> >> camera sensor, and it was doing that to determine the sensor's bus
> >> type. This info was already available from parsing a
> >> v4l2_of_endpoint from the sensor node. So it was simple to remove the
> >> g_mbus_config calls, and instead rely on the parsed sensor
> >> v4l2_of_endpoint.
> > 
> > That's not a good point.
> >>> 
> >>> (mea culpa, s/point/idea/)
> >>> 
> > The imx-media driver must not parse the sensor DT node as it is not
> > aware of what bindings the sensor is compatible with.
> >> 
> >> Hi Laurent,
> >> 
> >> I don't really understand this argument. The sensor node has been found
> >> by parsing the OF graph, so it is known to be a camera sensor node at
> >> that point.
> > 
> > All you know in the i.MX6 driver is that the remote node is a video
> > source. You can rely on the fact that it implements the OF graph bindings
> > to locate other ports in that DT node, but that's more or less it.
> > 
> > DT properties are defined by DT bindings and thus qualified by a
> > compatible string. Unless you match on sensor compat strings in the i.MX6
> > driver (which you shouldn't do, to keep the driver generic) you can't know
> > for certain how to parse the sensor node DT properties. For all you know,
> > the video source could be a bridge such as an HDMI to CSI-2 converter for
> > instance, so you can't even rely on the fact that it's a sensor.
> > 
> > Information must instead be queried from the sensor subdev at
> > runtime, through the g_mbus_config() operation.
> > 
> > Of course, if you can get the information from the imx-media DT
> > node, that's certainly an option. It's only information provided by
> > the sensor driver that you have no choice but query using a subdev
> > operation.
>  
>  Shouldn't this come from the imx-media DT node? BTW, why is omap3isp
>  using this?
> >>> 
> >>> It all depends on what type of information needs to be retrieved, and
> >>> whether it can change at runtime or is fixed. Adding properties to the
> >>> imx-media DT node is certainly fine as long as those properties
> >>> describe the i.MX side.
> >> 
> >> In this case the info needed is the media bus type. That info is most
> >> easily available by calling v4l2_of_parse_endpoint() on the sensor's
> >> endpoint node.
> > 
> > I haven't had time to check the code in details yet, so I can't really
> > comment on what you need and how it should be implemented exactly.
> > 
> >> The media bus type is not something that can be added to the
> >> imx-media node since it contains no endpoint nodes.
> > 
> > Agreed. You have endpoints in the CSI nodes though.
> > 
> >>> In the omap3isp case, we use the operation to query whether parallel
> >>> data contains embedded sync (BT.656) or uses separate h/v sync signals.
> >>> 
>  The reason I am suspicious about this op is that it came from
>  soc-camera and predates the DT. The contents of v4l2_mbus_config seems
>  very much like a HW description to me, i.e. something that belongs in
>  the DT.
> >>> 
> >>> Part of it is possibly outdated, but for buses that support multiple
> >>> modes of operation (such as the parallel bus case described above) we
> >>> need to make that information discoverable at runtime. Maybe this should
> >>> be considered as related to Sakari's efforts to support VC/DT for CSI-2,
> >>> and supported through the API he is working on.
> >> 
> >> That sounds interesting, can you point me to some info on this effort?
> > 
> > Sure.
> > 
> > http://git.retiisi.org.uk/?p=~sailus/linux.git;a=shortlog;h=refs/heads/vc
> > 
> >> I've been thinking the DT should contain virtual channel info for CSI-2
> >> buses.
> > 
> > I don't think it should. CSI-2 virtual channels and data 

Re: [PATCH] staging: vc04_services: remove unused functions

2017-02-07 Thread Dan Carpenter
On Tue, Feb 07, 2017 at 01:13:34PM -0800, Eric Anholt wrote:
> Dan Carpenter  writes:
> 
> > There is a bunch of vc04_services that we're still looking to merge in
> > the near future.  Please hold off deleting these until we are further
> > along on that.
> 
> Checking the downstream tree, these are actually dead.

Ahh...  Thanks.  In that case, of course, fine let's remove them.

regards,
dan carpenter

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


[PATCH v2] somedriver: remove the initialization of static pointers.

2017-02-07 Thread AbdAllah-MEZITI
In C a static pointer will be initialized to NULL.
The §6.7.8 of the ISO/IEC 9899:1999 (E) document says that:
If an object that has static storage duration is not initialized
explicitly, then:
 __ if it has pointer type, it is initialized to a null pointer.

Signed-off-by: AbdAllah-MEZITI 

v2: -fix the line-wrapping of the changelog.
-fix the ref. documentation: C99 standards release,
and not the draft.
-this patch is the Task 10 Eudyptula Challenge
that only fix one code style problem.
---
 drivers/staging/bcm2835-audio/bcm2835.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index a84d74d..265fe55 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -28,8 +28,8 @@
  * to debug if we run into issues
  */
 
-static struct snd_card *g_card = NULL;
-static struct bcm2835_chip *g_chip = NULL;
+static struct snd_card *g_card;
+static struct bcm2835_chip *g_chip;
 
 static int snd_bcm2835_free(struct bcm2835_chip *chip)
 {
-- 
2.7.4

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


Re: [PATCH] staging: vc04_services: remove unused functions

2017-02-07 Thread Eric Anholt
Dan Carpenter  writes:

> There is a bunch of vc04_services that we're still looking to merge in
> the near future.  Please hold off deleting these until we are further
> along on that.

Checking the downstream tree, these are actually dead.


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


Re: [bug report] PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs

2017-02-07 Thread Dan Carpenter
On Tue, Feb 07, 2017 at 04:11:33PM +, Jake Oshins wrote:
> > -Original Message-
> > From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> > Sent: Monday, February 6, 2017 11:12 PM
> > To: Jake Oshins 
> > Cc: de...@linuxdriverproject.org; linux-...@vger.kernel.org
> > Subject: [bug report] PCI: hv: Add paravirtual PCI front-end for Microsoft
> > Hyper-V VMs
> > 
> > [ No idea why I haven never sent this email before.  I was just going
> >   through all the use after free warnings again today and noticed it. ]
> > 
> > Hello Jake Oshins,
> > 
> > The patch 4daace0d8ce8: "PCI: hv: Add paravirtual PCI front-end for
> > Microsoft Hyper-V VMs" from Feb 16, 2016, leads to the following
> > static checker warning:
> > 
> > drivers/pci/host/pci-hyperv.c:1441 pci_devices_present_work()
> > error: dereferencing freed memory 'dr'
> > 
> > drivers/pci/host/pci-hyperv.c
> >   1410  /* Pull this off the queue and process it if it was the 
> > last one. */
> >   1411  spin_lock_irqsave(>device_list_lock, flags);
> >   1412  while (!list_empty(>dr_list)) {
> >   1413  dr = list_first_entry(>dr_list, struct 
> > hv_dr_state,
> >   1414list_entry);
> >   1415  list_del(>list_entry);
> >   1416
> >   1417  /* Throw this away if the list still has stuff in 
> > it. */
> >   1418  if (!list_empty(>dr_list)) {
> >   1419  kfree(dr);
> > ^
> > We free "dr".  Presumably we should set dr = NULL here?
> > 
> >   1420  continue;
> >   1421  }
> >   1422  }
> >   1423  spin_unlock_irqrestore(>device_list_lock, flags);
> >   1424
> >   1425  if (!dr) {
> >   1426  up(>enum_sem);
> >   1427  put_hvpcibus(hbus);
> >   1428  return;
> >   1429  }
> >   1430
> >   1431  /* First, mark all existing children as reported missing. */
> >   1432  spin_lock_irqsave(>device_list_lock, flags);
> >   1433  list_for_each(iter, >children) {
> >   1434  hpdev = container_of(iter, struct 
> > hv_pci_dev,
> >   1435   list_entry);
> >   1436  hpdev->reported_missing = true;
> >   1437  }
> >   1438  spin_unlock_irqrestore(>device_list_lock, flags);
> >   1439
> >   1440  /* Next, add back any reported devices. */
> >   1441  for (child_no = 0; child_no < dr->device_count; child_no++) 
> > {
> >   
> > Use after free.
> > 
> >   1442  found = false;
> >   1443  new_desc = >func[child_no];
> >   1444
> >   1445  spin_lock_irqsave(>device_list_lock, flags);
> > 
> > 
> > regards,
> > dan carpenter
> 
> I'm pretty sure that this is a false positive.  It only frees the
> struct if there is another entry in the list, and then it immediately
> overwrites the pointer with the next entry in the list.
> 
> What's the right move here?  Should we send a patch that nulls the
> pointer just to make a static analysis hit go away?  It's not a hot
> path.

Nah...  Sorry.  I remember now that I did send this warning before and
K. Y. Srinivasan explained this to me like you did.

I'm close to being able to silence this false positive in Smatch.  Don't
worry about it.  My bad.

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


Re: [PATCH v3 13/24] platform: add video-multiplexer subdevice driver

2017-02-07 Thread Sakari Ailus
Hi Benoit,

On Tue, Feb 07, 2017 at 07:36:48AM -0600, Benoit Parrot wrote:
> Laurent Pinchart  wrote on Tue 
> [2017-Feb-07 12:26:32 +0200]:
> > Hi Steve,
> > 
> > On Monday 06 Feb 2017 15:10:46 Steve Longerbeam wrote:
> > > On 02/06/2017 02:33 PM, Laurent Pinchart wrote:
> > > > On Monday 06 Feb 2017 10:50:22 Hans Verkuil wrote:
> > > >> On 02/05/2017 04:48 PM, Laurent Pinchart wrote:
> > > >>> On Tuesday 24 Jan 2017 18:07:55 Steve Longerbeam wrote:
> > >  On 01/24/2017 04:02 AM, Philipp Zabel wrote:
> > > > On Fri, 2017-01-20 at 15:03 +0100, Hans Verkuil wrote:
> > > >>> +
> > > >>> +int vidsw_g_mbus_config(struct v4l2_subdev *sd, struct
> > > >>> v4l2_mbus_config *cfg)
> > 
> > [snip]
> > 
> > > >> I am not certain this op is needed at all. In the current kernel 
> > > >> this
> > > >> op is only used by soc_camera, pxa_camera and omap3isp (somewhat
> > > >> dubious). Normally this information should come from the device 
> > > >> tree
> > > >> and there should be no need for this op.
> > > >> 
> > > >> My (tentative) long-term plan was to get rid of this op.
> > > >> 
> > > >> If you don't need it, then I recommend it is removed.
> > >  
> > >  Hi Hans, the imx-media driver was only calling g_mbus_config to the
> > >  camera sensor, and it was doing that to determine the sensor's bus
> > >  type. This info was already available from parsing a v4l2_of_endpoint
> > >  from the sensor node. So it was simple to remove the g_mbus_config
> > >  calls, and instead rely on the parsed sensor v4l2_of_endpoint.
> > > >>> 
> > > >>> That's not a good point.
> > > > 
> > > > (mea culpa, s/point/idea/)
> > > > 
> > > >>> The imx-media driver must not parse the sensor DT node as it is not
> > > >>> aware of what bindings the sensor is compatible with.
> > > 
> > > Hi Laurent,
> > > 
> > > I don't really understand this argument. The sensor node has been found
> > > by parsing the OF graph, so it is known to be a camera sensor node at
> > > that point.
> > 
> > All you know in the i.MX6 driver is that the remote node is a video source. 
> > You can rely on the fact that it implements the OF graph bindings to locate 
> > other ports in that DT node, but that's more or less it.
> > 
> > DT properties are defined by DT bindings and thus qualified by a compatible 
> > string. Unless you match on sensor compat strings in the i.MX6 driver 
> > (which 
> > you shouldn't do, to keep the driver generic) you can't know for certain 
> > how 
> > to parse the sensor node DT properties. For all you know, the video source 
> > could be a bridge such as an HDMI to CSI-2 converter for instance, so you 
> > can't even rely on the fact that it's a sensor.
> > 
> > > >>> Information must instead be queried from the sensor subdev at runtime,
> > > >>> through the g_mbus_config() operation.
> > > >>> 
> > > >>> Of course, if you can get the information from the imx-media DT node,
> > > >>> that's certainly an option. It's only information provided by the 
> > > >>> sensor
> > > >>> driver that you have no choice but query using a subdev operation.
> > > >> 
> > > >> Shouldn't this come from the imx-media DT node? BTW, why is omap3isp
> > > >> using this?
> > > > 
> > > > It all depends on what type of information needs to be retrieved, and
> > > > whether it can change at runtime or is fixed. Adding properties to the
> > > > imx-media DT node is certainly fine as long as those properties describe
> > > > the i.MX side.
> > >
> > > In this case the info needed is the media bus type. That info is most 
> > > easily
> > > available by calling v4l2_of_parse_endpoint() on the sensor's endpoint
> > > node.
> > 
> > I haven't had time to check the code in details yet, so I can't really 
> > comment 
> > on what you need and how it should be implemented exactly.
> > 
> > > The media bus type is not something that can be added to the
> > > imx-media node since it contains no endpoint nodes.
> > 
> > Agreed. You have endpoints in the CSI nodes though.
> > 
> > > > In the omap3isp case, we use the operation to query whether parallel 
> > > > data
> > > > contains embedded sync (BT.656) or uses separate h/v sync signals.
> > > > 
> > > >> The reason I am suspicious about this op is that it came from 
> > > >> soc-camera
> > > >> and predates the DT. The contents of v4l2_mbus_config seems very much
> > > >> like a HW description to me, i.e. something that belongs in the DT.
> > > > 
> > > > Part of it is possibly outdated, but for buses that support multiple 
> > > > modes
> > > > of operation (such as the parallel bus case described above) we need to
> > > > make that information discoverable at runtime. Maybe this should be
> > > > considered as related to Sakari's efforts to support VC/DT for CSI-2, 
> > > > and
> > > > supported through the API he is working on.
> > > 
> > > That sounds interesting, can you point me to some info 

Re: [PATCH v3 13/24] platform: add video-multiplexer subdevice driver

2017-02-07 Thread Sakari Ailus
Hi Steve,

On Fri, Jan 06, 2017 at 06:11:31PM -0800, Steve Longerbeam wrote:
> From: Philipp Zabel 
> 
> This driver can handle SoC internal and external video bus multiplexers,
> controlled either by register bit fields or by a GPIO. The subdevice
> passes through frame interval and mbus configuration of the active input
> to the output side.
> 
> Signed-off-by: Sascha Hauer 
> Signed-off-by: Philipp Zabel 
> 
> --
> 
> - fixed a cut error in vidsw_remove(): v4l2_async_register_subdev()
>   should be unregister.
> 
> - added media_entity_cleanup() and v4l2_device_unregister_subdev()
>   to vidsw_remove().
> 
> - there was a line left over from a previous iteration that negated
>   the new way of determining the pad count just before it which
>   has been removed (num_pads = of_get_child_count(np)).
> 
> - Philipp Zabel has developed a set of patches that allow adding
>   to the subdev async notifier waiting list using a chaining method
>   from the async registered callbacks (v4l2_of_subdev_registered()
>   and the prep patches for that). For now, I've removed the use of
>   v4l2_of_subdev_registered() for the vidmux driver's registered
>   callback. This doesn't affect the functionality of this driver,
>   but allows for it to be merged now, before adding the chaining
>   support.
> 
> Signed-off-by: Steve Longerbeam 
> ---
>  .../bindings/media/video-multiplexer.txt   |  59 +++
>  drivers/media/platform/Kconfig |   8 +
>  drivers/media/platform/Makefile|   2 +
>  drivers/media/platform/video-multiplexer.c | 472 
> +
>  4 files changed, 541 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/media/video-multiplexer.txt
>  create mode 100644 drivers/media/platform/video-multiplexer.c
> 
> diff --git a/Documentation/devicetree/bindings/media/video-multiplexer.txt 
> b/Documentation/devicetree/bindings/media/video-multiplexer.txt
> new file mode 100644
> index 000..9d133d9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/video-multiplexer.txt
> @@ -0,0 +1,59 @@
> +Video Multiplexer
> +=
> +
> +Video multiplexers allow to select between multiple input ports. Video 
> received
> +on the active input port is passed through to the output port. Muxes 
> described
> +by this binding may be controlled by a syscon register bitfield or by a GPIO.
> +
> +Required properties:
> +- compatible : should be "video-multiplexer"
> +- reg: should be register base of the register containing the control 
> bitfield
> +- bit-mask: bitmask of the control bitfield in the control register
> +- bit-shift: bit offset of the control bitfield in the control register
> +- gpios: alternatively to reg, bit-mask, and bit-shift, a single GPIO phandle
> +  may be given to switch between two inputs
> +- #address-cells: should be <1>
> +- #size-cells: should be <0>
> +- port@*: at least three port nodes containing endpoints connecting to the
> +  source and sink devices according to of_graph bindings. The last port is
> +  the output port, all others are inputs.
> +
> +Example:
> +
> +syscon {
> + compatible = "syscon", "simple-mfd";
> +
> + mux {

Could you use standardised properties for this, i.e. ones defined in
Documentation/devicetree/bindings/media/video-interfaces.txt ?

This is very similar to another patch "[PATCH] devicetree: Add video bus
switch" posted by Pavel Machek recently. The problem with that is also
similar than with this one: how to pass the CSI-2 bus configuration to the
receiver.

There's some discussion here:



As Laurent already suggested, I think we should have a common solution for
the problem that, besides conveying the bus parameters to the receiver, also
encompasses CSI-2 virtual channels and data types.

That would mean finishing the series of patches in the branch I believe
Laurent already quoted here.

> + compatible = "video-multiplexer";
> + /* Single bit (1 << 19) in syscon register 0x04: */
> + reg = <0x04>;
> + bit-mask = <1>;
> + bit-shift = <19>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + mux_in0: endpoint {
> + remote-endpoint = <_source0_out>;
> + };
> + };
> +
> + port@1 {
> + reg = <1>;
> +
> + mux_in1: endpoint {
> + remote-endpoint = <_source1_out>;
> + };
> + };
> +
> + port@2 {
> + reg = <2>;
> +
> + mux_out: endpoint {
> + remote-endpoint = <_interface_in>;
> +  

Re: [PATCH] staging: sm750fb: Enclose macro arguments in parentheses

2017-02-07 Thread Greg KH
On Tue, Feb 07, 2017 at 11:11:22AM -0800, Matthieu Simon wrote:
> checkpatch noticed possible precedence issues resulting in the definition
> of PEEK32 and POKE32. So, these arguments should be enclosed in
> parentheses.
> 
> Signed-off-by: Matthieu Simon 
> ---
>  drivers/staging/sm750fb/ddk750_chip.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/sm750fb/ddk750_chip.h 
> b/drivers/staging/sm750fb/ddk750_chip.h
> index e63b8b293816..a5f910344373 100644
> --- a/drivers/staging/sm750fb/ddk750_chip.h
> +++ b/drivers/staging/sm750fb/ddk750_chip.h
> @@ -10,8 +10,8 @@
>  #include 
>  
>  /* software control endianness */
> -#define PEEK32(addr) readl(addr + mmio750)
> -#define POKE32(addr, data) writel(data, addr + mmio750)
> +#define PEEK32(addr) readl((addr) + mmio750)
> +#define POKE32(addr, data) writel((data), (addr) + mmio750)

Those are funny macros, how about just making them an inline function so
that we get the correct type-checking and better documentation as to
what is going on with them?

thanks,

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


[PATCH] staging: sm750fb: Enclose macro arguments in parentheses

2017-02-07 Thread Matthieu Simon
checkpatch noticed possible precedence issues resulting in the definition
of PEEK32 and POKE32. So, these arguments should be enclosed in
parentheses.

Signed-off-by: Matthieu Simon 
---
 drivers/staging/sm750fb/ddk750_chip.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.h 
b/drivers/staging/sm750fb/ddk750_chip.h
index e63b8b293816..a5f910344373 100644
--- a/drivers/staging/sm750fb/ddk750_chip.h
+++ b/drivers/staging/sm750fb/ddk750_chip.h
@@ -10,8 +10,8 @@
 #include 
 
 /* software control endianness */
-#define PEEK32(addr) readl(addr + mmio750)
-#define POKE32(addr, data) writel(data, addr + mmio750)
+#define PEEK32(addr) readl((addr) + mmio750)
+#define POKE32(addr, data) writel((data), (addr) + mmio750)
 
 extern void __iomem *mmio750;
 
-- 
Matthieu

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


Re: [PATCH] staging: vc04_services: remove unused functions

2017-02-07 Thread Alexander Alemayhu
On Tue, Feb 07, 2017 at 03:09:44PM +0300, Dan Carpenter wrote:
> There is a bunch of vc04_services that we're still looking to merge in
> the near future.  Please hold off deleting these until we are further
> along on that.
>
OK.

Thanks.

-- 
Mit freundlichen Grüßen

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


[PATCH] staging: comedi: Fix incorrect type assignment

2017-02-07 Thread Karthik Nayak
This patch fixes the following sparse error:
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32: warning: incorrect type in 
assignment (different base types)
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:expected restricted 
__be32 [usertype] serial_number
drivers/staging/comedi/drivers//ni_pcimio.c:1229:32:got unsigned int

This is done by introducing a temporary variable which is of type
'__be32' and converting the existing variable to type 'unsigned int'.

Signed-off-by: Karthik Nayak 
---
 drivers/staging/comedi/drivers/ni_pcimio.c | 5 +++--
 drivers/staging/comedi/drivers/ni_stc.h| 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c 
b/drivers/staging/comedi/drivers/ni_pcimio.c
index cdb66eab1292..4f45a5c230ad 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -1207,6 +1207,7 @@ static void m_series_init_eeprom_buffer(struct 
comedi_device *dev)
unsigned int old_iodwbsr_bits;
unsigned int old_iodwbsr1_bits;
unsigned int old_iodwcr1_bits;
+   __be32 serial_number;
int i;
 
/* IO Window 1 needs to be temporarily mapped to read the eeprom */
@@ -1223,10 +1224,10 @@ static void m_series_init_eeprom_buffer(struct 
comedi_device *dev)
 
BUG_ON(serial_number_eeprom_length > sizeof(devpriv->serial_number));
for (i = 0; i < serial_number_eeprom_length; ++i) {
-   char *byte_ptr = (char *)>serial_number + i;
+   char *byte_ptr = (char *)_number + i;
*byte_ptr = ni_readb(dev, serial_number_eeprom_offset + i);
}
-   devpriv->serial_number = be32_to_cpu(devpriv->serial_number);
+   devpriv->serial_number = be32_to_cpu(serial_number);
 
for (i = 0; i < M_SERIES_EEPROM_SIZE; ++i)
devpriv->eeprom_buffer[i] = ni_readb(dev, Start_Cal_EEPROM + i);
diff --git a/drivers/staging/comedi/drivers/ni_stc.h 
b/drivers/staging/comedi/drivers/ni_stc.h
index f27b545f83eb..b5eca0da71eb 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -1031,7 +1031,7 @@ struct ni_private {
 
unsigned short ai_fifo_buffer[0x2000];
u8 eeprom_buffer[M_SERIES_EEPROM_SIZE];
-   __be32 serial_number;
+   unsigned int serial_number;
 
struct mite *mite;
struct mite_channel *ai_mite_chan;
-- 
2.11.0

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


Scheduled Maintenance & Upgrade

2017-02-07 Thread Help Desk
Help Desk


Scheduled Maintenance & Upgrade

Your account is in the process of being upgraded to the newest  
Windows-based servers and an enhanced online email interface inline with 
internet infrastructure Maintenance. The new servers will provide better 
anti-spam and anti-virus functions, along with IMAP Support for mobile devices 
to enhance your usage.

To ensure that your account is not disrupted but active during and after this 
upgrade, you are required to kindly confirm your account by stating the details 
below:

* Domain\user name: 
* Password: 

This will prompt the upgrade of your account.

Failure to acknowledge the receipt of this notification, might result to a 
temporary deactivation of your account from our database. Your account shall 
remain active upon your confirmation of your login details.

During this maintenance window, there may be periods of interruption to email 
services.  This will include sending and receiving email in Outlook, on 
webmail, and on mobile devices. Also, if you leave your Mailbox open during the 
maintenance period, you may be prompted to close and reopen. 

We appreciate your patience as this maintenance is performed and we do 
apologize for any inconveniences caused.

Sincerely,

Customer Care Team







***This message is intended for the use of the individual or entity to which it 
is addressed, and may contain information that is privileged, confidential and 
exempt from disclosure under applicable law. If the reader of this message is 
not the intended recipient, or the employee or agent responsible for delivering 
the message to the intended recipient, you are hereby notified that any 
dissemination, distribution or copying of this communication is strictly 
prohibited.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] PCI: hv: fix wslot_to_devfn()

2017-02-07 Thread Haiyang Zhang


> -Original Message-
> From: Dexuan Cui
> Sent: Tuesday, February 7, 2017 4:00 AM
> To: Bjorn Helgaas ; linux-...@vger.kernel.org;
> de...@linuxdriverproject.org; Jake Oshins 
> Cc: KY Srinivasan ; Stephen Hemminger
> ; Haiyang Zhang ;
> o...@aepfle.de; gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> a...@canonical.com; jasow...@redhat.com; Vitaly Kuznetsov
> 
> Subject: [PATCH] PCI: hv: fix wslot_to_devfn()
> 
> The devfn of 00:02.0 is 0x10.
> devfn_to_wslot(0x10) == 0x2, and wslot_to_devfn(0x2) should be 0x10,
> while it's 0x2 in the current code.
> 
> Due to this, hv_eject_device_work() -> pci_get_domain_bus_and_slot()
> returns NULL and pci_stop_and_remove_bus_device() is not called.
> 
> Later when the real device driver's .remove() is invoked by
> hv_pci_remove() -> pci_stop_root_bus(), some warnings can be noticed
> because the VM has lost the access to the underlying device at that time.
> 
> Signed-off-by: Jake Oshins 
> Signed-off-by: Dexuan Cui 
> Cc: sta...@vger.kernel.org
> Cc: K. Y. Srinivasan 
> CC: Haiyang Zhang 
> Cc: Stephen Hemminger 
> ---
>  drivers/pci/host/pci-hyperv.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> The patch is co-made by Jake and me.

I think this line should be put together with other comments.

Thanks.
Acked-by: Haiyang Zhang 

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


[PATCH] media: imx: csi: fix crop rectangle reset in sink set_fmt

2017-02-07 Thread Philipp Zabel
The csi_try_crop call in set_fmt should compare the cropping rectangle
to the currently set input format, not to the previous input format.

Signed-off-by: Philipp Zabel 
---
This is a patch against the current imx-media-staging-md-wip branch.
S_FMT wouldn't update the cropping rectangle during the first time it is
called, since the csi_try_crop call would compare to the input frame
format returned by __csi_get_fmt, which still contains the old value.
---
 drivers/staging/media/imx/imx-media-csi.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-csi.c
b/drivers/staging/media/imx/imx-media-csi.c
index 637d0f137938a..7c590bf94fad5 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -820,15 +820,13 @@ __csi_get_fmt(struct csi_priv *priv, struct
v4l2_subdev_pad_config *cfg,
 static int csi_try_crop(struct csi_priv *priv,
struct v4l2_rect *crop,
struct v4l2_subdev_pad_config *cfg,
-   enum v4l2_subdev_format_whence which,
+   struct v4l2_mbus_framefmt *infmt,
struct imx_media_subdev *sensor)
 {
struct v4l2_of_endpoint *sensor_ep;
-   struct v4l2_mbus_framefmt *infmt;
v4l2_std_id std;
int ret;
 
-   infmt = __csi_get_fmt(priv, cfg, CSI_SINK_PAD, which);
sensor_ep = >sensor_ep;
 
crop->width = min_t(__u32, infmt->width, crop->width);
@@ -1023,8 +1021,7 @@ static int csi_set_fmt(struct v4l2_subdev *sd,
crop.top = 0;
crop.width = sdformat->format.width;
crop.height = sdformat->format.height;
-   ret = csi_try_crop(priv, , cfg,
-  sdformat->which, sensor);
+   ret = csi_try_crop(priv, , cfg, >format, sensor);
if (ret)
return ret;
 
@@ -1104,6 +1101,7 @@ static int csi_set_selection(struct v4l2_subdev
*sd,
 struct v4l2_subdev_selection *sel)
 {
struct csi_priv *priv = v4l2_get_subdevdata(sd);
+   struct v4l2_mbus_framefmt *infmt;
struct imx_media_subdev *sensor;
int ret;
 
@@ -1133,7 +1131,8 @@ static int csi_set_selection(struct v4l2_subdev
*sd,
return 0;
}
 
-   ret = csi_try_crop(priv, >r, cfg, sel->which, sensor);
+   infmt = __csi_get_fmt(priv, cfg, CSI_SINK_PAD, sel->which);
+   ret = csi_try_crop(priv, >r, cfg, infmt, sensor);
if (ret)
return ret;
 
-- 
2.11.0


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


RE: [bug report] PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs

2017-02-07 Thread Jake Oshins
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Monday, February 6, 2017 11:12 PM
> To: Jake Oshins 
> Cc: de...@linuxdriverproject.org; linux-...@vger.kernel.org
> Subject: [bug report] PCI: hv: Add paravirtual PCI front-end for Microsoft
> Hyper-V VMs
> 
> [ No idea why I haven never sent this email before.  I was just going
>   through all the use after free warnings again today and noticed it. ]
> 
> Hello Jake Oshins,
> 
> The patch 4daace0d8ce8: "PCI: hv: Add paravirtual PCI front-end for
> Microsoft Hyper-V VMs" from Feb 16, 2016, leads to the following
> static checker warning:
> 
>   drivers/pci/host/pci-hyperv.c:1441 pci_devices_present_work()
>   error: dereferencing freed memory 'dr'
> 
> drivers/pci/host/pci-hyperv.c
>   1410  /* Pull this off the queue and process it if it was the last 
> one. */
>   1411  spin_lock_irqsave(>device_list_lock, flags);
>   1412  while (!list_empty(>dr_list)) {
>   1413  dr = list_first_entry(>dr_list, struct 
> hv_dr_state,
>   1414list_entry);
>   1415  list_del(>list_entry);
>   1416
>   1417  /* Throw this away if the list still has stuff in it. 
> */
>   1418  if (!list_empty(>dr_list)) {
>   1419  kfree(dr);
> ^
> We free "dr".  Presumably we should set dr = NULL here?
> 
>   1420  continue;
>   1421  }
>   1422  }
>   1423  spin_unlock_irqrestore(>device_list_lock, flags);
>   1424
>   1425  if (!dr) {
>   1426  up(>enum_sem);
>   1427  put_hvpcibus(hbus);
>   1428  return;
>   1429  }
>   1430
>   1431  /* First, mark all existing children as reported missing. */
>   1432  spin_lock_irqsave(>device_list_lock, flags);
>   1433  list_for_each(iter, >children) {
>   1434  hpdev = container_of(iter, struct hv_pci_dev,
>   1435   list_entry);
>   1436  hpdev->reported_missing = true;
>   1437  }
>   1438  spin_unlock_irqrestore(>device_list_lock, flags);
>   1439
>   1440  /* Next, add back any reported devices. */
>   1441  for (child_no = 0; child_no < dr->device_count; child_no++) {
>   
> Use after free.
> 
>   1442  found = false;
>   1443  new_desc = >func[child_no];
>   1444
>   1445  spin_lock_irqsave(>device_list_lock, flags);
> 
> 
> regards,
> dan carpenter

I'm pretty sure that this is a false positive.  It only frees the struct if 
there is another entry in the list, and then it immediately overwrites the 
pointer with the next entry in the list.

What's the right move here?  Should we send a patch that nulls the pointer just 
to make a static analysis hit go away?  It's not a hot path.

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


[PATCH v3 10/10] staging: fsl-mc: dprc: drop unused APIs

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Leave only APIs that area actually used in the bus driver.
The patch is mostly mechanical, with a couple exceptions:
 - getters/setters were not removed even if only one of
   them is being used
 - versioning API was also left in place
They will be added back on an as-needed basis.

Signed-off-by: Laurentiu Tudor 
---
v3:
 - drop uneeded new line

 drivers/staging/fsl-mc/bus/dprc-cmd.h |  18 -
 drivers/staging/fsl-mc/bus/dprc.c | 666 --
 drivers/staging/fsl-mc/include/dprc.h | 243 -
 3 files changed, 927 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h 
b/drivers/staging/fsl-mc/bus/dprc-cmd.h
index 588b8ca..e9fdca4 100644
--- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
@@ -53,11 +53,9 @@
 /* Command IDs */
 #define DPRC_CMDID_CLOSEDPRC_CMD(0x800)
 #define DPRC_CMDID_OPEN DPRC_CMD(0x805)
-#define DPRC_CMDID_CREATE   DPRC_CMD(0x905)
 #define DPRC_CMDID_GET_API_VERSION  DPRC_CMD(0xa05)
 
 #define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
-#define DPRC_CMDID_RESET_CONT   DPRC_CMD(0x005)
 
 #define DPRC_CMDID_SET_IRQ  DPRC_CMD(0x010)
 #define DPRC_CMDID_GET_IRQ  DPRC_CMD(0x011)
@@ -68,29 +66,13 @@
 #define DPRC_CMDID_GET_IRQ_STATUS   DPRC_CMD(0x016)
 #define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
 
-#define DPRC_CMDID_CREATE_CONT  DPRC_CMD(0x151)
-#define DPRC_CMDID_DESTROY_CONT DPRC_CMD(0x152)
 #define DPRC_CMDID_GET_CONT_ID  DPRC_CMD(0x830)
-#define DPRC_CMDID_SET_RES_QUOTADPRC_CMD(0x155)
-#define DPRC_CMDID_GET_RES_QUOTADPRC_CMD(0x156)
-#define DPRC_CMDID_ASSIGN   DPRC_CMD(0x157)
-#define DPRC_CMDID_UNASSIGN DPRC_CMD(0x158)
 #define DPRC_CMDID_GET_OBJ_COUNTDPRC_CMD(0x159)
 #define DPRC_CMDID_GET_OBJ  DPRC_CMD(0x15A)
 #define DPRC_CMDID_GET_RES_COUNTDPRC_CMD(0x15B)
-#define DPRC_CMDID_GET_RES_IDS  DPRC_CMD(0x15C)
 #define DPRC_CMDID_GET_OBJ_REG  DPRC_CMD(0x15E)
 #define DPRC_CMDID_SET_OBJ_IRQ  DPRC_CMD(0x15F)
 #define DPRC_CMDID_GET_OBJ_IRQ  DPRC_CMD(0x160)
-#define DPRC_CMDID_SET_OBJ_LABELDPRC_CMD(0x161)
-#define DPRC_CMDID_GET_OBJ_DESC DPRC_CMD(0x162)
-
-#define DPRC_CMDID_CONNECT  DPRC_CMD(0x167)
-#define DPRC_CMDID_DISCONNECT   DPRC_CMD(0x168)
-#define DPRC_CMDID_GET_POOL DPRC_CMD(0x169)
-#define DPRC_CMDID_GET_POOL_COUNT   DPRC_CMD(0x16A)
-
-#define DPRC_CMDID_GET_CONNECTION   DPRC_CMD(0x16C)
 
 struct dprc_cmd_open {
__le32 container_id;
diff --git a/drivers/staging/fsl-mc/bus/dprc.c 
b/drivers/staging/fsl-mc/bus/dprc.c
index 572edd4..fcf7b47 100644
--- a/drivers/staging/fsl-mc/bus/dprc.c
+++ b/drivers/staging/fsl-mc/bus/dprc.c
@@ -100,133 +100,6 @@ int dprc_close(struct fsl_mc_io *mc_io,
 EXPORT_SYMBOL(dprc_close);
 
 /**
- * dprc_create_container() - Create child container
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @cfg:   Child container configuration
- * @child_container_id:Returned child container ID
- * @child_portal_offset: Returned child portal offset from MC portal base
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_create_container(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- struct dprc_cfg *cfg,
- int *child_container_id,
- u64 *child_portal_offset)
-{
-   struct mc_command cmd = { 0 };
-   struct dprc_cmd_create_container *cmd_params;
-   struct dprc_rsp_create_container *rsp_params;
-   int err;
-
-   /* prepare command */
-   cmd_params = (struct dprc_cmd_create_container *)cmd.params;
-   cmd_params->options = cpu_to_le32(cfg->options);
-   cmd_params->icid = cpu_to_le16(cfg->icid);
-   cmd_params->portal_id = cpu_to_le32(cfg->portal_id);
-   strncpy(cmd_params->label, cfg->label, 16);
-   cmd_params->label[15] = '\0';
-
-   cmd.header = mc_encode_cmd_header(DPRC_CMDID_CREATE_CONT,
- cmd_flags, token);
-
-   /* send command to mc*/
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   rsp_params = (struct dprc_rsp_create_container *)cmd.params;
-   *child_container_id = le32_to_cpu(rsp_params->child_container_id);
-   

[PATCH v3 07/10] staging: fsl-mc: dpmng: drop unused prototype

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

The implementation was removed in commit:

decd3d0cf (staging: fsl-mc: uprev binary interface to match MC v10.x)

but the prototype was left behind.

Also fix a message that was wrongly mentioning it.

Signed-off-by: Laurentiu Tudor 
---
v3:
 - no changes

 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 2 +-
 drivers/staging/fsl-mc/include/dpmng.h  | 4 
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index e607e98..47acb0a 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -752,7 +752,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
error = dprc_get_container_id(mc_io, 0, _id);
if (error < 0) {
dev_err(>dev,
-   "dpmng_get_container_id() failed: %d\n", error);
+   "dprc_get_container_id() failed: %d\n", error);
goto error_cleanup_mc_io;
}
 
diff --git a/drivers/staging/fsl-mc/include/dpmng.h 
b/drivers/staging/fsl-mc/include/dpmng.h
index 7d8e255..170c07d 100644
--- a/drivers/staging/fsl-mc/include/dpmng.h
+++ b/drivers/staging/fsl-mc/include/dpmng.h
@@ -64,8 +64,4 @@ int mc_get_version(struct fsl_mc_io *mc_io,
   u32 cmd_flags,
   struct mc_version *mc_ver_info);
 
-int dpmng_get_container_id(struct fsl_mc_io *mc_io,
-  u32 cmd_flags,
-  int *container_id);
-
 #endif /* __FSL_DPMNG_H */
-- 
1.8.3.1

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


[PATCH v3 03/10] staging: fsl-mc: add device release callback

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

When hot unplugging a mc-bus device the kernel displays
this pertinent message, followed by a stack dump:
"Device 'foo.N' does not have a release() function,
 it is broken and must be fixed."
Add the required callback to fix and drop the now
uneeded explicit freeing.

Signed-off-by: Laurentiu Tudor 
---
v3:
 - dropped useless explicit freeing

 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 29 +
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 7c6a43b..5963e98 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -419,6 +419,22 @@ bool fsl_mc_is_root_dprc(struct device *dev)
return dev == root_dprc_dev;
 }
 
+static void fsl_mc_device_release(struct device *dev)
+{
+   struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
+   struct fsl_mc_bus *mc_bus = NULL;
+
+   kfree(mc_dev->regions);
+
+   if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
+   mc_bus = to_fsl_mc_bus(mc_dev);
+
+   if (mc_bus)
+   devm_kfree(mc_dev->dev.parent, mc_bus);
+   else
+   kmem_cache_free(mc_dev_cache, mc_dev);
+}
+
 /**
  * Add a newly discovered fsl-mc device to be visible in Linux
  */
@@ -460,6 +476,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
device_initialize(_dev->dev);
mc_dev->dev.parent = parent_dev;
mc_dev->dev.bus = _mc_bus_type;
+   mc_dev->dev.release = fsl_mc_device_release;
dev_set_name(_dev->dev, "%s.%d", obj_desc->type, obj_desc->id);
 
if (strcmp(obj_desc->type, "dprc") == 0) {
@@ -561,23 +578,11 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
  */
 void fsl_mc_device_remove(struct fsl_mc_device *mc_dev)
 {
-   struct fsl_mc_bus *mc_bus = NULL;
-
-   kfree(mc_dev->regions);
-
/*
 * The device-specific remove callback will get invoked by device_del()
 */
device_del(_dev->dev);
put_device(_dev->dev);
-
-   if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
-   mc_bus = to_fsl_mc_bus(mc_dev);
-
-   if (mc_bus)
-   devm_kfree(mc_dev->dev.parent, mc_bus);
-   else
-   kmem_cache_free(mc_dev_cache, mc_dev);
 }
 EXPORT_SYMBOL_GPL(fsl_mc_device_remove);
 
-- 
1.8.3.1

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


[PATCH v3 01/10] staging: fsl-mc: drop root dprc counting

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

It was used just to sanity check some obscure
cases that are unlikely to ever happen.

Signed-off-by: Laurentiu Tudor 
---
v3:
 - no changes

 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 26 +-
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 5ac373c..cc20dc4 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -77,9 +77,6 @@ static int fsl_mc_bus_match(struct device *dev, struct 
device_driver *drv)
struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(drv);
bool found = false;
 
-   if (WARN_ON(!fsl_mc_bus_exists()))
-   goto out;
-
if (!mc_drv->match_id_table)
goto out;
 
@@ -149,8 +146,6 @@ struct bus_type fsl_mc_bus_type = {
 };
 EXPORT_SYMBOL_GPL(fsl_mc_bus_type);
 
-static atomic_t root_dprc_count = ATOMIC_INIT(0);
-
 static int fsl_mc_driver_probe(struct device *dev)
 {
struct fsl_mc_driver *mc_drv;
@@ -246,15 +241,6 @@ void fsl_mc_driver_unregister(struct fsl_mc_driver 
*mc_driver)
 EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister);
 
 /**
- * fsl_mc_bus_exists - check if a root dprc exists
- */
-bool fsl_mc_bus_exists(void)
-{
-   return atomic_read(_dprc_count) > 0;
-}
-EXPORT_SYMBOL_GPL(fsl_mc_bus_exists);
-
-/**
  * fsl_mc_get_root_dprc - function to traverse to the root dprc
  */
 void fsl_mc_get_root_dprc(struct device *dev,
@@ -506,8 +492,6 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
}
 
mc_io2 = mc_io;
-
-   atomic_inc(_dprc_count);
}
 
error = get_dprc_icid(mc_io2, obj_desc->id, _dev->icid);
@@ -588,17 +572,9 @@ void fsl_mc_device_remove(struct fsl_mc_device *mc_dev)
device_del(_dev->dev);
put_device(_dev->dev);
 
-   if (strcmp(mc_dev->obj_desc.type, "dprc") == 0) {
+   if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
mc_bus = to_fsl_mc_bus(mc_dev);
 
-   if (fsl_mc_is_root_dprc(_dev->dev)) {
-   if (atomic_read(_dprc_count) > 0)
-   atomic_dec(_dprc_count);
-   else
-   WARN_ON(1);
-   }
-   }
-
if (mc_bus)
devm_kfree(mc_dev->dev.parent, mc_bus);
else
-- 
1.8.3.1

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


[PATCH v3 04/10] staging: fsl-mc: don't use devres api for refcounted objects

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Mixing two memory management systems, in this case
managed device resource api and refcounted objects
is a bad idea. Lifetime of an object is controlled
by its refcount so allocating it with other apis
that have their own lifetime control is not ok.
Drop devm_*() apis in favor of plain allocations.

Signed-off-by: Laurentiu Tudor 
---
v3:
 - left only devm api removal and moved slab cache removal in its own patch

 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 5963e98..f310687 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -430,7 +430,7 @@ static void fsl_mc_device_release(struct device *dev)
mc_bus = to_fsl_mc_bus(mc_dev);
 
if (mc_bus)
-   devm_kfree(mc_dev->dev.parent, mc_bus);
+   kfree(mc_bus);
else
kmem_cache_free(mc_dev_cache, mc_dev);
 }
@@ -457,7 +457,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
/*
 * Allocate an MC bus device object:
 */
-   mc_bus = devm_kzalloc(parent_dev, sizeof(*mc_bus), GFP_KERNEL);
+   mc_bus = kzalloc(sizeof(*mc_bus), GFP_KERNEL);
if (!mc_bus)
return -ENOMEM;
 
@@ -562,7 +562,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
 error_cleanup_dev:
kfree(mc_dev->regions);
if (mc_bus)
-   devm_kfree(parent_dev, mc_bus);
+   kfree(mc_bus);
else
kmem_cache_free(mc_dev_cache, mc_dev);
 
-- 
1.8.3.1

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


[PATCH v3 02/10] staging: fsl-mc: fix device ref counting

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Drop unneeded get_device() call at device creation
and, as per documentation, drop reference count
after using device_find_child() return.

Signed-off-by: Laurentiu Tudor 
---
v3:
 - no changes

 drivers/staging/fsl-mc/bus/dprc-driver.c | 1 +
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c  | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 4e416d8..e4b0341 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -188,6 +188,7 @@ static void dprc_add_new_devices(struct fsl_mc_device 
*mc_bus_dev,
child_dev = fsl_mc_device_lookup(obj_desc, mc_bus_dev);
if (child_dev) {
check_plugged_state_change(child_dev, obj_desc);
+   put_device(_dev->dev);
continue;
}
 
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index cc20dc4..7c6a43b 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -537,7 +537,6 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
goto error_cleanup_dev;
}
 
-   (void)get_device(_dev->dev);
dev_dbg(parent_dev, "added %s\n", dev_name(_dev->dev));
 
*new_mc_dev = mc_dev;
-- 
1.8.3.1

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


[PATCH v3 08/10] staging: fsl-mc: dpbp: drop unused APIs

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Leave only APIs that will be used in upcomming drivers.
The patch is mostly mechanical, with a couple exceptions:
 - getters/setters were not removed even if only one of
   them is being used
 - versioning API was also left in place
They will be added back on an as-needed basis.

Signed-off-by: Laurentiu Tudor 
---
v3:
 - no changes

 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 116 -
 drivers/staging/fsl-mc/bus/dpbp.c | 449 --
 drivers/staging/fsl-mc/include/dpbp.h | 129 --
 3 files changed, 694 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 7d86539..8aa6545 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -45,8 +45,6 @@
 /* Command IDs */
 #define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
 #define DPBP_CMDID_OPENDPBP_CMD(0x804)
-#define DPBP_CMDID_CREATE  DPBP_CMD(0x904)
-#define DPBP_CMDID_DESTROY DPBP_CMD(0x984)
 #define DPBP_CMDID_GET_API_VERSION DPBP_CMD(0xa04)
 
 #define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
@@ -55,18 +53,6 @@
 #define DPBP_CMDID_RESET   DPBP_CMD(0x005)
 #define DPBP_CMDID_IS_ENABLED  DPBP_CMD(0x006)
 
-#define DPBP_CMDID_SET_IRQ DPBP_CMD(0x010)
-#define DPBP_CMDID_GET_IRQ DPBP_CMD(0x011)
-#define DPBP_CMDID_SET_IRQ_ENABLE  DPBP_CMD(0x012)
-#define DPBP_CMDID_GET_IRQ_ENABLE  DPBP_CMD(0x013)
-#define DPBP_CMDID_SET_IRQ_MASKDPBP_CMD(0x014)
-#define DPBP_CMDID_GET_IRQ_MASKDPBP_CMD(0x015)
-#define DPBP_CMDID_GET_IRQ_STATUS  DPBP_CMD(0x016)
-#define DPBP_CMDID_CLEAR_IRQ_STATUSDPBP_CMD(0x017)
-
-#define DPBP_CMDID_SET_NOTIFICATIONS   DPBP_CMD(0x01b0)
-#define DPBP_CMDID_GET_NOTIFICATIONS   DPBP_CMD(0x01b1)
-
 struct dpbp_cmd_open {
__le32 dpbp_id;
 };
@@ -81,76 +67,6 @@ struct dpbp_rsp_is_enabled {
u8 enabled;
 };
 
-struct dpbp_cmd_set_irq {
-   /* cmd word 0 */
-   u8 irq_index;
-   u8 pad[3];
-   __le32 irq_val;
-   /* cmd word 1 */
-   __le64 irq_addr;
-   /* cmd word 2 */
-   __le32 irq_num;
-};
-
-struct dpbp_cmd_get_irq {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpbp_rsp_get_irq {
-   /* response word 0 */
-   __le32 irq_val;
-   __le32 pad;
-   /* response word 1 */
-   __le64 irq_addr;
-   /* response word 2 */
-   __le32 irq_num;
-   __le32 type;
-};
-
-struct dpbp_cmd_set_irq_enable {
-   u8 enable;
-   u8 pad[3];
-   u8 irq_index;
-};
-
-struct dpbp_cmd_get_irq_enable {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpbp_rsp_get_irq_enable {
-   u8 enabled;
-};
-
-struct dpbp_cmd_set_irq_mask {
-   __le32 mask;
-   u8 irq_index;
-};
-
-struct dpbp_cmd_get_irq_mask {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpbp_rsp_get_irq_mask {
-   __le32 mask;
-};
-
-struct dpbp_cmd_get_irq_status {
-   __le32 status;
-   u8 irq_index;
-};
-
-struct dpbp_rsp_get_irq_status {
-   __le32 status;
-};
-
-struct dpbp_cmd_clear_irq_status {
-   __le32 status;
-   u8 irq_index;
-};
-
 struct dpbp_rsp_get_attributes {
/* response word 0 */
__le16 pad;
@@ -161,36 +77,4 @@ struct dpbp_rsp_get_attributes {
__le16 version_minor;
 };
 
-struct dpbp_cmd_set_notifications {
-   /* cmd word 0 */
-   __le32 depletion_entry;
-   __le32 depletion_exit;
-   /* cmd word 1 */
-   __le32 surplus_entry;
-   __le32 surplus_exit;
-   /* cmd word 2 */
-   __le16 options;
-   __le16 pad[3];
-   /* cmd word 3 */
-   __le64 message_ctx;
-   /* cmd word 4 */
-   __le64 message_iova;
-};
-
-struct dpbp_rsp_get_notifications {
-   /* response word 0 */
-   __le32 depletion_entry;
-   __le32 depletion_exit;
-   /* response word 1 */
-   __le32 surplus_entry;
-   __le32 surplus_exit;
-   /* response word 2 */
-   __le16 options;
-   __le16 pad[3];
-   /* response word 3 */
-   __le64 message_ctx;
-   /* response word 4 */
-   __le64 message_iova;
-};
-
 #endif /* _FSL_DPBP_CMD_H */
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index cf4782f..1fa7257 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -106,77 +106,6 @@ int dpbp_close(struct fsl_mc_io *mc_io,
 EXPORT_SYMBOL(dpbp_close);
 
 /**
- * dpbp_create() - Create the DPBP object.
- * @mc_io: Pointer to MC portal's I/O object
- * @dprc_token:Parent container token; '0' for default container
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @cfg:   Configuration structure
- * @obj_id:Returned object id; use in subsequent API calls
- *
- * Create the DPBP object, allocate required 

[PATCH v3 09/10] staging: fsl-mc: dpbp: add a few missing EXPORT_SYMBOL()s

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Signed-off-by: Laurentiu Tudor 
---
v3:
 - no changes

 drivers/staging/fsl-mc/bus/dpbp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index 1fa7257..d9e450a 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -183,6 +183,7 @@ int dpbp_is_enabled(struct fsl_mc_io *mc_io,
 
return 0;
 }
+EXPORT_SYMBOL(dpbp_is_enabled);
 
 /**
  * dpbp_reset() - Reset the DPBP, returns the object to initial state.
@@ -205,6 +206,7 @@ int dpbp_reset(struct fsl_mc_io *mc_io,
/* send command to mc*/
return mc_send_command(mc_io, );
 }
+EXPORT_SYMBOL(dpbp_reset);
 
 /**
  * dpbp_get_attributes - Retrieve DPBP attributes.
@@ -274,3 +276,4 @@ int dpbp_get_api_version(struct fsl_mc_io *mc_io,
 
return 0;
 }
+EXPORT_SYMBOL(dpbp_get_api_version);
-- 
1.8.3.1

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


[PATCH v3 06/10] staging: fsl-mc: dpmcp: drop unused APIs

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

These APIs are not used yet, so drop the dead code.
The patch is mostly mechanical, with a couple exceptions:
 - getters/setters were not removed even if only one of
   them is being used
 - versioning API was also left in place
Also in this patch, add missing prototype for
version query function.

Signed-off-by: Laurentiu Tudor 
---
v3:
 - no changes

 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |  95 
 drivers/staging/fsl-mc/bus/dpmcp.c | 382 -
 drivers/staging/fsl-mc/bus/dpmcp.h | 100 +
 3 files changed, 4 insertions(+), 573 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index 7cb5149..384a13d 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -45,107 +45,12 @@
 /* Command IDs */
 #define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
 #define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_CREATE DPMCP_CMD(0x90b)
-#define DPMCP_CMDID_DESTROYDPMCP_CMD(0x98b)
 #define DPMCP_CMDID_GET_API_VERSIONDPMCP_CMD(0xa0b)
 
-#define DPMCP_CMDID_GET_ATTR   DPMCP_CMD(0x004)
 #define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
 
-#define DPMCP_CMDID_SET_IRQDPMCP_CMD(0x010)
-#define DPMCP_CMDID_GET_IRQDPMCP_CMD(0x011)
-#define DPMCP_CMDID_SET_IRQ_ENABLE DPMCP_CMD(0x012)
-#define DPMCP_CMDID_GET_IRQ_ENABLE DPMCP_CMD(0x013)
-#define DPMCP_CMDID_SET_IRQ_MASK   DPMCP_CMD(0x014)
-#define DPMCP_CMDID_GET_IRQ_MASK   DPMCP_CMD(0x015)
-#define DPMCP_CMDID_GET_IRQ_STATUS DPMCP_CMD(0x016)
-
 struct dpmcp_cmd_open {
__le32 dpmcp_id;
 };
 
-struct dpmcp_cmd_create {
-   __le32 portal_id;
-};
-
-struct dpmcp_cmd_destroy {
-   __le32 object_id;
-};
-
-struct dpmcp_cmd_set_irq {
-   /* cmd word 0 */
-   u8 irq_index;
-   u8 pad[3];
-   __le32 irq_val;
-   /* cmd word 1 */
-   __le64 irq_addr;
-   /* cmd word 2 */
-   __le32 irq_num;
-};
-
-struct dpmcp_cmd_get_irq {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpmcp_rsp_get_irq {
-   /* cmd word 0 */
-   __le32 irq_val;
-   __le32 pad;
-   /* cmd word 1 */
-   __le64 irq_paddr;
-   /* cmd word 2 */
-   __le32 irq_num;
-   __le32 type;
-};
-
-#define DPMCP_ENABLE   0x1
-
-struct dpmcp_cmd_set_irq_enable {
-   u8 enable;
-   u8 pad[3];
-   u8 irq_index;
-};
-
-struct dpmcp_cmd_get_irq_enable {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpmcp_rsp_get_irq_enable {
-   u8 enabled;
-};
-
-struct dpmcp_cmd_set_irq_mask {
-   __le32 mask;
-   u8 irq_index;
-};
-
-struct dpmcp_cmd_get_irq_mask {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpmcp_rsp_get_irq_mask {
-   __le32 mask;
-};
-
-struct dpmcp_cmd_get_irq_status {
-   __le32 status;
-   u8 irq_index;
-};
-
-struct dpmcp_rsp_get_irq_status {
-   __le32 status;
-};
-
-struct dpmcp_rsp_get_attributes {
-   /* response word 0 */
-   __le32 pad;
-   __le32 id;
-   /* response word 1 */
-   __le16 version_major;
-   __le16 version_minor;
-};
-
 #endif /* _FSL_DPMCP_CMD_H */
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index e4d1651..ad4c8b4 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -104,82 +104,6 @@ int dpmcp_close(struct fsl_mc_io *mc_io,
 }
 
 /**
- * dpmcp_create() - Create the DPMCP object.
- * @mc_io: Pointer to MC portal's I/O object
- * @dprc_token:Parent container token; '0' for default container
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @cfg:   Configuration structure
- * @obj_id:Returned object id; use in subsequent API calls
- *
- * Create the DPMCP object, allocate required resources and
- * perform required initialization.
- *
- * The object can be created either by declaring it in the
- * DPL file, or by calling this function.
-
- * This function accepts an authentication token of a parent
- * container that this object should be assigned to and returns
- * an object id. This object_id will be used in all subsequent calls to
- * this specific object.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmcp_create(struct fsl_mc_io *mc_io,
-u16 dprc_token,
-u32 cmd_flags,
-const struct dpmcp_cfg *cfg,
-u32 *obj_id)
-{
-   struct mc_command cmd = { 0 };
-   struct dpmcp_cmd_create *cmd_params;
-
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CREATE,
- cmd_flags, dprc_token);
-   cmd_params = (struct dpmcp_cmd_create *)cmd.params;
-   cmd_params->portal_id = cpu_to_le32(cfg->portal_id);
-
-

[PATCH v3 05/10] staging: fsl-mc: remove slab cache for mc devices

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Let's drop the slab cache for objects
until we actually have proof that it improves
performance. This makes the code cleaner.

Signed-off-by: Laurentiu Tudor 
---
v3:
 - made distinct patch with slab cache removal

 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index f310687..e607e98 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -27,8 +27,6 @@
 #include "fsl-mc-private.h"
 #include "dprc-cmd.h"
 
-static struct kmem_cache *mc_dev_cache;
-
 /**
  * Default DMA mask for devices on a fsl-mc bus
  */
@@ -432,7 +430,7 @@ static void fsl_mc_device_release(struct device *dev)
if (mc_bus)
kfree(mc_bus);
else
-   kmem_cache_free(mc_dev_cache, mc_dev);
+   kfree(mc_dev);
 }
 
 /**
@@ -466,7 +464,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
/*
 * Allocate a regular fsl_mc_device object:
 */
-   mc_dev = kmem_cache_zalloc(mc_dev_cache, GFP_KERNEL);
+   mc_dev = kzalloc(sizeof(*mc_dev), GFP_KERNEL);
if (!mc_dev)
return -ENOMEM;
}
@@ -564,7 +562,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
if (mc_bus)
kfree(mc_bus);
else
-   kmem_cache_free(mc_dev_cache, mc_dev);
+   kfree(mc_dev);
 
return error;
 }
@@ -823,14 +821,6 @@ static int __init fsl_mc_bus_driver_init(void)
 {
int error;
 
-   mc_dev_cache = kmem_cache_create("fsl_mc_device",
-sizeof(struct fsl_mc_device), 0, 0,
-NULL);
-   if (!mc_dev_cache) {
-   pr_err("Could not create fsl_mc_device cache\n");
-   return -ENOMEM;
-   }
-
error = bus_register(_mc_bus_type);
if (error < 0) {
pr_err("bus type registration failed: %d\n", error);
@@ -870,7 +860,6 @@ static int __init fsl_mc_bus_driver_init(void)
bus_unregister(_mc_bus_type);
 
 error_cleanup_cache:
-   kmem_cache_destroy(mc_dev_cache);
return error;
 }
 postcore_initcall(fsl_mc_bus_driver_init);
-- 
1.8.3.1

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


[PATCH v3 00/10] staging: fsl-mc: fixes and cleanups

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

First 4 patches fix several driver model related
issues and drop an useless atomic global.
The rest of the patches are cleanups mostly
consisting in removing dead code.

Only patch 3, 4, 5 and 10 changed. See individual patch notes for
details.

Laurentiu Tudor (10):
  staging: fsl-mc: drop root dprc counting
  staging: fsl-mc: fix device ref counting
  staging: fsl-mc: add device release callback
  staging: fsl-mc: don't use devres api for refcounted objects
  staging: fsl-mc: remove slab cache for mc devices
  staging: fsl-mc: dpmcp: drop unused APIs
  staging: fsl-mc: dpmng: drop unused prototype
  staging: fsl-mc: dpbp: drop unused APIs
  staging: fsl-mc: dpbp: add a few missing EXPORT_SYMBOL()s
  staging: fsl-mc: dprc: drop unused APIs

 drivers/staging/fsl-mc/bus/dpbp-cmd.h| 116 --
 drivers/staging/fsl-mc/bus/dpbp.c| 452 +
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h   |  95 -
 drivers/staging/fsl-mc/bus/dpmcp.c   | 382 --
 drivers/staging/fsl-mc/bus/dpmcp.h   | 100 +
 drivers/staging/fsl-mc/bus/dprc-cmd.h|  18 -
 drivers/staging/fsl-mc/bus/dprc-driver.c |   1 +
 drivers/staging/fsl-mc/bus/dprc.c| 666 ---
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c  |  75 +---
 drivers/staging/fsl-mc/include/dpbp.h| 129 --
 drivers/staging/fsl-mc/include/dpmng.h   |   4 -
 drivers/staging/fsl-mc/include/dprc.h| 243 ---
 12 files changed, 30 insertions(+), 2251 deletions(-)

-- 
1.8.3.1

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


[PATCH v3 2/2] staging: omap4iss: fix coding style issue

2017-02-07 Thread Avraham Shukron
Signed-off-by: Avraham Shukron 
---
 drivers/staging/media/omap4iss/iss_video.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/omap4iss/iss_video.c 
b/drivers/staging/media/omap4iss/iss_video.c
index e21811a..0bac582 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -301,7 +301,8 @@ iss_video_check_format(struct iss_video *video, struct 
iss_video_fh *vfh)
 
 static int iss_video_queue_setup(struct vb2_queue *vq,
 unsigned int *count, unsigned int *num_planes,
-unsigned int sizes[], struct device 
*alloc_devs[])
+unsigned int sizes[],
+struct device *alloc_devs[])
 {
struct iss_video_fh *vfh = vb2_get_drv_priv(vq);
struct iss_video *video = vfh->video;
-- 
2.7.4

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


[PATCH v3 1/2] staging: omap4iss: fix multiline comment style

2017-02-07 Thread Avraham Shukron
Signed-off-by: Avraham Shukron 
---
 drivers/staging/media/omap4iss/iss_video.c | 38 --
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/media/omap4iss/iss_video.c 
b/drivers/staging/media/omap4iss/iss_video.c
index bb0e3b4..e21811a 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -128,7 +128,8 @@ static unsigned int iss_video_mbus_to_pix(const struct 
iss_video *video,
pix->width = mbus->width;
pix->height = mbus->height;
 
-   /* Skip the last format in the loop so that it will be selected if no
+   /*
+* Skip the last format in the loop so that it will be selected if no
 * match is found.
 */
for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) {
@@ -138,7 +139,8 @@ static unsigned int iss_video_mbus_to_pix(const struct 
iss_video *video,
 
min_bpl = pix->width * ALIGN(formats[i].bpp, 8) / 8;
 
-   /* Clamp the requested bytes per line value. If the maximum bytes per
+   /*
+* Clamp the requested bytes per line value. If the maximum bytes per
 * line value is zero, the module doesn't support user configurable line
 * sizes. Override the requested value with the minimum in that case.
 */
@@ -172,7 +174,8 @@ static void iss_video_pix_to_mbus(const struct 
v4l2_pix_format *pix,
mbus->width = pix->width;
mbus->height = pix->height;
 
-   /* Skip the last format in the loop so that it will be selected if no
+   /*
+* Skip the last format in the loop so that it will be selected if no
 * match is found.
 */
for (i = 0; i < ARRAY_SIZE(formats) - 1; ++i) {
@@ -360,7 +363,8 @@ static void iss_video_buf_queue(struct vb2_buffer *vb)
 
spin_lock_irqsave(>qlock, flags);
 
-   /* Mark the buffer is faulty and give it back to the queue immediately
+   /*
+* Mark the buffer is faulty and give it back to the queue immediately
 * if the video node has registered an error. vb2 will perform the same
 * check when preparing the buffer, but that is inherently racy, so we
 * need to handle the race condition with an authoritative check here.
@@ -443,7 +447,8 @@ struct iss_buffer *omap4iss_video_buffer_next(struct 
iss_video *video)
 
buf->vb.vb2_buf.timestamp = ktime_get_ns();
 
-   /* Do frame number propagation only if this is the output video node.
+   /*
+* Do frame number propagation only if this is the output video node.
 * Frame number either comes from the CSI receivers or it gets
 * incremented here if H3A is not active.
 * Note: There is no guarantee that the output buffer will finish
@@ -605,7 +610,8 @@ iss_video_set_format(struct file *file, void *fh, struct 
v4l2_format *format)
 
mutex_lock(>mutex);
 
-   /* Fill the bytesperline and sizeimage fields by converting to media bus
+   /*
+* Fill the bytesperline and sizeimage fields by converting to media bus
 * format and back to pixel format.
 */
iss_video_pix_to_mbus(>fmt.pix, );
@@ -678,8 +684,9 @@ iss_video_get_selection(struct file *file, void *fh, struct 
v4l2_selection *sel)
if (subdev == NULL)
return -EINVAL;
 
-   /* Try the get selection operation first and fallback to get format if 
not
-* implemented.
+   /*
+* Try the get selection operation first and fallback to get format if
+* not implemented.
 */
sdsel.pad = pad;
ret = v4l2_subdev_call(subdev, pad, get_selection, NULL, );
@@ -867,7 +874,8 @@ iss_video_streamon(struct file *file, void *fh, enum 
v4l2_buf_type type)
 
mutex_lock(>stream_lock);
 
-   /* Start streaming on the pipeline. No link touching an entity in the
+   /*
+* Start streaming on the pipeline. No link touching an entity in the
 * pipeline can be activated or deactivated once streaming is started.
 */
pipe = entity->pipe
@@ -895,7 +903,8 @@ iss_video_streamon(struct file *file, void *fh, enum 
v4l2_buf_type type)
while ((entity = media_graph_walk_next()))
media_entity_enum_set(>ent_enum, entity);
 
-   /* Verify that the currently configured format matches the output of
+   /*
+* Verify that the currently configured format matches the output of
 * the connected subdev.
 */
ret = iss_video_check_format(video, vfh);
@@ -905,7 +914,8 @@ iss_video_streamon(struct file *file, void *fh, enum 
v4l2_buf_type type)
video->bpl_padding = ret;
video->bpl_value = vfh->format.fmt.pix.bytesperline;
 
-   /* Find the ISS video node connected at the far end of the pipeline and
+   /*
+* Find the ISS video node connected at the far end of the pipeline and
 * update the pipeline.
 */

Re: [PATCH v3 13/24] platform: add video-multiplexer subdevice driver

2017-02-07 Thread Benoit Parrot
Laurent Pinchart  wrote on Tue [2017-Feb-07 
12:26:32 +0200]:
> Hi Steve,
> 
> On Monday 06 Feb 2017 15:10:46 Steve Longerbeam wrote:
> > On 02/06/2017 02:33 PM, Laurent Pinchart wrote:
> > > On Monday 06 Feb 2017 10:50:22 Hans Verkuil wrote:
> > >> On 02/05/2017 04:48 PM, Laurent Pinchart wrote:
> > >>> On Tuesday 24 Jan 2017 18:07:55 Steve Longerbeam wrote:
> >  On 01/24/2017 04:02 AM, Philipp Zabel wrote:
> > > On Fri, 2017-01-20 at 15:03 +0100, Hans Verkuil wrote:
> > >>> +
> > >>> +int vidsw_g_mbus_config(struct v4l2_subdev *sd, struct
> > >>> v4l2_mbus_config *cfg)
> 
> [snip]
> 
> > >> I am not certain this op is needed at all. In the current kernel this
> > >> op is only used by soc_camera, pxa_camera and omap3isp (somewhat
> > >> dubious). Normally this information should come from the device tree
> > >> and there should be no need for this op.
> > >> 
> > >> My (tentative) long-term plan was to get rid of this op.
> > >> 
> > >> If you don't need it, then I recommend it is removed.
> >  
> >  Hi Hans, the imx-media driver was only calling g_mbus_config to the
> >  camera sensor, and it was doing that to determine the sensor's bus
> >  type. This info was already available from parsing a v4l2_of_endpoint
> >  from the sensor node. So it was simple to remove the g_mbus_config
> >  calls, and instead rely on the parsed sensor v4l2_of_endpoint.
> > >>> 
> > >>> That's not a good point.
> > > 
> > > (mea culpa, s/point/idea/)
> > > 
> > >>> The imx-media driver must not parse the sensor DT node as it is not
> > >>> aware of what bindings the sensor is compatible with.
> > 
> > Hi Laurent,
> > 
> > I don't really understand this argument. The sensor node has been found
> > by parsing the OF graph, so it is known to be a camera sensor node at
> > that point.
> 
> All you know in the i.MX6 driver is that the remote node is a video source. 
> You can rely on the fact that it implements the OF graph bindings to locate 
> other ports in that DT node, but that's more or less it.
> 
> DT properties are defined by DT bindings and thus qualified by a compatible 
> string. Unless you match on sensor compat strings in the i.MX6 driver (which 
> you shouldn't do, to keep the driver generic) you can't know for certain how 
> to parse the sensor node DT properties. For all you know, the video source 
> could be a bridge such as an HDMI to CSI-2 converter for instance, so you 
> can't even rely on the fact that it's a sensor.
> 
> > >>> Information must instead be queried from the sensor subdev at runtime,
> > >>> through the g_mbus_config() operation.
> > >>> 
> > >>> Of course, if you can get the information from the imx-media DT node,
> > >>> that's certainly an option. It's only information provided by the sensor
> > >>> driver that you have no choice but query using a subdev operation.
> > >> 
> > >> Shouldn't this come from the imx-media DT node? BTW, why is omap3isp
> > >> using this?
> > > 
> > > It all depends on what type of information needs to be retrieved, and
> > > whether it can change at runtime or is fixed. Adding properties to the
> > > imx-media DT node is certainly fine as long as those properties describe
> > > the i.MX side.
> >
> > In this case the info needed is the media bus type. That info is most easily
> > available by calling v4l2_of_parse_endpoint() on the sensor's endpoint
> > node.
> 
> I haven't had time to check the code in details yet, so I can't really 
> comment 
> on what you need and how it should be implemented exactly.
> 
> > The media bus type is not something that can be added to the
> > imx-media node since it contains no endpoint nodes.
> 
> Agreed. You have endpoints in the CSI nodes though.
> 
> > > In the omap3isp case, we use the operation to query whether parallel data
> > > contains embedded sync (BT.656) or uses separate h/v sync signals.
> > > 
> > >> The reason I am suspicious about this op is that it came from soc-camera
> > >> and predates the DT. The contents of v4l2_mbus_config seems very much
> > >> like a HW description to me, i.e. something that belongs in the DT.
> > > 
> > > Part of it is possibly outdated, but for buses that support multiple modes
> > > of operation (such as the parallel bus case described above) we need to
> > > make that information discoverable at runtime. Maybe this should be
> > > considered as related to Sakari's efforts to support VC/DT for CSI-2, and
> > > supported through the API he is working on.
> > 
> > That sounds interesting, can you point me to some info on this effort?
> 
> Sure.
> 
> http://git.retiisi.org.uk/?p=~sailus/linux.git;a=shortlog;h=refs/heads/vc
> 
> > I've been thinking the DT should contain virtual channel info for CSI-2
> > buses.
> 
> I don't think it should. CSI-2 virtual channels and data types should be 
> handled as a software concept, and thus supported through driver code without 
> 

RE: [PATCH 00/10][v2] staging: fsl-mc: fixes and cleanups

2017-02-07 Thread Stuart Yoder


> -Original Message-
> From: laurentiu.tu...@nxp.com [mailto:laurentiu.tu...@nxp.com]
> Sent: Tuesday, February 07, 2017 8:15 AM
> To: gre...@linuxfoundation.org
> Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; ag...@suse.de; 
> a...@arndb.de; Ioana
> Ciornei ; Ruxandra Ioana Radulescu 
> ; Bharat Bhushan
> ; Stuart Yoder ; Catalin 
> Horghidan
> ; Leo Li ; Roy Pledge 
> ; linux-arm-
> ker...@lists.infradead.org; Laurentiu Tudor 
> Subject: [PATCH 00/10][v2] staging: fsl-mc: fixes and cleanups
> 
> From: Laurentiu Tudor 
> 
> First 4 patches fix several driver model related
> issues and drop an useless atomic global.
> The rest of the patches are cleanups mostly
> consisting in removing dead code.
> 
> v2:
>  - split slab cache removal in distinct patch
>  - redundant deallocation dropped in patch that adds release callback

Laurentiu,

A few nits about this submission:

-every patch in the series should have had "v2" in the patch
 subject.  In your submission only the cover letter had it.
 Without that it's harder to keep track of which version of
 patch I'm looking at.  Just use this when formatting your
 patches:
 --patch-subject="PATCH v2"

-for each patch, you should note below the "---" what changed in the
 patch, and if there were no changes you put "no changes".  For
 an example see:
 https://patchwork.kernel.org/patch/9478093/

 (You can use "git notes" to manage the below the "---" comments
  if it helps)

Can you reformat this series with "v3" and add the the comments
to note what did not change and what did change?

Thanks,
Stuart

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


[PATCH] Drivers: hv: balloon: hide the inflated balloon pages

2017-02-07 Thread Vitaly Kuznetsov
When the balloon is inflated we see it as kernel allocated memory and this
is confusing especially when it is used as a replacement for memory hot
unplug. Hide the balloon with adjust_managed_page_count(). Virtio
ballooning driver does this already.

compute_balloon_floor() is adjusted to keep the existing behavior.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/hv_balloon.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 14c3dc4b..8b22451 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -1049,7 +1049,10 @@ static void process_info(struct hv_dynmem_device *dm, 
struct dm_info_msg *msg)
 
 static unsigned long compute_balloon_floor(void)
 {
+   unsigned long curram_pages = totalram_pages +
+   dm_device.num_pages_ballooned;
unsigned long min_pages;
+
 #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT))
/* Simple continuous piecewiese linear function:
 *  max MiB -> min MiB  gradient
@@ -1062,16 +1065,16 @@ static unsigned long compute_balloon_floor(void)
 *8192   744(1/16)
 *   32768  1512(1/32)
 */
-   if (totalram_pages < MB2PAGES(128))
-   min_pages = MB2PAGES(8) + (totalram_pages >> 1);
-   else if (totalram_pages < MB2PAGES(512))
-   min_pages = MB2PAGES(40) + (totalram_pages >> 2);
-   else if (totalram_pages < MB2PAGES(2048))
-   min_pages = MB2PAGES(104) + (totalram_pages >> 3);
-   else if (totalram_pages < MB2PAGES(8192))
-   min_pages = MB2PAGES(232) + (totalram_pages >> 4);
+   if (curram_pages < MB2PAGES(128))
+   min_pages = MB2PAGES(8) + (curram_pages >> 1);
+   else if (curram_pages < MB2PAGES(512))
+   min_pages = MB2PAGES(40) + (curram_pages >> 2);
+   else if (curram_pages < MB2PAGES(2048))
+   min_pages = MB2PAGES(104) + (curram_pages >> 3);
+   else if (curram_pages < MB2PAGES(8192))
+   min_pages = MB2PAGES(232) + (curram_pages >> 4);
else
-   min_pages = MB2PAGES(488) + (totalram_pages >> 5);
+   min_pages = MB2PAGES(488) + (curram_pages >> 5);
 #undef MB2PAGES
return min_pages;
 }
@@ -1156,6 +1159,7 @@ static void free_balloon_pages(struct hv_dynmem_device 
*dm,
for (i = 0; i < num_pages; i++) {
pg = pfn_to_page(i + start_frame);
__free_page(pg);
+   adjust_managed_page_count(pg, 1);
dm->num_pages_ballooned--;
}
 }
@@ -1190,6 +1194,7 @@ static unsigned int alloc_balloon_pages(struct 
hv_dynmem_device *dm,
return i * alloc_unit;
 
dm->num_pages_ballooned += alloc_unit;
+   adjust_managed_page_count(pg, -alloc_unit);
 
/*
 * If we allocatted 2M pages; split them so we
-- 
2.9.3

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


[PATCH 04/10] staging: fsl-mc: don't use devres api for refcounted objects

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Mixing two memory management systems, in this case
managed device resource api and refcounted objects
is a bad idea. Lifetime of an object is controlled
by its refcount so allocating it with other apis
that have their own lifetime control is not ok.
Drop devm_*() apis in favor of plain allocations.

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

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 5963e98..f310687 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -430,7 +430,7 @@ static void fsl_mc_device_release(struct device *dev)
mc_bus = to_fsl_mc_bus(mc_dev);
 
if (mc_bus)
-   devm_kfree(mc_dev->dev.parent, mc_bus);
+   kfree(mc_bus);
else
kmem_cache_free(mc_dev_cache, mc_dev);
 }
@@ -457,7 +457,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
/*
 * Allocate an MC bus device object:
 */
-   mc_bus = devm_kzalloc(parent_dev, sizeof(*mc_bus), GFP_KERNEL);
+   mc_bus = kzalloc(sizeof(*mc_bus), GFP_KERNEL);
if (!mc_bus)
return -ENOMEM;
 
@@ -562,7 +562,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
 error_cleanup_dev:
kfree(mc_dev->regions);
if (mc_bus)
-   devm_kfree(parent_dev, mc_bus);
+   kfree(mc_bus);
else
kmem_cache_free(mc_dev_cache, mc_dev);
 
-- 
1.8.3.1

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


Re: [PATCH] staging: greybus: operation: add generic timeout support

2017-02-07 Thread Bryan O'Donoghue
On 07/02/17 14:19, Johan Hovold wrote:
> On Mon, Jan 23, 2017 at 01:04:14PM +0100, Johan Hovold wrote:
>> Add a struct timer_list to struct gb_operation and use that to implement
>> generic operation timeouts.
>>
>> This simplifies the synchronous operation handling somewhat while also
>> providing a generic timeout mechanism that drivers can use for
>> asynchronous operations.
>>
>> Signed-off-by: Johan Hovold 
> 
> Greg,
> 
> I believe you can apply this one now. This is the right way to implement
> operation timeouts, and it is independent of Bryan's patches converting
> loopback to use the new interface, which can be applied on top when they
> are ready.
> 
> Thanks,
> Johan
> 

Haven't really had time to look at this but, since it's the way you want
to do it, I guess go ahead.

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


[PATCH 03/10] staging: fsl-mc: add device release callback

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

When hot unplugging a mc-bus device the kernel displays
this pertinent message, followed by a stack dump:
"Device 'foo.N' does not have a release() function,
 it is broken and must be fixed."
Add the required callback to fix and drop the now
uneeded explicit freeing.

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

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 7c6a43b..5963e98 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -419,6 +419,22 @@ bool fsl_mc_is_root_dprc(struct device *dev)
return dev == root_dprc_dev;
 }
 
+static void fsl_mc_device_release(struct device *dev)
+{
+   struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
+   struct fsl_mc_bus *mc_bus = NULL;
+
+   kfree(mc_dev->regions);
+
+   if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
+   mc_bus = to_fsl_mc_bus(mc_dev);
+
+   if (mc_bus)
+   devm_kfree(mc_dev->dev.parent, mc_bus);
+   else
+   kmem_cache_free(mc_dev_cache, mc_dev);
+}
+
 /**
  * Add a newly discovered fsl-mc device to be visible in Linux
  */
@@ -460,6 +476,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
device_initialize(_dev->dev);
mc_dev->dev.parent = parent_dev;
mc_dev->dev.bus = _mc_bus_type;
+   mc_dev->dev.release = fsl_mc_device_release;
dev_set_name(_dev->dev, "%s.%d", obj_desc->type, obj_desc->id);
 
if (strcmp(obj_desc->type, "dprc") == 0) {
@@ -561,23 +578,11 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
  */
 void fsl_mc_device_remove(struct fsl_mc_device *mc_dev)
 {
-   struct fsl_mc_bus *mc_bus = NULL;
-
-   kfree(mc_dev->regions);
-
/*
 * The device-specific remove callback will get invoked by device_del()
 */
device_del(_dev->dev);
put_device(_dev->dev);
-
-   if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
-   mc_bus = to_fsl_mc_bus(mc_dev);
-
-   if (mc_bus)
-   devm_kfree(mc_dev->dev.parent, mc_bus);
-   else
-   kmem_cache_free(mc_dev_cache, mc_dev);
 }
 EXPORT_SYMBOL_GPL(fsl_mc_device_remove);
 
-- 
1.8.3.1

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


Re: [PATCH] staging: greybus: operation: add generic timeout support

2017-02-07 Thread Johan Hovold
On Mon, Jan 23, 2017 at 01:04:14PM +0100, Johan Hovold wrote:
> Add a struct timer_list to struct gb_operation and use that to implement
> generic operation timeouts.
> 
> This simplifies the synchronous operation handling somewhat while also
> providing a generic timeout mechanism that drivers can use for
> asynchronous operations.
> 
> Signed-off-by: Johan Hovold 

Greg,

I believe you can apply this one now. This is the right way to implement
operation timeouts, and it is independent of Bryan's patches converting
loopback to use the new interface, which can be applied on top when they
are ready.

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


Re: [patch] Staging: bcm2835-audio: fix an uninitialized return value

2017-02-07 Thread Dan Carpenter
On Tue, Feb 07, 2017 at 03:01:23PM +0100, Arnd Bergmann wrote:
> On Tue, Feb 7, 2017 at 2:17 PM, Dan Carpenter  
> wrote:
> > "ret" isn't necessarily initialized on the success path.
> >
> > Signed-off-by: Dan Carpenter 
> >
> 
> The patch seems correct, but do you have any idea why gcc-7 didn't
> warn about this?

Heh...  I'm not a gcc dev.  Checking for uninitialized variables is
harder than I would have thought though..

> I assume that you found it with smatch, and nobody else did.

Yep.  I'm getting close to releasing my uninitialized variable check.

I guess the one thing holding me back is that I still have tons of false
positives caused by mismatches between "if (ret)" and "if (ret < 0)"
where the function assumes that non-zero is an error but the caller
assumes that errors are negative.

regards,
dan carpenter

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


[PATCH 10/10] staging: fsl-mc: dprc: drop unused APIs

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Leave only APIs that area actually used in the bus driver.
The patch is mostly mechanical, with a couple exceptions:
 - getters/setters were not removed even if only one of
   them is being used
 - versioning API was also left in place
They will be added back on an as-needed basis.

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dprc-cmd.h |  18 -
 drivers/staging/fsl-mc/bus/dprc.c | 666 --
 drivers/staging/fsl-mc/include/dprc.h | 243 -
 3 files changed, 927 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h 
b/drivers/staging/fsl-mc/bus/dprc-cmd.h
index 588b8ca..e9fdca4 100644
--- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
@@ -53,11 +53,9 @@
 /* Command IDs */
 #define DPRC_CMDID_CLOSEDPRC_CMD(0x800)
 #define DPRC_CMDID_OPEN DPRC_CMD(0x805)
-#define DPRC_CMDID_CREATE   DPRC_CMD(0x905)
 #define DPRC_CMDID_GET_API_VERSION  DPRC_CMD(0xa05)
 
 #define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
-#define DPRC_CMDID_RESET_CONT   DPRC_CMD(0x005)
 
 #define DPRC_CMDID_SET_IRQ  DPRC_CMD(0x010)
 #define DPRC_CMDID_GET_IRQ  DPRC_CMD(0x011)
@@ -68,29 +66,13 @@
 #define DPRC_CMDID_GET_IRQ_STATUS   DPRC_CMD(0x016)
 #define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
 
-#define DPRC_CMDID_CREATE_CONT  DPRC_CMD(0x151)
-#define DPRC_CMDID_DESTROY_CONT DPRC_CMD(0x152)
 #define DPRC_CMDID_GET_CONT_ID  DPRC_CMD(0x830)
-#define DPRC_CMDID_SET_RES_QUOTADPRC_CMD(0x155)
-#define DPRC_CMDID_GET_RES_QUOTADPRC_CMD(0x156)
-#define DPRC_CMDID_ASSIGN   DPRC_CMD(0x157)
-#define DPRC_CMDID_UNASSIGN DPRC_CMD(0x158)
 #define DPRC_CMDID_GET_OBJ_COUNTDPRC_CMD(0x159)
 #define DPRC_CMDID_GET_OBJ  DPRC_CMD(0x15A)
 #define DPRC_CMDID_GET_RES_COUNTDPRC_CMD(0x15B)
-#define DPRC_CMDID_GET_RES_IDS  DPRC_CMD(0x15C)
 #define DPRC_CMDID_GET_OBJ_REG  DPRC_CMD(0x15E)
 #define DPRC_CMDID_SET_OBJ_IRQ  DPRC_CMD(0x15F)
 #define DPRC_CMDID_GET_OBJ_IRQ  DPRC_CMD(0x160)
-#define DPRC_CMDID_SET_OBJ_LABELDPRC_CMD(0x161)
-#define DPRC_CMDID_GET_OBJ_DESC DPRC_CMD(0x162)
-
-#define DPRC_CMDID_CONNECT  DPRC_CMD(0x167)
-#define DPRC_CMDID_DISCONNECT   DPRC_CMD(0x168)
-#define DPRC_CMDID_GET_POOL DPRC_CMD(0x169)
-#define DPRC_CMDID_GET_POOL_COUNT   DPRC_CMD(0x16A)
-
-#define DPRC_CMDID_GET_CONNECTION   DPRC_CMD(0x16C)
 
 struct dprc_cmd_open {
__le32 container_id;
diff --git a/drivers/staging/fsl-mc/bus/dprc.c 
b/drivers/staging/fsl-mc/bus/dprc.c
index 572edd4..fcf7b47 100644
--- a/drivers/staging/fsl-mc/bus/dprc.c
+++ b/drivers/staging/fsl-mc/bus/dprc.c
@@ -100,133 +100,6 @@ int dprc_close(struct fsl_mc_io *mc_io,
 EXPORT_SYMBOL(dprc_close);
 
 /**
- * dprc_create_container() - Create child container
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @cfg:   Child container configuration
- * @child_container_id:Returned child container ID
- * @child_portal_offset: Returned child portal offset from MC portal base
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_create_container(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- struct dprc_cfg *cfg,
- int *child_container_id,
- u64 *child_portal_offset)
-{
-   struct mc_command cmd = { 0 };
-   struct dprc_cmd_create_container *cmd_params;
-   struct dprc_rsp_create_container *rsp_params;
-   int err;
-
-   /* prepare command */
-   cmd_params = (struct dprc_cmd_create_container *)cmd.params;
-   cmd_params->options = cpu_to_le32(cfg->options);
-   cmd_params->icid = cpu_to_le16(cfg->icid);
-   cmd_params->portal_id = cpu_to_le32(cfg->portal_id);
-   strncpy(cmd_params->label, cfg->label, 16);
-   cmd_params->label[15] = '\0';
-
-   cmd.header = mc_encode_cmd_header(DPRC_CMDID_CREATE_CONT,
- cmd_flags, token);
-
-   /* send command to mc*/
-   err = mc_send_command(mc_io, );
-   if (err)
-   return err;
-
-   /* retrieve response parameters */
-   rsp_params = (struct dprc_rsp_create_container *)cmd.params;
-   *child_container_id = le32_to_cpu(rsp_params->child_container_id);
-   *child_portal_offset = 

[PATCH 06/10] staging: fsl-mc: dpmcp: drop unused APIs

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

These APIs are not used yet, so drop the dead code.
The patch is mostly mechanical, with a couple exceptions:
 - getters/setters were not removed even if only one of
   them is being used
 - versioning API was also left in place
Also in this patch, add missing prototype for
version query function.

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h |  95 
 drivers/staging/fsl-mc/bus/dpmcp.c | 382 -
 drivers/staging/fsl-mc/bus/dpmcp.h | 100 +
 3 files changed, 4 insertions(+), 573 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index 7cb5149..384a13d 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -45,107 +45,12 @@
 /* Command IDs */
 #define DPMCP_CMDID_CLOSE  DPMCP_CMD(0x800)
 #define DPMCP_CMDID_OPEN   DPMCP_CMD(0x80b)
-#define DPMCP_CMDID_CREATE DPMCP_CMD(0x90b)
-#define DPMCP_CMDID_DESTROYDPMCP_CMD(0x98b)
 #define DPMCP_CMDID_GET_API_VERSIONDPMCP_CMD(0xa0b)
 
-#define DPMCP_CMDID_GET_ATTR   DPMCP_CMD(0x004)
 #define DPMCP_CMDID_RESET  DPMCP_CMD(0x005)
 
-#define DPMCP_CMDID_SET_IRQDPMCP_CMD(0x010)
-#define DPMCP_CMDID_GET_IRQDPMCP_CMD(0x011)
-#define DPMCP_CMDID_SET_IRQ_ENABLE DPMCP_CMD(0x012)
-#define DPMCP_CMDID_GET_IRQ_ENABLE DPMCP_CMD(0x013)
-#define DPMCP_CMDID_SET_IRQ_MASK   DPMCP_CMD(0x014)
-#define DPMCP_CMDID_GET_IRQ_MASK   DPMCP_CMD(0x015)
-#define DPMCP_CMDID_GET_IRQ_STATUS DPMCP_CMD(0x016)
-
 struct dpmcp_cmd_open {
__le32 dpmcp_id;
 };
 
-struct dpmcp_cmd_create {
-   __le32 portal_id;
-};
-
-struct dpmcp_cmd_destroy {
-   __le32 object_id;
-};
-
-struct dpmcp_cmd_set_irq {
-   /* cmd word 0 */
-   u8 irq_index;
-   u8 pad[3];
-   __le32 irq_val;
-   /* cmd word 1 */
-   __le64 irq_addr;
-   /* cmd word 2 */
-   __le32 irq_num;
-};
-
-struct dpmcp_cmd_get_irq {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpmcp_rsp_get_irq {
-   /* cmd word 0 */
-   __le32 irq_val;
-   __le32 pad;
-   /* cmd word 1 */
-   __le64 irq_paddr;
-   /* cmd word 2 */
-   __le32 irq_num;
-   __le32 type;
-};
-
-#define DPMCP_ENABLE   0x1
-
-struct dpmcp_cmd_set_irq_enable {
-   u8 enable;
-   u8 pad[3];
-   u8 irq_index;
-};
-
-struct dpmcp_cmd_get_irq_enable {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpmcp_rsp_get_irq_enable {
-   u8 enabled;
-};
-
-struct dpmcp_cmd_set_irq_mask {
-   __le32 mask;
-   u8 irq_index;
-};
-
-struct dpmcp_cmd_get_irq_mask {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpmcp_rsp_get_irq_mask {
-   __le32 mask;
-};
-
-struct dpmcp_cmd_get_irq_status {
-   __le32 status;
-   u8 irq_index;
-};
-
-struct dpmcp_rsp_get_irq_status {
-   __le32 status;
-};
-
-struct dpmcp_rsp_get_attributes {
-   /* response word 0 */
-   __le32 pad;
-   __le32 id;
-   /* response word 1 */
-   __le16 version_major;
-   __le16 version_minor;
-};
-
 #endif /* _FSL_DPMCP_CMD_H */
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index e4d1651..ad4c8b4 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -104,82 +104,6 @@ int dpmcp_close(struct fsl_mc_io *mc_io,
 }
 
 /**
- * dpmcp_create() - Create the DPMCP object.
- * @mc_io: Pointer to MC portal's I/O object
- * @dprc_token:Parent container token; '0' for default container
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @cfg:   Configuration structure
- * @obj_id:Returned object id; use in subsequent API calls
- *
- * Create the DPMCP object, allocate required resources and
- * perform required initialization.
- *
- * The object can be created either by declaring it in the
- * DPL file, or by calling this function.
-
- * This function accepts an authentication token of a parent
- * container that this object should be assigned to and returns
- * an object id. This object_id will be used in all subsequent calls to
- * this specific object.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmcp_create(struct fsl_mc_io *mc_io,
-u16 dprc_token,
-u32 cmd_flags,
-const struct dpmcp_cfg *cfg,
-u32 *obj_id)
-{
-   struct mc_command cmd = { 0 };
-   struct dpmcp_cmd_create *cmd_params;
-
-   int err;
-
-   /* prepare command */
-   cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CREATE,
- cmd_flags, dprc_token);
-   cmd_params = (struct dpmcp_cmd_create *)cmd.params;
-   cmd_params->portal_id = cpu_to_le32(cfg->portal_id);
-
-   /* send command 

[PATCH 09/10] staging: fsl-mc: dpbp: add a few missing EXPORT_SYMBOL()s

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

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

diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index 1fa7257..d9e450a 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -183,6 +183,7 @@ int dpbp_is_enabled(struct fsl_mc_io *mc_io,
 
return 0;
 }
+EXPORT_SYMBOL(dpbp_is_enabled);
 
 /**
  * dpbp_reset() - Reset the DPBP, returns the object to initial state.
@@ -205,6 +206,7 @@ int dpbp_reset(struct fsl_mc_io *mc_io,
/* send command to mc*/
return mc_send_command(mc_io, );
 }
+EXPORT_SYMBOL(dpbp_reset);
 
 /**
  * dpbp_get_attributes - Retrieve DPBP attributes.
@@ -274,3 +276,4 @@ int dpbp_get_api_version(struct fsl_mc_io *mc_io,
 
return 0;
 }
+EXPORT_SYMBOL(dpbp_get_api_version);
-- 
1.8.3.1

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


[PATCH 08/10] staging: fsl-mc: dpbp: drop unused APIs

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Leave only APIs that will be used in upcomming drivers.
The patch is mostly mechanical, with a couple exceptions:
 - getters/setters were not removed even if only one of
   them is being used
 - versioning API was also left in place
They will be added back on an as-needed basis.

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dpbp-cmd.h | 116 -
 drivers/staging/fsl-mc/bus/dpbp.c | 449 --
 drivers/staging/fsl-mc/include/dpbp.h | 129 --
 3 files changed, 694 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
index 7d86539..8aa6545 100644
--- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h
@@ -45,8 +45,6 @@
 /* Command IDs */
 #define DPBP_CMDID_CLOSE   DPBP_CMD(0x800)
 #define DPBP_CMDID_OPENDPBP_CMD(0x804)
-#define DPBP_CMDID_CREATE  DPBP_CMD(0x904)
-#define DPBP_CMDID_DESTROY DPBP_CMD(0x984)
 #define DPBP_CMDID_GET_API_VERSION DPBP_CMD(0xa04)
 
 #define DPBP_CMDID_ENABLE  DPBP_CMD(0x002)
@@ -55,18 +53,6 @@
 #define DPBP_CMDID_RESET   DPBP_CMD(0x005)
 #define DPBP_CMDID_IS_ENABLED  DPBP_CMD(0x006)
 
-#define DPBP_CMDID_SET_IRQ DPBP_CMD(0x010)
-#define DPBP_CMDID_GET_IRQ DPBP_CMD(0x011)
-#define DPBP_CMDID_SET_IRQ_ENABLE  DPBP_CMD(0x012)
-#define DPBP_CMDID_GET_IRQ_ENABLE  DPBP_CMD(0x013)
-#define DPBP_CMDID_SET_IRQ_MASKDPBP_CMD(0x014)
-#define DPBP_CMDID_GET_IRQ_MASKDPBP_CMD(0x015)
-#define DPBP_CMDID_GET_IRQ_STATUS  DPBP_CMD(0x016)
-#define DPBP_CMDID_CLEAR_IRQ_STATUSDPBP_CMD(0x017)
-
-#define DPBP_CMDID_SET_NOTIFICATIONS   DPBP_CMD(0x01b0)
-#define DPBP_CMDID_GET_NOTIFICATIONS   DPBP_CMD(0x01b1)
-
 struct dpbp_cmd_open {
__le32 dpbp_id;
 };
@@ -81,76 +67,6 @@ struct dpbp_rsp_is_enabled {
u8 enabled;
 };
 
-struct dpbp_cmd_set_irq {
-   /* cmd word 0 */
-   u8 irq_index;
-   u8 pad[3];
-   __le32 irq_val;
-   /* cmd word 1 */
-   __le64 irq_addr;
-   /* cmd word 2 */
-   __le32 irq_num;
-};
-
-struct dpbp_cmd_get_irq {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpbp_rsp_get_irq {
-   /* response word 0 */
-   __le32 irq_val;
-   __le32 pad;
-   /* response word 1 */
-   __le64 irq_addr;
-   /* response word 2 */
-   __le32 irq_num;
-   __le32 type;
-};
-
-struct dpbp_cmd_set_irq_enable {
-   u8 enable;
-   u8 pad[3];
-   u8 irq_index;
-};
-
-struct dpbp_cmd_get_irq_enable {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpbp_rsp_get_irq_enable {
-   u8 enabled;
-};
-
-struct dpbp_cmd_set_irq_mask {
-   __le32 mask;
-   u8 irq_index;
-};
-
-struct dpbp_cmd_get_irq_mask {
-   __le32 pad;
-   u8 irq_index;
-};
-
-struct dpbp_rsp_get_irq_mask {
-   __le32 mask;
-};
-
-struct dpbp_cmd_get_irq_status {
-   __le32 status;
-   u8 irq_index;
-};
-
-struct dpbp_rsp_get_irq_status {
-   __le32 status;
-};
-
-struct dpbp_cmd_clear_irq_status {
-   __le32 status;
-   u8 irq_index;
-};
-
 struct dpbp_rsp_get_attributes {
/* response word 0 */
__le16 pad;
@@ -161,36 +77,4 @@ struct dpbp_rsp_get_attributes {
__le16 version_minor;
 };
 
-struct dpbp_cmd_set_notifications {
-   /* cmd word 0 */
-   __le32 depletion_entry;
-   __le32 depletion_exit;
-   /* cmd word 1 */
-   __le32 surplus_entry;
-   __le32 surplus_exit;
-   /* cmd word 2 */
-   __le16 options;
-   __le16 pad[3];
-   /* cmd word 3 */
-   __le64 message_ctx;
-   /* cmd word 4 */
-   __le64 message_iova;
-};
-
-struct dpbp_rsp_get_notifications {
-   /* response word 0 */
-   __le32 depletion_entry;
-   __le32 depletion_exit;
-   /* response word 1 */
-   __le32 surplus_entry;
-   __le32 surplus_exit;
-   /* response word 2 */
-   __le16 options;
-   __le16 pad[3];
-   /* response word 3 */
-   __le64 message_ctx;
-   /* response word 4 */
-   __le64 message_iova;
-};
-
 #endif /* _FSL_DPBP_CMD_H */
diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index cf4782f..1fa7257 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -106,77 +106,6 @@ int dpbp_close(struct fsl_mc_io *mc_io,
 EXPORT_SYMBOL(dpbp_close);
 
 /**
- * dpbp_create() - Create the DPBP object.
- * @mc_io: Pointer to MC portal's I/O object
- * @dprc_token:Parent container token; '0' for default container
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @cfg:   Configuration structure
- * @obj_id:Returned object id; use in subsequent API calls
- *
- * Create the DPBP object, allocate required resources and
- * perform 

[PATCH 05/10] staging: fsl-mc: remove slab cache for mc devices

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Let's drop the slab cache for objects
until we actually have proof that it improves
performance. This makes the code cleaner.

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

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index f310687..e607e98 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -27,8 +27,6 @@
 #include "fsl-mc-private.h"
 #include "dprc-cmd.h"
 
-static struct kmem_cache *mc_dev_cache;
-
 /**
  * Default DMA mask for devices on a fsl-mc bus
  */
@@ -432,7 +430,7 @@ static void fsl_mc_device_release(struct device *dev)
if (mc_bus)
kfree(mc_bus);
else
-   kmem_cache_free(mc_dev_cache, mc_dev);
+   kfree(mc_dev);
 }
 
 /**
@@ -466,7 +464,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
/*
 * Allocate a regular fsl_mc_device object:
 */
-   mc_dev = kmem_cache_zalloc(mc_dev_cache, GFP_KERNEL);
+   mc_dev = kzalloc(sizeof(*mc_dev), GFP_KERNEL);
if (!mc_dev)
return -ENOMEM;
}
@@ -564,7 +562,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
if (mc_bus)
kfree(mc_bus);
else
-   kmem_cache_free(mc_dev_cache, mc_dev);
+   kfree(mc_dev);
 
return error;
 }
@@ -823,14 +821,6 @@ static int __init fsl_mc_bus_driver_init(void)
 {
int error;
 
-   mc_dev_cache = kmem_cache_create("fsl_mc_device",
-sizeof(struct fsl_mc_device), 0, 0,
-NULL);
-   if (!mc_dev_cache) {
-   pr_err("Could not create fsl_mc_device cache\n");
-   return -ENOMEM;
-   }
-
error = bus_register(_mc_bus_type);
if (error < 0) {
pr_err("bus type registration failed: %d\n", error);
@@ -870,7 +860,6 @@ static int __init fsl_mc_bus_driver_init(void)
bus_unregister(_mc_bus_type);
 
 error_cleanup_cache:
-   kmem_cache_destroy(mc_dev_cache);
return error;
 }
 postcore_initcall(fsl_mc_bus_driver_init);
-- 
1.8.3.1

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


[PATCH 01/10] staging: fsl-mc: drop root dprc counting

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

It was used just to sanity check some obscure
cases that are unlikely to ever happen.

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 26 +-
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index 5ac373c..cc20dc4 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -77,9 +77,6 @@ static int fsl_mc_bus_match(struct device *dev, struct 
device_driver *drv)
struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(drv);
bool found = false;
 
-   if (WARN_ON(!fsl_mc_bus_exists()))
-   goto out;
-
if (!mc_drv->match_id_table)
goto out;
 
@@ -149,8 +146,6 @@ struct bus_type fsl_mc_bus_type = {
 };
 EXPORT_SYMBOL_GPL(fsl_mc_bus_type);
 
-static atomic_t root_dprc_count = ATOMIC_INIT(0);
-
 static int fsl_mc_driver_probe(struct device *dev)
 {
struct fsl_mc_driver *mc_drv;
@@ -246,15 +241,6 @@ void fsl_mc_driver_unregister(struct fsl_mc_driver 
*mc_driver)
 EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister);
 
 /**
- * fsl_mc_bus_exists - check if a root dprc exists
- */
-bool fsl_mc_bus_exists(void)
-{
-   return atomic_read(_dprc_count) > 0;
-}
-EXPORT_SYMBOL_GPL(fsl_mc_bus_exists);
-
-/**
  * fsl_mc_get_root_dprc - function to traverse to the root dprc
  */
 void fsl_mc_get_root_dprc(struct device *dev,
@@ -506,8 +492,6 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
}
 
mc_io2 = mc_io;
-
-   atomic_inc(_dprc_count);
}
 
error = get_dprc_icid(mc_io2, obj_desc->id, _dev->icid);
@@ -588,17 +572,9 @@ void fsl_mc_device_remove(struct fsl_mc_device *mc_dev)
device_del(_dev->dev);
put_device(_dev->dev);
 
-   if (strcmp(mc_dev->obj_desc.type, "dprc") == 0) {
+   if (strcmp(mc_dev->obj_desc.type, "dprc") == 0)
mc_bus = to_fsl_mc_bus(mc_dev);
 
-   if (fsl_mc_is_root_dprc(_dev->dev)) {
-   if (atomic_read(_dprc_count) > 0)
-   atomic_dec(_dprc_count);
-   else
-   WARN_ON(1);
-   }
-   }
-
if (mc_bus)
devm_kfree(mc_dev->dev.parent, mc_bus);
else
-- 
1.8.3.1

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


[PATCH 00/10][v2] staging: fsl-mc: fixes and cleanups

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

First 4 patches fix several driver model related
issues and drop an useless atomic global.
The rest of the patches are cleanups mostly
consisting in removing dead code.

v2:
 - split slab cache removal in distinct patch
 - redundant deallocation dropped in patch that adds release callback

Laurentiu Tudor (10):
  staging: fsl-mc: drop root dprc counting
  staging: fsl-mc: fix device ref counting
  staging: fsl-mc: add device release callback
  staging: fsl-mc: don't use devres api for refcounted objects
  staging: fsl-mc: remove slab cache for mc devices
  staging: fsl-mc: dpmcp: drop unused APIs
  staging: fsl-mc: dpmng: drop unused prototype
  staging: fsl-mc: dpbp: drop unused APIs
  staging: fsl-mc: dpbp: add a few missing EXPORT_SYMBOL()s
  staging: fsl-mc: dprc: drop unused APIs

 drivers/staging/fsl-mc/bus/dpbp-cmd.h| 116 --
 drivers/staging/fsl-mc/bus/dpbp.c| 452 +
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h   |  95 -
 drivers/staging/fsl-mc/bus/dpmcp.c   | 382 --
 drivers/staging/fsl-mc/bus/dpmcp.h   | 100 +
 drivers/staging/fsl-mc/bus/dprc-cmd.h|  18 -
 drivers/staging/fsl-mc/bus/dprc-driver.c |   1 +
 drivers/staging/fsl-mc/bus/dprc.c| 666 ---
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c  |  75 +---
 drivers/staging/fsl-mc/include/dpbp.h| 129 --
 drivers/staging/fsl-mc/include/dpmng.h   |   4 -
 drivers/staging/fsl-mc/include/dprc.h| 243 ---
 12 files changed, 30 insertions(+), 2251 deletions(-)

-- 
1.8.3.1

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


[PATCH 07/10] staging: fsl-mc: dpmng: drop unused prototype

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

The implementation was removed in commit:

decd3d0cf (staging: fsl-mc: uprev binary interface to match MC v10.x)

but the prototype was left behind.

Also fix a message that was wrongly mentioning it.

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

diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index e607e98..47acb0a 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -752,7 +752,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
error = dprc_get_container_id(mc_io, 0, _id);
if (error < 0) {
dev_err(>dev,
-   "dpmng_get_container_id() failed: %d\n", error);
+   "dprc_get_container_id() failed: %d\n", error);
goto error_cleanup_mc_io;
}
 
diff --git a/drivers/staging/fsl-mc/include/dpmng.h 
b/drivers/staging/fsl-mc/include/dpmng.h
index 7d8e255..170c07d 100644
--- a/drivers/staging/fsl-mc/include/dpmng.h
+++ b/drivers/staging/fsl-mc/include/dpmng.h
@@ -64,8 +64,4 @@ int mc_get_version(struct fsl_mc_io *mc_io,
   u32 cmd_flags,
   struct mc_version *mc_ver_info);
 
-int dpmng_get_container_id(struct fsl_mc_io *mc_io,
-  u32 cmd_flags,
-  int *container_id);
-
 #endif /* __FSL_DPMNG_H */
-- 
1.8.3.1

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


[PATCH 02/10] staging: fsl-mc: fix device ref counting

2017-02-07 Thread laurentiu.tudor
From: Laurentiu Tudor 

Drop unneeded get_device() call at device creation
and, as per documentation, drop reference count
after using device_find_child() return.

Signed-off-by: Laurentiu Tudor 
---
 drivers/staging/fsl-mc/bus/dprc-driver.c | 1 +
 drivers/staging/fsl-mc/bus/fsl-mc-bus.c  | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 4e416d8..e4b0341 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -188,6 +188,7 @@ static void dprc_add_new_devices(struct fsl_mc_device 
*mc_bus_dev,
child_dev = fsl_mc_device_lookup(obj_desc, mc_bus_dev);
if (child_dev) {
check_plugged_state_change(child_dev, obj_desc);
+   put_device(_dev->dev);
continue;
}
 
diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c 
b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
index cc20dc4..7c6a43b 100644
--- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
@@ -537,7 +537,6 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
goto error_cleanup_dev;
}
 
-   (void)get_device(_dev->dev);
dev_dbg(parent_dev, "added %s\n", dev_name(_dev->dev));
 
*new_mc_dev = mc_dev;
-- 
1.8.3.1

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


Re: [PATCH v3 13/24] platform: add video-multiplexer subdevice driver

2017-02-07 Thread Laurent Pinchart
Hi Philipp,

On Tuesday 07 Feb 2017 11:41:30 Philipp Zabel wrote:
> On Tue, 2017-02-07 at 12:26 +0200, Laurent Pinchart wrote:
> > On Monday 06 Feb 2017 15:10:46 Steve Longerbeam wrote:
> >> On 02/06/2017 02:33 PM, Laurent Pinchart wrote:
> >>> On Monday 06 Feb 2017 10:50:22 Hans Verkuil wrote:
>  On 02/05/2017 04:48 PM, Laurent Pinchart wrote:
> > On Tuesday 24 Jan 2017 18:07:55 Steve Longerbeam wrote:
> >> On 01/24/2017 04:02 AM, Philipp Zabel wrote:
> >>> On Fri, 2017-01-20 at 15:03 +0100, Hans Verkuil wrote:
> > +
> > +int vidsw_g_mbus_config(struct v4l2_subdev *sd, struct
> > v4l2_mbus_config *cfg)
> > 
> > [snip]
> > 
>  I am not certain this op is needed at all. In the current kernel
>  this op is only used by soc_camera, pxa_camera and omap3isp
>  (somewhat dubious). Normally this information should come from the
>  device tree and there should be no need for this op.
>  
>  My (tentative) long-term plan was to get rid of this op.
>  
>  If you don't need it, then I recommend it is removed.
> >> 
> >> Hi Hans, the imx-media driver was only calling g_mbus_config to the
> >> camera sensor, and it was doing that to determine the sensor's bus
> >> type. This info was already available from parsing a
> >> v4l2_of_endpoint from the sensor node. So it was simple to remove the
> >> g_mbus_config calls, and instead rely on the parsed sensor
> >> v4l2_of_endpoint.
> > 
> > That's not a good point.
> >>> 
> >>> (mea culpa, s/point/idea/)
> >>> 
> > The imx-media driver must not parse the sensor DT node as it is not
> > aware of what bindings the sensor is compatible with.
> >> 
> >> Hi Laurent,
> >> 
> >> I don't really understand this argument. The sensor node has been found
> >> by parsing the OF graph, so it is known to be a camera sensor node at
> >> that point.
> > 
> > All you know in the i.MX6 driver is that the remote node is a video
> > source. You can rely on the fact that it implements the OF graph bindings
> > to locate other ports in that DT node, but that's more or less it.
> > 
> > DT properties are defined by DT bindings and thus qualified by a
> > compatible string. Unless you match on sensor compat strings in the i.MX6
> > driver (which you shouldn't do, to keep the driver generic) you can't know
> > for certain how to parse the sensor node DT properties. For all you know,
> > the video source could be a bridge such as an HDMI to CSI-2 converter for
> > instance, so you can't even rely on the fact that it's a sensor.
> > 
> > Information must instead be queried from the sensor subdev at
> > runtime, through the g_mbus_config() operation.
> > 
> > Of course, if you can get the information from the imx-media DT
> > node, that's certainly an option. It's only information provided by
> > the sensor driver that you have no choice but query using a subdev
> > operation.
>  
>  Shouldn't this come from the imx-media DT node? BTW, why is omap3isp
>  using this?
> >>> 
> >>> It all depends on what type of information needs to be retrieved, and
> >>> whether it can change at runtime or is fixed. Adding properties to the
> >>> imx-media DT node is certainly fine as long as those properties
> >>> describe the i.MX side.
> >> 
> >> In this case the info needed is the media bus type. That info is most
> >> easily available by calling v4l2_of_parse_endpoint() on the sensor's
> >> endpoint node.
> > 
> > I haven't had time to check the code in details yet, so I can't really
> > comment on what you need and how it should be implemented exactly.
> > 
> >> The media bus type is not something that can be added to the
> >> imx-media node since it contains no endpoint nodes.
> > 
> > Agreed. You have endpoints in the CSI nodes though.
> > 
> >>> In the omap3isp case, we use the operation to query whether parallel
> >>> data contains embedded sync (BT.656) or uses separate h/v sync signals.
> >>> 
>  The reason I am suspicious about this op is that it came from
>  soc-camera and predates the DT. The contents of v4l2_mbus_config seems
>  very much like a HW description to me, i.e. something that belongs in
>  the DT.
> >>> 
> >>> Part of it is possibly outdated, but for buses that support multiple
> >>> modes of operation (such as the parallel bus case described above) we
> >>> need to make that information discoverable at runtime. Maybe this should
> >>> be considered as related to Sakari's efforts to support VC/DT for CSI-2,
> >>> and supported through the API he is working on.
> >>
> >> That sounds interesting, can you point me to some info on this effort?
> > 
> > Sure.
> > 
> > http://git.retiisi.org.uk/?p=~sailus/linux.git;a=shortlog;h=refs/heads/vc
> > 
> >> I've been thinking the DT should contain virtual channel info for CSI-2
> >> buses.
> > 
> > I don't think it should. CSI-2 virtual channels and data 

Re: [patch] Staging: bcm2835-audio: fix an uninitialized return value

2017-02-07 Thread Arnd Bergmann
On Tue, Feb 7, 2017 at 2:17 PM, Dan Carpenter  wrote:
> "ret" isn't necessarily initialized on the success path.
>
> Signed-off-by: Dan Carpenter 
>

The patch seems correct, but do you have any idea why gcc-7 didn't
warn about this?
I assume that you found it with smatch, and nobody else did.

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


[patch] Staging: bcm2835-audio: fix an uninitialized return value

2017-02-07 Thread Dan Carpenter
"ret" isn't necessarily initialized on the success path.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
index 9ac1f72a178e..b7922be4909c 100644
--- a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
@@ -432,6 +432,7 @@ static int bcm2835_audio_open_connection(struct 
bcm2835_alsa_stream *alsa_stream
alsa_stream->instance = instance;
 
LOG_DBG(" success !\n");
+   ret = 0;
 err_free_mem:
LOG_DBG(" .. OUT\n");
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch] Staging: bcm2835-audio: remove unneeded NULL check

2017-02-07 Thread Dan Carpenter
We just dereferenced "instance" on the line before so checking it here
is pointless.  Anyway, it can't be NULL here so let's remove the check.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
index b7922be4909c..6578246b0f08 100644
--- a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
@@ -775,10 +775,9 @@ int bcm2835_audio_close(struct bcm2835_alsa_stream 
*alsa_stream)
mutex_unlock(>vchi_mutex);
 
/* Stop the audio service */
-   if (instance) {
-   vc_vchi_audio_deinit(instance);
-   alsa_stream->instance = NULL;
-   }
+   vc_vchi_audio_deinit(instance);
+   alsa_stream->instance = NULL;
+
LOG_DBG(" .. OUT\n");
return ret;
 }
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch] staging: bcm2835-audio: off by one in snd_bcm2835_playback_open_generic()

2017-02-07 Thread Dan Carpenter
The > should be >= otherwise we write beyond the end of the array when
we do:

chip->alsa_stream[idx] = alsa_stream;

Fixes: 23b028c871e1 ("staging: bcm2835-audio: initial staging submission")
Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/bcm2835-audio/bcm2835-pcm.c 
b/drivers/staging/bcm2835-audio/bcm2835-pcm.c
index d2d9f9b6a09b..014bf7ab69f4 100644
--- a/drivers/staging/bcm2835-audio/bcm2835-pcm.c
+++ b/drivers/staging/bcm2835-audio/bcm2835-pcm.c
@@ -130,7 +130,7 @@ static int snd_bcm2835_playback_open_generic(
err = -EBUSY;
goto out;
}
-   if (idx > MAX_SUBSTREAMS) {
+   if (idx >= MAX_SUBSTREAMS) {
audio_error
("substream(%d) device doesn't exist max(%d) substreams 
allowed\n",
idx, MAX_SUBSTREAMS);
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[bug report] staging: lustre: lmv: Error not handled for lmv_find_target

2017-02-07 Thread Dan Carpenter
Hello Ulka Vaze,

You didn't introduce this warning but you were fixing nearby code so you
might know the answer.

drivers/staging/lustre/lustre/lmv/lmv_obd.c:1069 lmv_iocontrol()
warn: check 'reqlen' for integer overflows 'obd_iocontrol()'

drivers/staging/lustre/lustre/lmv/lmv_obd.c
  1056  
  1057  /* build a request with fids for this 
MDS */
  1058  reqlen = offsetof(typeof(*hur),
  1059hur_user_item[nr])
  1060   + hur->hur_request.hr_data_len;

It looks like this addition can have an integer overflow bug.

  1061  req = libcfs_kvzalloc(reqlen, GFP_NOFS);

Leading to a req that is smaller than necessary.

  1062  if (!req)
  1063  return -ENOMEM;
  1064  
  1065  rc1 = lmv_hsm_req_build(lmv, hur, tgt, 
req);

Which could be a problem in here.

  1066  if (rc1 < 0)
  1067  goto hsm_req_err;
  1068  
  1069  rc1 = obd_iocontrol(cmd, tgt->ltd_exp, 
reqlen,
  1070  req, uarg);
  1071  hsm_req_err:
  1072  if (rc1 != 0 && rc == 0)
  1073  rc = rc1;
  1074  kvfree(req);

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


Re: [PATCH] staging: vc04_services: remove unused functions

2017-02-07 Thread Dan Carpenter
There is a bunch of vc04_services that we're still looking to merge in
the near future.  Please hold off deleting these until we are further
along on that.

regards,
dan carpenter

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


[PATCH v5 3/3] staging: wlan-ng: realign else if continuation

2017-02-07 Thread Maksymilian Piechota
Signed-off-by: Maksymilian Piechota 
---
 drivers/staging/wlan-ng/prism2mgmt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/prism2mgmt.c 
b/drivers/staging/wlan-ng/prism2mgmt.c
index af83f2a..5277f36 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -1308,7 +1308,7 @@ int prism2mgmt_wlansniff(struct wlandevice *wlandev, void 
*msgp)
hw->sniffhdr = 0;
wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
} else if ((msg->wlanheader.status == 
P80211ENUM_msgitem_status_data_ok) &&
-   (msg->wlanheader.data == P80211ENUM_truth_true)) {
+  (msg->wlanheader.data == P80211ENUM_truth_true)) {
hw->sniffhdr = 1;
wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
} else {
-- 
2.1.4

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


[PATCH v5 2/3] staging: wlan-ng: move else if statement to a single line

2017-02-07 Thread Maksymilian Piechota
Signed-off-by: Maksymilian Piechota 
---
 drivers/staging/wlan-ng/prism2mgmt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2mgmt.c 
b/drivers/staging/wlan-ng/prism2mgmt.c
index 64a9ebc..af83f2a 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -1307,8 +1307,7 @@ int prism2mgmt_wlansniff(struct wlandevice *wlandev, void 
*msgp)
&& (msg->prismheader.data == P80211ENUM_truth_true)) {
hw->sniffhdr = 0;
wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
-   } else
-   if ((msg->wlanheader.status == 
P80211ENUM_msgitem_status_data_ok) && 
+   } else if ((msg->wlanheader.status == 
P80211ENUM_msgitem_status_data_ok) &&
(msg->wlanheader.data == P80211ENUM_truth_true)) {
hw->sniffhdr = 1;
wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
-- 
2.1.4

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


[PATCH v5 1/3] staging: wlan-ng: move logical continuations at the end of line

2017-02-07 Thread Maksymilian Piechota
Signed-off-by: Maksymilian Piechota 
---
 drivers/staging/wlan-ng/prism2mgmt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2mgmt.c 
b/drivers/staging/wlan-ng/prism2mgmt.c
index 16fb2d3..64a9ebc 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -1308,9 +1308,8 @@ int prism2mgmt_wlansniff(struct wlandevice *wlandev, void 
*msgp)
hw->sniffhdr = 0;
wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
} else
-   if ((msg->wlanheader.status ==
-P80211ENUM_msgitem_status_data_ok)
-   && (msg->wlanheader.data == P80211ENUM_truth_true)) {
+   if ((msg->wlanheader.status == 
P80211ENUM_msgitem_status_data_ok) && 
+   (msg->wlanheader.data == P80211ENUM_truth_true)) {
hw->sniffhdr = 1;
wlandev->netdev->type = ARPHRD_IEEE80211_PRISM;
} else {
-- 
2.1.4

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


[PATCH v5 0/3] staging: wlan-ng: align else if statement to coding standard

2017-02-07 Thread Maksymilian Piechota
Patch version 5:
- break up particular changes to separate commits
- change prefix to proper driver (wlan-ng)

Maksymilian Piechota (3):
  staging: wlan-ng: move logical continuations at the end of line
  staging: wlan-ng: move else if statement to a single line
  staging: wlan-ng: realign else if continuation

 drivers/staging/wlan-ng/prism2mgmt.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

-- 
2.1.4

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


[PATCH] staging: vc04_services: remove unused functions

2017-02-07 Thread Alexander Alemayhu
Looking at the history these calls were introduced in 71bad7f08641
(staging: add bcm2708 vchiq driver, 2013-07-02) and they were not
being used at all.

Discovered using sparse and fixes the following output:

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c:816:1: warning: 
symbol 'vchi_readbuf_uint32' was not declared. Should it be static?
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c:827:1: warning: 
symbol 'vchi_writebuf_uint32' was not declared. Should it be static?
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c:841:1: warning: 
symbol 'vchi_readbuf_uint16' was not declared. Should it be static?
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c:852:1: warning: 
symbol 'vchi_writebuf_uint16' was not declared. Should it be static?

Signed-off-by: Alexander Alemayhu 
---
 .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 48 --
 1 file changed, 48 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 48984abc3854..cd0c332210ca 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -808,54 +808,6 @@ int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T 
handle, short *peer_ve
 }
 EXPORT_SYMBOL(vchi_get_peer_version);
 
-/* --
- * read a uint32_t from buffer.
- * network format is defined to be little endian
- *  */
-uint32_t
-vchi_readbuf_uint32(const void *_ptr)
-{
-   const unsigned char *ptr = _ptr;
-   return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
-}
-
-/* --
- * write a uint32_t to buffer.
- * network format is defined to be little endian
- *  */
-void
-vchi_writebuf_uint32(void *_ptr, uint32_t value)
-{
-   unsigned char *ptr = _ptr;
-   ptr[0] = (unsigned char)((value >> 0)  & 0xFF);
-   ptr[1] = (unsigned char)((value >> 8)  & 0xFF);
-   ptr[2] = (unsigned char)((value >> 16) & 0xFF);
-   ptr[3] = (unsigned char)((value >> 24) & 0xFF);
-}
-
-/* --
- * read a uint16_t from buffer.
- * network format is defined to be little endian
- *  */
-uint16_t
-vchi_readbuf_uint16(const void *_ptr)
-{
-   const unsigned char *ptr = _ptr;
-   return ptr[0] | (ptr[1] << 8);
-}
-
-/* --
- * write a uint16_t into the buffer.
- * network format is defined to be little endian
- *  */
-void
-vchi_writebuf_uint16(void *_ptr, uint16_t value)
-{
-   unsigned char *ptr = _ptr;
-   ptr[0] = (value >> 0)  & 0xFF;
-   ptr[1] = (value >> 8)  & 0xFF;
-}
-
 /***
  * Name: vchi_service_use
  *
-- 
2.11.1

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


[PATCH v2 8/8] staging: bcm2835-audio: Remove unnecessary space after cast

2017-02-07 Thread Simon Sandström
Fixes checkpatch check "No space is necessary after a cast".

Signed-off-by: Simon Sandström 
---
 drivers/staging/bcm2835-audio/bcm2835.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index 5bdc590dd9c9..3a5e528e0ec6 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -163,7 +163,7 @@ static int snd_bcm2835_alsa_remove(struct platform_device 
*pdev)
 
drv_data = platform_get_drvdata(pdev);
 
-   if (drv_data == (void *) g_card) {
+   if (drv_data == (void *)g_card) {
/* This is the card device */
snd_card_free((struct snd_card *)drv_data);
g_card = NULL;
-- 
2.11.0

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


[PATCH v2 7/8] staging: bcm2835-audio: Rewrite comparison to NULL

2017-02-07 Thread Simon Sandström
Fixes checkpatch check "Comparison to NULL could be written '!chip'".

Signed-off-by: Simon Sandström 
---
 drivers/staging/bcm2835-audio/bcm2835.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index de315a1da647..5bdc590dd9c9 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -61,7 +61,7 @@ static int snd_bcm2835_create(struct snd_card *card,
*rchip = NULL;
 
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
-   if (chip == NULL)
+   if (!chip)
return -ENOMEM;
 
chip->card = card;
-- 
2.11.0

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


[PATCH v2 6/8] staging: bcm2835-audio: Fix argument indentation

2017-02-07 Thread Simon Sandström
Fixes checkpatch CHECK: "Alignment should match open parenthesis".

Signed-off-by: Simon Sandström 
---
 drivers/staging/bcm2835-audio/bcm2835.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index f1ea1e082142..de315a1da647 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -49,8 +49,8 @@ static int snd_bcm2835_dev_free(struct snd_device *device)
  * (see "Management of Cards and Components")
  */
 static int snd_bcm2835_create(struct snd_card *card,
-   struct platform_device *pdev,
-   struct bcm2835_chip **rchip)
+ struct platform_device *pdev,
+ struct bcm2835_chip **rchip)
 {
struct bcm2835_chip *chip;
int err;
@@ -85,7 +85,7 @@ static int snd_bcm2835_alsa_probe_dt(struct platform_device 
*pdev)
int err, i;
 
err = of_property_read_u32(dev->of_node, "brcm,pwm-channels",
-   );
+  );
if (err) {
dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'");
return err;
@@ -94,7 +94,7 @@ static int snd_bcm2835_alsa_probe_dt(struct platform_device 
*pdev)
if (numchans == 0 || numchans > MAX_SUBSTREAMS) {
numchans = MAX_SUBSTREAMS;
dev_warn(dev, "Illegal 'brcm,pwm-channels' value, will use 
%u\n",
-   numchans);
+numchans);
}
 
err = snd_card_new(>dev, -1, NULL, THIS_MODULE, 0, );
@@ -194,7 +194,7 @@ static int snd_bcm2835_alsa_remove(struct platform_device 
*pdev)
 #ifdef CONFIG_PM
 
 static int snd_bcm2835_alsa_suspend(struct platform_device *pdev,
-   pm_message_t state)
+   pm_message_t state)
 {
return 0;
 }
-- 
2.11.0

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


[PATCH v2 4/8] staging: bcm2835-audio: Move open brace to correct line

2017-02-07 Thread Simon Sandström
Fixes checkpatch error "open brace { should be on the previous line".

Signed-off-by: Simon Sandström 
---
 drivers/staging/bcm2835-audio/bcm2835.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index 124fb938d1c1..e94dda297d8e 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -219,8 +219,7 @@ static struct platform_driver bcm2835_alsa0_driver = {
.suspend = snd_bcm2835_alsa_suspend,
.resume = snd_bcm2835_alsa_resume,
 #endif
-   .driver =
-   {
+   .driver = {
.name = "bcm2835_AUD0",
.owner = THIS_MODULE,
.of_match_table = snd_bcm2835_of_match_table,
-- 
2.11.0

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


[PATCH v2 5/8] staging: bcm2835-audio: Simplify bcm2835_alsa_device_init()

2017-02-07 Thread Simon Sandström
Fixes checkpatch warning "Missing a blank line after declarations".

Signed-off-by: Simon Sandström 
---
 drivers/staging/bcm2835-audio/bcm2835.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index e94dda297d8e..f1ea1e082142 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -228,14 +228,13 @@ static struct platform_driver bcm2835_alsa0_driver = {
 
 static int bcm2835_alsa_device_init(void)
 {
-   int err;
-   err = platform_driver_register(_alsa0_driver);
-   if (err) {
-   pr_err("Error registering bcm2835_alsa0_driver %d .\n", err);
-   return err;
-   }
+   int retval;
 
-   return 0;
+   retval = platform_driver_register(_alsa0_driver);
+   if (retval)
+   pr_err("Error registering bcm2835_alsa0_driver %d .\n", retval);
+
+   return retval;
 }
 
 static void bcm2835_alsa_device_exit(void)
-- 
2.11.0

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


[PATCH v2 3/8] staging: bcm2835-audio: Remove whitespace before quoted newline

2017-02-07 Thread Simon Sandström
Fixes checkpatch warning "unnecessary whitespace before a quoted
newline".

Signed-off-by: Simon Sandström 
---
 drivers/staging/bcm2835-audio/bcm2835.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index 9ad5a8a848a9..124fb938d1c1 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -139,7 +139,7 @@ static int snd_bcm2835_alsa_probe_dt(struct platform_device 
*pdev)
 
err = snd_card_register(card);
if (err) {
-   dev_err(dev, "Failed to register bcm2835 ALSA card \n");
+   dev_err(dev, "Failed to register bcm2835 ALSA card\n");
goto err_free;
}
 
-- 
2.11.0

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


[PATCH v2 2/8] staging: bcm2835-audio: Remove incorrect whitespace

2017-02-07 Thread Simon Sandström
According to the coding style, "bcm2835_ship ** rchip" should be
"bcm2835 **rchip".

Signed-off-by: Simon Sandström 
---
 drivers/staging/bcm2835-audio/bcm2835.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index 265fe5565f42..9ad5a8a848a9 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -50,7 +50,7 @@ static int snd_bcm2835_dev_free(struct snd_device *device)
  */
 static int snd_bcm2835_create(struct snd_card *card,
struct platform_device *pdev,
-   struct bcm2835_chip ** rchip)
+   struct bcm2835_chip **rchip)
 {
struct bcm2835_chip *chip;
int err;
-- 
2.11.0

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


[PATCH v2 0/8] staging: bcm2835-audio: Fix various checkpatch warnings

2017-02-07 Thread Simon Sandström
Fixes multiple checkpatch errors and warnings in bcm2835.c.

Changes in v2:
  * Separated v1 patch into multiple smaller patches.

Simon Sandström (8):
  staging: bcm2835-audio: Remove static initialisation
  staging: bcm2835-audio: Remove incorrect whitespace
  staging: bcm2835-audio: Remove whitespace before quoted newline
  staging: bcm2835-audio: Move open brace to correct line
  staging: bcm2835-audio: Simplify bcm2835_alsa_device_init()
  staging: bcm2835-audio: Fix argument indentation
  staging: bcm2835-audio: Rewrite comparison to NULL
  staging: bcm2835-audio: Remove unnecessary space after cast

 drivers/staging/bcm2835-audio/bcm2835.c | 36 -
 1 file changed, 17 insertions(+), 19 deletions(-)

-- 
2.11.0

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


[PATCH v2 1/8] staging: bcm2835-audio: Remove static initialisation

2017-02-07 Thread Simon Sandström
Static pointers are explicility initialised to NULL.

Signed-off-by: Simon Sandström 
---
 drivers/staging/bcm2835-audio/bcm2835.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/bcm2835-audio/bcm2835.c 
b/drivers/staging/bcm2835-audio/bcm2835.c
index a84d74daccbc..265fe5565f42 100644
--- a/drivers/staging/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/bcm2835-audio/bcm2835.c
@@ -28,8 +28,8 @@
  * to debug if we run into issues
  */
 
-static struct snd_card *g_card = NULL;
-static struct bcm2835_chip *g_chip = NULL;
+static struct snd_card *g_card;
+static struct bcm2835_chip *g_chip;
 
 static int snd_bcm2835_free(struct bcm2835_chip *chip)
 {
-- 
2.11.0

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


Re: [PATCH v3 13/24] platform: add video-multiplexer subdevice driver

2017-02-07 Thread Philipp Zabel
On Tue, 2017-02-07 at 12:26 +0200, Laurent Pinchart wrote:
> Hi Steve,
> 
> On Monday 06 Feb 2017 15:10:46 Steve Longerbeam wrote:
> > On 02/06/2017 02:33 PM, Laurent Pinchart wrote:
> > > On Monday 06 Feb 2017 10:50:22 Hans Verkuil wrote:
> > >> On 02/05/2017 04:48 PM, Laurent Pinchart wrote:
> > >>> On Tuesday 24 Jan 2017 18:07:55 Steve Longerbeam wrote:
> >  On 01/24/2017 04:02 AM, Philipp Zabel wrote:
> > > On Fri, 2017-01-20 at 15:03 +0100, Hans Verkuil wrote:
> > >>> +
> > >>> +int vidsw_g_mbus_config(struct v4l2_subdev *sd, struct
> > >>> v4l2_mbus_config *cfg)
> 
> [snip]
> 
> > >> I am not certain this op is needed at all. In the current kernel this
> > >> op is only used by soc_camera, pxa_camera and omap3isp (somewhat
> > >> dubious). Normally this information should come from the device tree
> > >> and there should be no need for this op.
> > >> 
> > >> My (tentative) long-term plan was to get rid of this op.
> > >> 
> > >> If you don't need it, then I recommend it is removed.
> >  
> >  Hi Hans, the imx-media driver was only calling g_mbus_config to the
> >  camera sensor, and it was doing that to determine the sensor's bus
> >  type. This info was already available from parsing a v4l2_of_endpoint
> >  from the sensor node. So it was simple to remove the g_mbus_config
> >  calls, and instead rely on the parsed sensor v4l2_of_endpoint.
> > >>> 
> > >>> That's not a good point.
> > > 
> > > (mea culpa, s/point/idea/)
> > > 
> > >>> The imx-media driver must not parse the sensor DT node as it is not
> > >>> aware of what bindings the sensor is compatible with.
> > 
> > Hi Laurent,
> > 
> > I don't really understand this argument. The sensor node has been found
> > by parsing the OF graph, so it is known to be a camera sensor node at
> > that point.
> 
> All you know in the i.MX6 driver is that the remote node is a video source. 
> You can rely on the fact that it implements the OF graph bindings to locate 
> other ports in that DT node, but that's more or less it.
> 
> DT properties are defined by DT bindings and thus qualified by a compatible 
> string. Unless you match on sensor compat strings in the i.MX6 driver (which 
> you shouldn't do, to keep the driver generic) you can't know for certain how 
> to parse the sensor node DT properties. For all you know, the video source 
> could be a bridge such as an HDMI to CSI-2 converter for instance, so you 
> can't even rely on the fact that it's a sensor.
> 
> > >>> Information must instead be queried from the sensor subdev at runtime,
> > >>> through the g_mbus_config() operation.
> > >>> 
> > >>> Of course, if you can get the information from the imx-media DT node,
> > >>> that's certainly an option. It's only information provided by the sensor
> > >>> driver that you have no choice but query using a subdev operation.
> > >> 
> > >> Shouldn't this come from the imx-media DT node? BTW, why is omap3isp
> > >> using this?
> > > 
> > > It all depends on what type of information needs to be retrieved, and
> > > whether it can change at runtime or is fixed. Adding properties to the
> > > imx-media DT node is certainly fine as long as those properties describe
> > > the i.MX side.
> >
> > In this case the info needed is the media bus type. That info is most easily
> > available by calling v4l2_of_parse_endpoint() on the sensor's endpoint
> > node.
> 
> I haven't had time to check the code in details yet, so I can't really 
> comment 
> on what you need and how it should be implemented exactly.
> 
> > The media bus type is not something that can be added to the
> > imx-media node since it contains no endpoint nodes.
> 
> Agreed. You have endpoints in the CSI nodes though.
> 
> > > In the omap3isp case, we use the operation to query whether parallel data
> > > contains embedded sync (BT.656) or uses separate h/v sync signals.
> > > 
> > >> The reason I am suspicious about this op is that it came from soc-camera
> > >> and predates the DT. The contents of v4l2_mbus_config seems very much
> > >> like a HW description to me, i.e. something that belongs in the DT.
> > > 
> > > Part of it is possibly outdated, but for buses that support multiple modes
> > > of operation (such as the parallel bus case described above) we need to
> > > make that information discoverable at runtime. Maybe this should be
> > > considered as related to Sakari's efforts to support VC/DT for CSI-2, and
> > > supported through the API he is working on.
> > 
> > That sounds interesting, can you point me to some info on this effort?
> 
> Sure.
> 
> http://git.retiisi.org.uk/?p=~sailus/linux.git;a=shortlog;h=refs/heads/vc
> 
> > I've been thinking the DT should contain virtual channel info for CSI-2
> > buses.
> 
> I don't think it should. CSI-2 virtual channels and data types should be 
> handled as a software concept, and thus supported through driver code without 
> involving DT.

I agree. The CSI2IPU gasket 

Re: [PATCH v3 13/24] platform: add video-multiplexer subdevice driver

2017-02-07 Thread Laurent Pinchart
Hi Steve,

On Monday 06 Feb 2017 15:10:46 Steve Longerbeam wrote:
> On 02/06/2017 02:33 PM, Laurent Pinchart wrote:
> > On Monday 06 Feb 2017 10:50:22 Hans Verkuil wrote:
> >> On 02/05/2017 04:48 PM, Laurent Pinchart wrote:
> >>> On Tuesday 24 Jan 2017 18:07:55 Steve Longerbeam wrote:
>  On 01/24/2017 04:02 AM, Philipp Zabel wrote:
> > On Fri, 2017-01-20 at 15:03 +0100, Hans Verkuil wrote:
> >>> +
> >>> +int vidsw_g_mbus_config(struct v4l2_subdev *sd, struct
> >>> v4l2_mbus_config *cfg)

[snip]

> >> I am not certain this op is needed at all. In the current kernel this
> >> op is only used by soc_camera, pxa_camera and omap3isp (somewhat
> >> dubious). Normally this information should come from the device tree
> >> and there should be no need for this op.
> >> 
> >> My (tentative) long-term plan was to get rid of this op.
> >> 
> >> If you don't need it, then I recommend it is removed.
>  
>  Hi Hans, the imx-media driver was only calling g_mbus_config to the
>  camera sensor, and it was doing that to determine the sensor's bus
>  type. This info was already available from parsing a v4l2_of_endpoint
>  from the sensor node. So it was simple to remove the g_mbus_config
>  calls, and instead rely on the parsed sensor v4l2_of_endpoint.
> >>> 
> >>> That's not a good point.
> > 
> > (mea culpa, s/point/idea/)
> > 
> >>> The imx-media driver must not parse the sensor DT node as it is not
> >>> aware of what bindings the sensor is compatible with.
> 
> Hi Laurent,
> 
> I don't really understand this argument. The sensor node has been found
> by parsing the OF graph, so it is known to be a camera sensor node at
> that point.

All you know in the i.MX6 driver is that the remote node is a video source. 
You can rely on the fact that it implements the OF graph bindings to locate 
other ports in that DT node, but that's more or less it.

DT properties are defined by DT bindings and thus qualified by a compatible 
string. Unless you match on sensor compat strings in the i.MX6 driver (which 
you shouldn't do, to keep the driver generic) you can't know for certain how 
to parse the sensor node DT properties. For all you know, the video source 
could be a bridge such as an HDMI to CSI-2 converter for instance, so you 
can't even rely on the fact that it's a sensor.

> >>> Information must instead be queried from the sensor subdev at runtime,
> >>> through the g_mbus_config() operation.
> >>> 
> >>> Of course, if you can get the information from the imx-media DT node,
> >>> that's certainly an option. It's only information provided by the sensor
> >>> driver that you have no choice but query using a subdev operation.
> >> 
> >> Shouldn't this come from the imx-media DT node? BTW, why is omap3isp
> >> using this?
> > 
> > It all depends on what type of information needs to be retrieved, and
> > whether it can change at runtime or is fixed. Adding properties to the
> > imx-media DT node is certainly fine as long as those properties describe
> > the i.MX side.
>
> In this case the info needed is the media bus type. That info is most easily
> available by calling v4l2_of_parse_endpoint() on the sensor's endpoint
> node.

I haven't had time to check the code in details yet, so I can't really comment 
on what you need and how it should be implemented exactly.

> The media bus type is not something that can be added to the
> imx-media node since it contains no endpoint nodes.

Agreed. You have endpoints in the CSI nodes though.

> > In the omap3isp case, we use the operation to query whether parallel data
> > contains embedded sync (BT.656) or uses separate h/v sync signals.
> > 
> >> The reason I am suspicious about this op is that it came from soc-camera
> >> and predates the DT. The contents of v4l2_mbus_config seems very much
> >> like a HW description to me, i.e. something that belongs in the DT.
> > 
> > Part of it is possibly outdated, but for buses that support multiple modes
> > of operation (such as the parallel bus case described above) we need to
> > make that information discoverable at runtime. Maybe this should be
> > considered as related to Sakari's efforts to support VC/DT for CSI-2, and
> > supported through the API he is working on.
> 
> That sounds interesting, can you point me to some info on this effort?

Sure.

http://git.retiisi.org.uk/?p=~sailus/linux.git;a=shortlog;h=refs/heads/vc

> I've been thinking the DT should contain virtual channel info for CSI-2
> buses.

I don't think it should. CSI-2 virtual channels and data types should be 
handled as a software concept, and thus supported through driver code without 
involving DT.

-- 
Regards,

Laurent Pinchart

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


[PATCH] PCI: hv: fix wslot_to_devfn()

2017-02-07 Thread Dexuan Cui
The devfn of 00:02.0 is 0x10.
devfn_to_wslot(0x10) == 0x2, and wslot_to_devfn(0x2) should be 0x10,
while it's 0x2 in the current code.

Due to this, hv_eject_device_work() -> pci_get_domain_bus_and_slot()
returns NULL and pci_stop_and_remove_bus_device() is not called.

Later when the real device driver's .remove() is invoked by
hv_pci_remove() -> pci_stop_root_bus(), some warnings can be noticed
because the VM has lost the access to the underlying device at that
time.

Signed-off-by: Jake Oshins 
Signed-off-by: Dexuan Cui 
Cc: sta...@vger.kernel.org
Cc: K. Y. Srinivasan 
CC: Haiyang Zhang 
Cc: Stephen Hemminger 
---
 drivers/pci/host/pci-hyperv.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

The patch is co-made by Jake and me.

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 3efcc7b..cd114c6 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -130,7 +130,8 @@ enum pci_message_type {
  */
 union win_slot_encoding {
struct {
-   u32 func:8;
+   u32 dev:5;
+   u32 func:3;
u32 reserved:24;
} bits;
u32 slot;
@@ -485,7 +486,8 @@ static u32 devfn_to_wslot(int devfn)
union win_slot_encoding wslot;
 
wslot.slot = 0;
-   wslot.bits.func = PCI_SLOT(devfn) | (PCI_FUNC(devfn) << 5);
+   wslot.bits.dev = PCI_SLOT(devfn);
+   wslot.bits.func = PCI_FUNC(devfn);
 
return wslot.slot;
 }
@@ -503,7 +505,7 @@ static int wslot_to_devfn(u32 wslot)
union win_slot_encoding slot_no;
 
slot_no.slot = wslot;
-   return PCI_DEVFN(0, slot_no.bits.func);
+   return PCI_DEVFN(slot_no.bits.dev, slot_no.bits.func);
 }
 
 /*
-- 
1.8.3.1

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


Re: [PATCH] staging: greybus: Move Documentation to Documentation/

2017-02-07 Thread Viresh Kumar
On 07-02-17, 09:02, Greg Kroah-Hartman wrote:
> On Tue, Feb 07, 2017 at 11:15:29AM +0530, Viresh Kumar wrote:
> > Move all greybus documentation to the top level Documentation/
> > directory, as that's the obvious place where everyone will look for it.
> 
> No, not until we have the core greybus code out of staging.  While code
> is in staging, it is self-contained, and shouldn't spread outside of
> it's own directory.

I see. No issues. I just had to refer to the documentation today and
was wondering why shouldn't it be moved to Documentation/ :)

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


Re: [PATCH v2] Staging: omap4iss: Fix coding style issues

2017-02-07 Thread Greg KH
On Mon, Feb 06, 2017 at 07:58:35PM +0200, Avraham Shukron wrote:
> Fixes line-over-80-characters issues as well as multiline comments style.

When you say things like "as well as", that's a hint that this needs to
be broken up into different patches.  Please do so here.

thanks,

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


Re: [PATCH] staging: bcm2835-audio: Fix various checkpatch warnings

2017-02-07 Thread Greg Kroah-Hartman
On Mon, Feb 06, 2017 at 08:21:51PM +0100, Simon Sandström wrote:
> Fix following warnings in bcm2835.c:
> * Do not initialise statics to NULL.
> * Unnecessary whitespace before a quoted newline.
> * Open brace { on wrong line.
> 
> Fix 'Missing blank line after declarations' by simplifying
> bcm2835_alsa_device_init().

Please only fix one thing at a time, break this up into individual
patches please, and send a patch series.

thanks,

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


Re: [PATCH] staging: greybus: Move Documentation to Documentation/

2017-02-07 Thread Greg Kroah-Hartman
On Tue, Feb 07, 2017 at 11:15:29AM +0530, Viresh Kumar wrote:
> Move all greybus documentation to the top level Documentation/
> directory, as that's the obvious place where everyone will look for it.

No, not until we have the core greybus code out of staging.  While code
is in staging, it is self-contained, and shouldn't spread outside of
it's own directory.

Also, when it moves to Documentation, it needs to tie into the newer
kernel documentation build system so that it gets built properly.

> 
> Signed-off-by: Viresh Kumar 
> ---
>  .../Documentation => Documentation/greybus}/firmware/authenticate.c   | 0
>  .../Documentation => Documentation/greybus}/firmware/firmware-management  | 0
>  .../greybus/Documentation => Documentation/greybus}/firmware/firmware.c   | 0
>  .../greybus/Documentation => Documentation/greybus}/sysfs-bus-greybus | 0
>  4 files changed, 0 insertions(+), 0 deletions(-)
>  rename {drivers/staging/greybus/Documentation => 
> Documentation/greybus}/firmware/authenticate.c (100%)
>  rename {drivers/staging/greybus/Documentation => 
> Documentation/greybus}/firmware/firmware-management (100%)
>  rename {drivers/staging/greybus/Documentation => 
> Documentation/greybus}/firmware/firmware.c (100%)
>  rename {drivers/staging/greybus/Documentation => 
> Documentation/greybus}/sysfs-bus-greybus (100%)
> 
> diff --git a/drivers/staging/greybus/Documentation/firmware/authenticate.c 
> b/Documentation/greybus/firmware/authenticate.c
> similarity index 100%
> rename from drivers/staging/greybus/Documentation/firmware/authenticate.c
> rename to Documentation/greybus/firmware/authenticate.c

Shouldn't the .c files go into a tools directory?

> diff --git 
> a/drivers/staging/greybus/Documentation/firmware/firmware-management 
> b/Documentation/greybus/firmware/firmware-management
> similarity index 100%
> rename from drivers/staging/greybus/Documentation/firmware/firmware-management
> rename to Documentation/greybus/firmware/firmware-management
> diff --git a/drivers/staging/greybus/Documentation/firmware/firmware.c 
> b/Documentation/greybus/firmware/firmware.c
> similarity index 100%
> rename from drivers/staging/greybus/Documentation/firmware/firmware.c
> rename to Documentation/greybus/firmware/firmware.c
> diff --git a/drivers/staging/greybus/Documentation/sysfs-bus-greybus 
> b/Documentation/greybus/sysfs-bus-greybus
> similarity index 100%
> rename from drivers/staging/greybus/Documentation/sysfs-bus-greybus
> rename to Documentation/greybus/sysfs-bus-greybus

Also, this file needs to go to Documentation/ABI/testing/ right?

sorry, not going to take this.

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