[PATCH] rts5208: add a missing check for the status of command sending

2018-12-19 Thread Kangjie Lu
ms_send_cmd() may fail. The fix checks the return value of it, and if it
fails, returns the error "STATUS_FAIL" upstream.

Signed-off-by: Kangjie Lu 
---
 drivers/staging/rts5208/ms.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index f53adf15c685..5a9e562465e9 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -2731,7 +2731,9 @@ static int mspro_rw_multi_sector(struct scsi_cmnd *srb,
}
 
if (val & MS_INT_BREQ)
-   ms_send_cmd(chip, PRO_STOP, WAIT_INT);
+   retval = ms_send_cmd(chip, PRO_STOP, WAIT_INT);
+   if (retval != STATUS_SUCCESS)
+   return STATUS_FAIL;
 
if (val & (MS_CRC16_ERR | MS_RDY_TIMEOUT)) {
dev_dbg(rtsx_dev(chip), "MSPro CRC error, tune 
clock!\n");
-- 
2.17.2 (Apple Git-113)

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


Re: [PATCH] staging: wilc1000: fix missing read_write setting when reading data

2018-12-19 Thread Ajay.Kathat



On 12/19/2018 10:00 PM, Colin King wrote:
> From: Colin Ian King 
> 
> Currently the cmd.read_write setting is not initialized so it contains
> garbage from the stack.  Fix this by setting it to 0 to indicate a
> read is required.
> 
> Detected by CoverityScan, CID#1357925 ("Uninitialized scalar variable")
> 
> Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")

Acked-by: Ajay Singh 
> Signed-off-by: Colin Ian King 
> ---
>  drivers/staging/wilc1000/wilc_sdio.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
> b/drivers/staging/wilc1000/wilc_sdio.c
> index 27fdfbdda5c0..e2f739fef21c 100644
> --- a/drivers/staging/wilc1000/wilc_sdio.c
> +++ b/drivers/staging/wilc1000/wilc_sdio.c
> @@ -861,6 +861,7 @@ static int sdio_read_int(struct wilc *wilc, u32 
> *int_status)
>   if (!sdio_priv->irq_gpio) {
>   int i;
>  
> + cmd.read_write = 0;
>   cmd.function = 1;
>   cmd.address = 0x04;
>   cmd.data = 0;
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] scsi: storvsc: Always use blk-mq

2018-12-19 Thread Martin K. Petersen


Michael,

> With high IOPS storage being increasingly prevalent for guests
> on Hyper-V and in Azure, make blk-mq the default so that the
> full performance of the storage can be realized without having
> to tweak other configuration settings.

The legacy I/O path will be gone in 4.21 so this patch isn't needed.

-- 
Martin K. Petersen  Oracle Linux Engineering
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] staging: android: ion: add buffer flag update ioctl

2018-12-19 Thread Zengtao (B)
Hi laura:

>-Original Message-
>From: Laura Abbott [mailto:labb...@redhat.com]
>Sent: Thursday, December 20, 2018 2:10 AM
>To: Zengtao (B) ; sumit.sem...@linaro.org
>Cc: Greg Kroah-Hartman ; Arve Hjønnevåg
>; Todd Kjos ; Martijn Coenen
>; Joel Fernandes ;
>de...@driverdev.osuosl.org; dri-de...@lists.freedesktop.org;
>linaro-mm-...@lists.linaro.org; linux-ker...@vger.kernel.org
>Subject: Re: [PATCH] staging: android: ion: add buffer flag update ioctl
>
>On 12/19/18 9:19 AM, Zeng Tao wrote:
>> In some usecases, the buffer cached attribute is not determined at
>> allocation time, it's determined just before the real cpu mapping.
>> And from the memory view of point, a buffer should not have the
>cached
>> attribute util is really mapped by the cpu. So in this patch, we
>> introduced the new ioctl command to target the requirement.
>>
>
>This is racy and error prone. Can you explain more what problem you are
>trying to solve?

My use case is like this:
1.  There are two process A and B, A takes case of ion buffer allocation, and
 pass the buffer fd to B, then B maps and uses it.
2.  Process B need to map the buffer with different cached attribute for 
different use case, for example, if the buffer is used for pure software 
algorithm, 
then we need to map it as cached, otherwise non-cached, and B needs to deal
with both cases.
And unfortunately the mmap syscall takes no cached flags and we can't decide 
the cache attribute when we are doing the mmap, so I introduce new the ioctl 
even though I think the solution is not as good. 


>
>> Signed-off-by: Zeng Tao 
>> ---
>>   drivers/staging/android/ion/ion-ioctl.c |  4 
>>   drivers/staging/android/ion/ion.c   | 17 +
>>   drivers/staging/android/ion/ion.h   |  1 +
>>   drivers/staging/android/uapi/ion.h  | 22
>++
>>   4 files changed, 44 insertions(+)
>>
>> diff --git a/drivers/staging/android/ion/ion-ioctl.c
>> b/drivers/staging/android/ion/ion-ioctl.c
>> index a8d3cc4..60bb702 100644
>> --- a/drivers/staging/android/ion/ion-ioctl.c
>> +++ b/drivers/staging/android/ion/ion-ioctl.c
>> @@ -12,6 +12,7 @@
>>
>>   union ion_ioctl_arg {
>>  struct ion_allocation_data allocation;
>> +struct ion_buffer_flag_data update;
>>  struct ion_heap_query query;
>>   };
>>
>> @@ -83,6 +84,9 @@ long ion_ioctl(struct file *filp, unsigned int cmd,
>> unsigned long arg)
>>
>>  break;
>>  }
>> +case ION_IOC_BUFFER_UPDATE:
>> +ret = ion_buffer_update(data.update.fd, data.update.flags);
>> +break;
>>  case ION_IOC_HEAP_QUERY:
>>  ret = ion_query_heaps();
>>  break;
>> diff --git a/drivers/staging/android/ion/ion.c
>> b/drivers/staging/android/ion/ion.c
>> index 9907332..f1404dc 100644
>> --- a/drivers/staging/android/ion/ion.c
>> +++ b/drivers/staging/android/ion/ion.c
>> @@ -436,6 +436,23 @@ int ion_alloc(size_t len, unsigned int
>heap_id_mask, unsigned int flags)
>>  return fd;
>>   }
>>
>> +int ion_buffer_update(unsigned int fd, unsigned int flags) {
>> +struct dma_buf *dmabuf;
>> +struct ion_buffer *buffer;
>> +
>> +dmabuf = dma_buf_get(fd);
>> +
>> +if (!dmabuf)
>> +return -EINVAL;
>> +
>> +buffer = dmabuf->priv;
>> +buffer->flags = flags;
>> +dma_buf_put(dmabuf);
>> +
>> +return 0;
>> +}
>> +
>>   int ion_query_heaps(struct ion_heap_query *query)
>>   {
>>  struct ion_device *dev = internal_dev; diff --git
>> a/drivers/staging/android/ion/ion.h
>> b/drivers/staging/android/ion/ion.h
>> index c006fc1..99bf9ab 100644
>> --- a/drivers/staging/android/ion/ion.h
>> +++ b/drivers/staging/android/ion/ion.h
>> @@ -199,6 +199,7 @@ int ion_heap_pages_zero(struct page *page,
>size_t size, pgprot_t pgprot);
>>   int ion_alloc(size_t len,
>>unsigned int heap_id_mask,
>>unsigned int flags);
>> +int ion_buffer_update(unsigned int fd, unsigned int flags);
>>
>>   /**
>>* ion_heap_init_shrinker
>> diff --git a/drivers/staging/android/uapi/ion.h
>> b/drivers/staging/android/uapi/ion.h
>> index 5d70098..99753fc 100644
>> --- a/drivers/staging/android/uapi/ion.h
>> +++ b/drivers/staging/android/uapi/ion.h
>> @@ -74,6 +74,20 @@ struct ion_allocation_data {
>>  __u32 unused;
>>   };
>>
>> +/**
>> + * struct ion_buffer_flag_data - metadata passed from userspace for
>> +update
>> + * buffer flags
>> + * @fd: file descriptor of the buffer
>> + * @flags:  flags passed to the buffer
>> + *
>> + * Provided by userspace as an argument to the ioctl  */
>> +
>> +struct ion_buffer_flag_data {
>> +__u32 fd;
>> +__u32 flags;
>> +}
>> +
>>   #define MAX_HEAP_NAME  32
>>
>>   /**
>> @@ -116,6 +130,14 @@ struct ion_heap_query {
>>struct ion_allocation_data)
>>
>>   /**
>> + * DOC: ION_IOC_BUFFER_UPDATE - update the specified ion buffer
>flags
>> + *
>> + * Takes an ion_buffer_flag_data structure and 

Re: [PATCH v3 2/2] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-19 Thread Sergio Paracuellos
On Wed, Dec 19, 2018 at 7:26 PM Florian Fainelli  wrote:
>
> On 12/18/18 10:23 PM, Sergio Paracuellos wrote:
> > Hi Rob,
> >
> > On Tue, Dec 18, 2018 at 4:10 PM Rob Herring  wrote:
> >>
> >> On Mon, Dec 17, 2018 at 09:44:23PM +0100, Sergio Paracuellos wrote:
> >>> Add device-tree binding example of the ksz9477 switch managed in i2c mode.
> >>>
> >>> Cc: devicet...@vger.kernel.org
> >>> Signed-off-by: Sergio Paracuellos 
> >>> ---
> >>> Changes v3:
> >>> - No changes. Just resent patches together.
> >>>
> >>> Changes v2:
> >>> - Use generic name for label of the switch and make sure reg and @X
> >>>   have the same value.
> >>>
> >>>  .../devicetree/bindings/net/dsa/ksz.txt   | 50 +++
> >>>  1 file changed, 50 insertions(+)
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/net/dsa/ksz.txt 
> >>> b/Documentation/devicetree/bindings/net/dsa/ksz.txt
> >>> index 0f407fb371ce..d3c4b9d4f416 100644
> >>> --- a/Documentation/devicetree/bindings/net/dsa/ksz.txt
> >>> +++ b/Documentation/devicetree/bindings/net/dsa/ksz.txt
> >>> @@ -74,3 +74,53 @@ Ethernet switch connected via SPI to the host, CPU 
> >>> port wired to eth0:
> >>>   };
> >>>   };
> >>>   };
> >>> +
> >>> +Ethernet switch connected via I2C to the host, CPU port wired to eth0:
> >>> +
> >>> + eth0: ethernet@10001000 {
> >>
> >> Why do we have all this indentation? Please remove. And use tab chars,
> >> not spaces.
> >
> > The original file format is using all of this indentation. So I think
> > we would need a patch to change de format of the original file and
> > another with this new changes properly formatted.
>
> The original formatting should be fixed, but your changes should adopt
> the correct style from the first time they are submitted. Do you mind
> resubmitting with only one tab? We can fix the original examples as a
> follow-up patch.

I see. Thanks for let me know. I'll be more careful from now.

v4 actually sent with changes proposed here.

>
> Thanks!
> --
> Florian

Best regards,
Sergio Paracuellos
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-19 Thread Sergio Paracuellos
Add device-tree binding example of the ksz9477 switch managed in i2c mode.

Cc: devicet...@vger.kernel.org
Signed-off-by: Sergio Paracuellos 
---
Changes v4:
- Use one tab formatting properly the binding sample.

Changes v3:
- No changes. Just resent patches together.

Changes v2:
- Use generic name for label of the switch and make sure reg and @X
  have the same value.
 .../devicetree/bindings/net/dsa/ksz.txt   | 51 +++
 1 file changed, 51 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/dsa/ksz.txt 
b/Documentation/devicetree/bindings/net/dsa/ksz.txt
index 0f407fb371ce..2f276aa42f0b 100644
--- a/Documentation/devicetree/bindings/net/dsa/ksz.txt
+++ b/Documentation/devicetree/bindings/net/dsa/ksz.txt
@@ -74,3 +74,54 @@ Ethernet switch connected via SPI to the host, CPU port 
wired to eth0:
  };
  };
  };
+
+Ethernet switch connected via I2C to the host, CPU port wired to eth0:
+
+   eth0: ethernet@10001000 {
+   fixed-link {
+   speed = <1000>;
+   full-duplex;
+   };
+   };
+
+   i2c0: i2c@f8008000 {
+   switch: ksz9897@5f {
+   compatible = "microchip,ksz9897";
+   reg = <5f>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   label = "lan1";
+   };
+   port@1 {
+   reg = <1>;
+   label = "lan2";
+   };
+   port@2 {
+   reg = <2>;
+   label = "lan3";
+   };
+   port@3 {
+   reg = <3>;
+   label = "lan4";
+   };
+   port@4 {
+   reg = <4>;
+   label = "lan5";
+   };
+   port@6 {
+   reg = <6>;
+   label = "cpu";
+   ethernet = <>;
+   fixed-link {
+   speed = <1000>;
+   full-duplex;
+   };
+   };
+   };
+   };
+   };
-- 
2.19.1

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


[PATCH 1/1] scsi: storvsc: Always use blk-mq

2018-12-19 Thread Michael Kelley
With high IOPS storage being increasingly prevalent for guests
on Hyper-V and in Azure, make blk-mq the default so that the
full performance of the storage can be realized without having
to tweak other configuration settings.

Signed-off-by: Michael Kelley 
---
 drivers/scsi/storvsc_drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index f03dc03..3dbbd14 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1703,6 +1703,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, 
struct scsi_cmnd *scmnd)
.dma_boundary = PAGE_SIZE-1,
.no_write_same =1,
.track_queue_depth =1,
+   .force_blk_mq = 1,
 };
 
 enum {
-- 
1.8.3.1

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


Re: [PATCH v3 2/2] dt-bindings: net: dsa: ksz9477: add sample of switch bindings managed in i2c mode

2018-12-19 Thread Florian Fainelli
On 12/18/18 10:23 PM, Sergio Paracuellos wrote:
> Hi Rob,
> 
> On Tue, Dec 18, 2018 at 4:10 PM Rob Herring  wrote:
>>
>> On Mon, Dec 17, 2018 at 09:44:23PM +0100, Sergio Paracuellos wrote:
>>> Add device-tree binding example of the ksz9477 switch managed in i2c mode.
>>>
>>> Cc: devicet...@vger.kernel.org
>>> Signed-off-by: Sergio Paracuellos 
>>> ---
>>> Changes v3:
>>> - No changes. Just resent patches together.
>>>
>>> Changes v2:
>>> - Use generic name for label of the switch and make sure reg and @X
>>>   have the same value.
>>>
>>>  .../devicetree/bindings/net/dsa/ksz.txt   | 50 +++
>>>  1 file changed, 50 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/dsa/ksz.txt 
>>> b/Documentation/devicetree/bindings/net/dsa/ksz.txt
>>> index 0f407fb371ce..d3c4b9d4f416 100644
>>> --- a/Documentation/devicetree/bindings/net/dsa/ksz.txt
>>> +++ b/Documentation/devicetree/bindings/net/dsa/ksz.txt
>>> @@ -74,3 +74,53 @@ Ethernet switch connected via SPI to the host, CPU port 
>>> wired to eth0:
>>>   };
>>>   };
>>>   };
>>> +
>>> +Ethernet switch connected via I2C to the host, CPU port wired to eth0:
>>> +
>>> + eth0: ethernet@10001000 {
>>
>> Why do we have all this indentation? Please remove. And use tab chars,
>> not spaces.
> 
> The original file format is using all of this indentation. So I think
> we would need a patch to change de format of the original file and
> another with this new changes properly formatted.

The original formatting should be fixed, but your changes should adopt
the correct style from the first time they are submitted. Do you mind
resubmitting with only one tab? We can fix the original examples as a
follow-up patch.

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


Re: [PATCH] staging: android: ion: add buffer flag update ioctl

2018-12-19 Thread Laura Abbott

On 12/19/18 9:19 AM, Zeng Tao wrote:

In some usecases, the buffer cached attribute is not determined at
allocation time, it's determined just before the real cpu mapping.
And from the memory view of point, a buffer should not have the cached
attribute util is really mapped by the cpu. So in this patch, we
introduced the new ioctl command to target the requirement.



This is racy and error prone. Can you explain more what
problem you are trying to solve?


Signed-off-by: Zeng Tao 
---
  drivers/staging/android/ion/ion-ioctl.c |  4 
  drivers/staging/android/ion/ion.c   | 17 +
  drivers/staging/android/ion/ion.h   |  1 +
  drivers/staging/android/uapi/ion.h  | 22 ++
  4 files changed, 44 insertions(+)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index a8d3cc4..60bb702 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -12,6 +12,7 @@
  
  union ion_ioctl_arg {

struct ion_allocation_data allocation;
+   struct ion_buffer_flag_data update;
struct ion_heap_query query;
  };
  
@@ -83,6 +84,9 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
  
  		break;

}
+   case ION_IOC_BUFFER_UPDATE:
+   ret = ion_buffer_update(data.update.fd, data.update.flags);
+   break;
case ION_IOC_HEAP_QUERY:
ret = ion_query_heaps();
break;
diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 9907332..f1404dc 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -436,6 +436,23 @@ int ion_alloc(size_t len, unsigned int heap_id_mask, 
unsigned int flags)
return fd;
  }
  
+int ion_buffer_update(unsigned int fd, unsigned int flags)

+{
+   struct dma_buf *dmabuf;
+   struct ion_buffer *buffer;
+
+   dmabuf = dma_buf_get(fd);
+
+   if (!dmabuf)
+   return -EINVAL;
+
+   buffer = dmabuf->priv;
+   buffer->flags = flags;
+   dma_buf_put(dmabuf);
+
+   return 0;
+}
+
  int ion_query_heaps(struct ion_heap_query *query)
  {
struct ion_device *dev = internal_dev;
diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index c006fc1..99bf9ab 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -199,6 +199,7 @@ int ion_heap_pages_zero(struct page *page, size_t size, 
pgprot_t pgprot);
  int ion_alloc(size_t len,
  unsigned int heap_id_mask,
  unsigned int flags);
+int ion_buffer_update(unsigned int fd, unsigned int flags);
  
  /**

   * ion_heap_init_shrinker
diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index 5d70098..99753fc 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -74,6 +74,20 @@ struct ion_allocation_data {
__u32 unused;
  };
  
+/**

+ * struct ion_buffer_flag_data - metadata passed from userspace for update
+ * buffer flags
+ * @fd:file descriptor of the buffer
+ * @flags: flags passed to the buffer
+ *
+ * Provided by userspace as an argument to the ioctl
+ */
+
+struct ion_buffer_flag_data {
+   __u32 fd;
+   __u32 flags;
+}
+
  #define MAX_HEAP_NAME 32
  
  /**

@@ -116,6 +130,14 @@ struct ion_heap_query {
  struct ion_allocation_data)
  
  /**

+ * DOC: ION_IOC_BUFFER_UPDATE - update the specified ion buffer flags
+ *
+ * Takes an ion_buffer_flag_data structure and returns the result of the
+ * buffer flag update operation.
+ */
+#define ION_IOC_BUFFER_UPDATE  _IOWR(ION_IOC_MAGIC, 1, \
+ struct ion_buffer_flag_data)
+/**
   * DOC: ION_IOC_HEAP_QUERY - information about available heaps
   *
   * Takes an ion_heap_query structure and populates information about



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


[PATCH] staging: wilc1000: fix missing read_write setting when reading data

2018-12-19 Thread Colin King
From: Colin Ian King 

Currently the cmd.read_write setting is not initialized so it contains
garbage from the stack.  Fix this by setting it to 0 to indicate a
read is required.

Detected by CoverityScan, CID#1357925 ("Uninitialized scalar variable")

Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Signed-off-by: Colin Ian King 
---
 drivers/staging/wilc1000/wilc_sdio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 27fdfbdda5c0..e2f739fef21c 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -861,6 +861,7 @@ static int sdio_read_int(struct wilc *wilc, u32 *int_status)
if (!sdio_priv->irq_gpio) {
int i;
 
+   cmd.read_write = 0;
cmd.function = 1;
cmd.address = 0x04;
cmd.data = 0;
-- 
2.19.1

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


[PATCH v2 5/7] mt7621-mmc: char * array declaration might be better as static const

2018-12-19 Thread Jona Crasselt
Issue reported by checkpatch.pl.

Signed-off-by: Jona Crasselt 
Signed-off-by: Felix Windsheimer 
---
 drivers/staging/mt7621-mmc/sd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index ea19ae4f160f..357418999b1f 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -1222,19 +1222,19 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
u32 ddr = 0;
 
 #ifdef MT6575_SD_DEBUG
-   static char *vdd[] = {
+   static const char * const vdd[] = {
"1.50v", "1.55v", "1.60v", "1.65v", "1.70v", "1.80v", "1.90v",
"2.00v", "2.10v", "2.20v", "2.30v", "2.40v", "2.50v", "2.60v",
"2.70v", "2.80v", "2.90v", "3.00v", "3.10v", "3.20v", "3.30v",
"3.40v", "3.50v", "3.60v"
};
-   static char *power_mode[] = {
+   static const char * const power_mode[] = {
"OFF", "UP", "ON"
};
-   static char *bus_mode[] = {
+   static const char * const bus_mode[] = {
"UNKNOWN", "OPENDRAIN", "PUSHPULL"
};
-   static char *timing[] = {
+   static const char * const timing[] = {
"LEGACY", "MMC_HS", "SD_HS"
};
 
-- 
2.17.1

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


[PATCH v2 7/7] mt7621-mmc: Correct spelling mistakes in comments

2018-12-19 Thread Jona Crasselt
Signed-off-by: Jona Crasselt 
Signed-off-by: Felix Windsheimer 
---
 drivers/staging/mt7621-mmc/sd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 149ea9ecfe32..ef3841604cfc 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -1445,7 +1445,7 @@ static void msdc_enable_cd_irq(struct msdc_host *host, 
int enable)
 
/* for sdio, not set */
if ((hw->flags & MSDC_CD_PIN_EN) == 0) {
-   /* Pull down card detection pin since it is not avaiable */
+   /* Pull down card detection pin since it is not available */
/*
 * if (hw->config_gpio_pin)
 * hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_DOWN);
@@ -1542,7 +1542,7 @@ static void msdc_init_hw(struct msdc_host *host)
/* Configure to enable SDIO mode. it's must otherwise sdio cmd5 failed 
*/
sdr_set_bits(host->base + SDC_CFG, SDC_CFG_SDIO);
 
-   /* disable detect SDIO device interupt function */
+   /* disable detect SDIO device interrupt function */
sdr_clr_bits(host->base + SDC_CFG, SDC_CFG_SDIOIDE);
 
/* eneable SMT for glitch filter */
-- 
2.17.1

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


[PATCH v2 6/7] mt7621-mmc: printk() should include KERN_ facility level

2018-12-19 Thread Jona Crasselt
Issue reported by checkpatch.pl.
Replace printk() with pr_debug() to include facility level.

Signed-off-by: Jona Crasselt 
Signed-off-by: Felix Windsheimer 
---
 drivers/staging/mt7621-mmc/sd.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 357418999b1f..149ea9ecfe32 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -1238,10 +1238,10 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, 
struct mmc_ios *ios)
"LEGACY", "MMC_HS", "SD_HS"
};
 
-   printk("SET_IOS: CLK(%dkHz), BUS(%s), BW(%u), PWR(%s), VDD(%s), 
TIMING(%s)",
-   ios->clock / 1000, bus_mode[ios->bus_mode],
-   (ios->bus_width == MMC_BUS_WIDTH_4) ? 4 : 1,
-   power_mode[ios->power_mode], vdd[ios->vdd], 
timing[ios->timing]);
+   pr_debug("SET_IOS: CLK(%dkHz), BUS(%s), BW(%u), PWR(%s), VDD(%s), 
TIMING(%s)",
+ios->clock / 1000, bus_mode[ios->bus_mode],
+(ios->bus_width == MMC_BUS_WIDTH_4) ? 4 : 1,
+power_mode[ios->power_mode], vdd[ios->vdd], 
timing[ios->timing]);
 #endif
 
msdc_set_buswidth(host, ios->bus_width);
-- 
2.17.1

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


[PATCH v2 4/7] mt7621-mmc: return statement in void function unnecessary

2018-12-19 Thread Jona Crasselt
Issue reported by checkpatch.pl.

Signed-off-by: Jona Crasselt 
Signed-off-by: Felix Windsheimer 
---
 drivers/staging/mt7621-mmc/sd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 8af2d5733b11..ea19ae4f160f 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -1189,8 +1189,6 @@ static void msdc_ops_request(struct mmc_host *mmc, struct 
mmc_request *mrq)
spin_unlock(>lock);
 
mmc_request_done(mmc, mrq);
-
-   return;
 }
 
 /* called by ops.set_ios */
-- 
2.17.1

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


[PATCH v2 2/7] mt7621-mmc: Removed unnecessary blank lines

2018-12-19 Thread Jona Crasselt
Issue reported by checkpatch.pl.

Signed-off-by: Jona Crasselt 
Signed-off-by: Felix Windsheimer 
---
 drivers/staging/mt7621-mmc/sd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index e42cfe5fba7e..4483e04ae579 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -351,7 +351,6 @@ static void msdc_pm(pm_message_t state, void *data)
 
host->suspend = 0;
host->pm_state = state;
-
}
 }
 #endif
@@ -1492,7 +1491,6 @@ static void msdc_enable_cd_irq(struct msdc_host *host, 
int enable)
 /* called by msdc_drv_probe */
 static void msdc_init_hw(struct msdc_host *host)
 {
-
/* Configure to MMC/SD mode */
sdr_set_field(host->base + MSDC_CFG, MSDC_CFG_MODE, MSDC_SDMMC);
 
-- 
2.17.1

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


[PATCH v2 1/7] mt7621-mmc: Fix some coding style issues

2018-12-19 Thread Jona Crasselt
Fix some comment-related issues reported by checkpatch.pl:
- Block comments use * on subsequent lines
- Block comments use a trailing */ on a separate line

Signed-off-by: Jona Crasselt 
Signed-off-by: Felix Windsheimer 
---
 drivers/staging/mt7621-mmc/sd.c | 31 +--
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 7b66f9b0a094..e42cfe5fba7e 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -318,9 +318,9 @@ static void msdc_abort_data(struct msdc_host *host)
 
 #ifdef CONFIG_PM
 /*
-   register as callback function of WIFI(combo_sdio_register_pm) .
-   can called by msdc_drv_suspend/resume too.
-*/
+ *   register as callback function of WIFI(combo_sdio_register_pm) .
+ *  can called by msdc_drv_suspend/resume too.
+ */
 static void msdc_pm(pm_message_t state, void *data)
 {
struct msdc_host *host = (struct msdc_host *)data;
@@ -711,7 +711,8 @@ static int msdc_do_request(struct mmc_host *mmc, struct 
mmc_request *mrq)
goto done;
 
/* for read, the data coming too fast, then CRC error
-  start DMA no business with CRC. */
+*  start DMA no business with CRC.
+*/
//init_completion(>xfer_done);
msdc_dma_start(host);
 
@@ -794,9 +795,10 @@ static int msdc_tune_cmdrsp(struct msdc_host *host, struct 
mmc_command *cmd)
u32 skip = 1;
 
/*  don't support 3.0 now 
-  1: R_SMPL[1]
-  2: PAD_CMD_RESP_RXDLY[26:22]
-  ==*/
+*  1: R_SMPL[1]
+*  2: PAD_CMD_RESP_RXDLY[26:22]
+*  ==
+*/
 
// save the previous tune result
sdr_get_field(host->base + MSDC_IOCON, MSDC_IOCON_RSPL, _rsmpl);
@@ -1431,13 +1433,13 @@ static irqreturn_t msdc_irq(int irq, void *dev_id)
/* mmc irq interrupts */
if (intsts & MSDC_INT_MMCIRQ)
dev_info(mmc_dev(host->mmc), "msdc[%d] MMCIRQ: 
SDC_CSTS=0x%.8x\r\n",
-   host->id, readl(host->base + SDC_CSTS));
+host->id, readl(host->base + SDC_CSTS));
 
return IRQ_HANDLED;
 }
 
 /*--*/
-/* platform_driver members 
 */
+/* platform_driver members  */
 /*--*/
 /* called by msdc_drv_probe/remove */
 static void msdc_enable_cd_irq(struct msdc_host *host, int enable)
@@ -1448,9 +1450,9 @@ static void msdc_enable_cd_irq(struct msdc_host *host, 
int enable)
if ((hw->flags & MSDC_CD_PIN_EN) == 0) {
/* Pull down card detection pin since it is not avaiable */
/*
- if (hw->config_gpio_pin)
- hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_DOWN);
-   */
+* if (hw->config_gpio_pin)
+* hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_DOWN);
+*/
sdr_clr_bits(host->base + MSDC_PS, MSDC_PS_CDEN);
sdr_clr_bits(host->base + MSDC_INTEN, MSDC_INTEN_CDSC);
sdr_clr_bits(host->base + SDC_CFG, SDC_CFG_INSWKUP);
@@ -1538,8 +1540,9 @@ static void msdc_init_hw(struct msdc_host *host)
 #endif
 
/* for safety, should clear SDC_CFG.SDIO_INT_DET_EN & set SDC_CFG.SDIO 
in
-  pre-loader,uboot,kernel drivers. and SDC_CFG.SDIO_INT_DET_EN will be 
only
-  set when kernel driver wants to use SDIO bus interrupt */
+*  pre-loader,uboot,kernel drivers. and SDC_CFG.SDIO_INT_DET_EN will 
be only
+*  set when kernel driver wants to use SDIO bus interrupt
+*/
/* Configure to enable SDIO mode. it's must otherwise sdio cmd5 failed 
*/
sdr_set_bits(host->base + SDC_CFG, SDC_CFG_SDIO);
 
-- 
2.17.1

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


[PATCH v2 3/7] mt7621-mmc: Alignment should match open parenthesis

2018-12-19 Thread Jona Crasselt
Issue reported by checkpatch.pl.

Signed-off-by: Jona Crasselt 
Signed-off-by: Felix Windsheimer 
---
 drivers/staging/mt7621-mmc/sd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 4483e04ae579..8af2d5733b11 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -684,7 +684,7 @@ static int msdc_do_request(struct mmc_host *mmc, struct 
mmc_request *mrq)
 
if (read) {
if ((host->timeout_ns != data->timeout_ns) ||
-   (host->timeout_clks != data->timeout_clks)) {
+   (host->timeout_clks != data->timeout_clks)) {
msdc_set_timeout(host, data->timeout_ns, 
data->timeout_clks);
}
}
@@ -1399,7 +1399,7 @@ static irqreturn_t msdc_irq(int irq, void *dev_id)
/* command interrupts */
if (cmd && (intsts & cmdsts)) {
if ((intsts & MSDC_INT_CMDRDY) || (intsts & MSDC_INT_ACMDRDY) ||
-   (intsts & MSDC_INT_ACMD19_DONE)) {
+   (intsts & MSDC_INT_ACMD19_DONE)) {
u32 *rsp = >resp[0];
 
switch (host->cmd_rsp) {
-- 
2.17.1

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


Re: [PATCH] staging: android: ion: add buffer flag update ioctl

2018-12-19 Thread kbuild test robot
Hi Zeng,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.20-rc7 next-20181219]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Zeng-Tao/staging-android-ion-add-buffer-flag-update-ioctl/20181219-231147
config: i386-randconfig-x079-201850 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from drivers/staging/android/ion/ion.h:22:0,
from drivers/staging/android/ion/ion.c:30:
>> drivers/staging/android/ion/../uapi/ion.h:99:1: error: expected ';', 
>> identifier or '(' before 'struct'
struct ion_heap_data {
^~

vim +99 drivers/staging/android/ion/../uapi/ion.h

02b23803 Laura Abbott 2016-09-07   92  
02b23803 Laura Abbott 2016-09-07   93  /**
02b23803 Laura Abbott 2016-09-07   94   * struct ion_heap_data - data about a 
heap
02b23803 Laura Abbott 2016-09-07   95   * @name - first 32 characters of the 
heap name
02b23803 Laura Abbott 2016-09-07   96   * @type - heap type
02b23803 Laura Abbott 2016-09-07   97   * @heap_id - heap id for the heap
02b23803 Laura Abbott 2016-09-07   98   */
02b23803 Laura Abbott 2016-09-07  @99  struct ion_heap_data {
02b23803 Laura Abbott 2016-09-07  100   char name[MAX_HEAP_NAME];
02b23803 Laura Abbott 2016-09-07  101   __u32 type;
02b23803 Laura Abbott 2016-09-07  102   __u32 heap_id;
02b23803 Laura Abbott 2016-09-07  103   __u32 reserved0;
02b23803 Laura Abbott 2016-09-07  104   __u32 reserved1;
02b23803 Laura Abbott 2016-09-07  105   __u32 reserved2;
02b23803 Laura Abbott 2016-09-07  106  };
02b23803 Laura Abbott 2016-09-07  107  

:: The code at line 99 was first introduced by commit
:: 02b23803c6af399473703e26703f74cfff3f22f8 staging: android: ion: Add 
ioctl to query available heaps

:: TO: Laura Abbott 
:: CC: Greg Kroah-Hartman 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] binder: implement binderfs

2018-12-19 Thread Christian Brauner
On Wed, Dec 19, 2018 at 09:47:56AM +0100, Greg KH wrote:
> On Fri, Dec 14, 2018 at 01:11:14PM +0100, Christian Brauner wrote:
> > As discussed at Linux Plumbers Conference 2018 in Vancouver [1] this is the
> > implementation of binderfs.
> 
> 
> 
> Looks good to me, thanks so much for doing this, now queued up!

Thanks for trusting me with this idea and work!
Christian
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: android: ion: add buffer flag update ioctl

2018-12-19 Thread Zeng Tao
In some usecases, the buffer cached attribute is not determined at
allocation time, it's determined just before the real cpu mapping.
And from the memory view of point, a buffer should not have the cached
attribute util is really mapped by the cpu. So in this patch, we
introduced the new ioctl command to target the requirement.

Signed-off-by: Zeng Tao 
---
 drivers/staging/android/ion/ion-ioctl.c |  4 
 drivers/staging/android/ion/ion.c   | 17 +
 drivers/staging/android/ion/ion.h   |  1 +
 drivers/staging/android/uapi/ion.h  | 22 ++
 4 files changed, 44 insertions(+)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index a8d3cc4..60bb702 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -12,6 +12,7 @@
 
 union ion_ioctl_arg {
struct ion_allocation_data allocation;
+   struct ion_buffer_flag_data update;
struct ion_heap_query query;
 };
 
@@ -83,6 +84,9 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned 
long arg)
 
break;
}
+   case ION_IOC_BUFFER_UPDATE:
+   ret = ion_buffer_update(data.update.fd, data.update.flags);
+   break;
case ION_IOC_HEAP_QUERY:
ret = ion_query_heaps();
break;
diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 9907332..f1404dc 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -436,6 +436,23 @@ int ion_alloc(size_t len, unsigned int heap_id_mask, 
unsigned int flags)
return fd;
 }
 
+int ion_buffer_update(unsigned int fd, unsigned int flags)
+{
+   struct dma_buf *dmabuf;
+   struct ion_buffer *buffer;
+
+   dmabuf = dma_buf_get(fd);
+
+   if (!dmabuf)
+   return -EINVAL;
+
+   buffer = dmabuf->priv;
+   buffer->flags = flags;
+   dma_buf_put(dmabuf);
+
+   return 0;
+}
+
 int ion_query_heaps(struct ion_heap_query *query)
 {
struct ion_device *dev = internal_dev;
diff --git a/drivers/staging/android/ion/ion.h 
b/drivers/staging/android/ion/ion.h
index c006fc1..99bf9ab 100644
--- a/drivers/staging/android/ion/ion.h
+++ b/drivers/staging/android/ion/ion.h
@@ -199,6 +199,7 @@ int ion_heap_pages_zero(struct page *page, size_t size, 
pgprot_t pgprot);
 int ion_alloc(size_t len,
  unsigned int heap_id_mask,
  unsigned int flags);
+int ion_buffer_update(unsigned int fd, unsigned int flags);
 
 /**
  * ion_heap_init_shrinker
diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index 5d70098..99753fc 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -74,6 +74,20 @@ struct ion_allocation_data {
__u32 unused;
 };
 
+/**
+ * struct ion_buffer_flag_data - metadata passed from userspace for update
+ * buffer flags
+ * @fd:file descriptor of the buffer
+ * @flags: flags passed to the buffer
+ *
+ * Provided by userspace as an argument to the ioctl
+ */
+
+struct ion_buffer_flag_data {
+   __u32 fd;
+   __u32 flags;
+}
+
 #define MAX_HEAP_NAME  32
 
 /**
@@ -116,6 +130,14 @@ struct ion_heap_query {
  struct ion_allocation_data)
 
 /**
+ * DOC: ION_IOC_BUFFER_UPDATE - update the specified ion buffer flags
+ *
+ * Takes an ion_buffer_flag_data structure and returns the result of the
+ * buffer flag update operation.
+ */
+#define ION_IOC_BUFFER_UPDATE  _IOWR(ION_IOC_MAGIC, 1, \
+ struct ion_buffer_flag_data)
+/**
  * DOC: ION_IOC_HEAP_QUERY - information about available heaps
  *
  * Takes an ion_heap_query structure and populates information about
-- 
2.7.4

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


Re: [PATCH] mt7621-mmc/sd.c: Fix some coding style issues

2018-12-19 Thread Greg KH
On Thu, Dec 13, 2018 at 03:54:07PM +0100, Jona Crasselt wrote:
> Fix some "bigger" issues reported by checkpatch.pl:
> - Block comments use * on subsequent lines
> - Blank lines aren't necessary before a close brace
> - Block comments use a trailing */ on a separate line
> - Alignment should match open parenthesis
> - void function return statements are not generally useful
> - char * array declaration might be better as static const
> - printk() should include KERN_ facility level:
>   replace printk() with pr_debug() to include facility level
> - Some spelling mistakes
> 
> Signed-off-by: Jona Crasselt 
> Signed-off-by: Felix Windsheimer 
> ---

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch did many different things all at once, making it difficult
  to review.  All Linux kernel patches need to only do one thing at a
  time.  If you need to do multiple things (such as clean up all coding
  style issues in a file/driver), do it in a sequence of patches, each
  one doing only one thing.  This will make it easier to review the
  patches to ensure that they are correct, and to help alleviate any
  merge issues that larger patches can cause.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] binder: implement binderfs

2018-12-19 Thread Greg KH
On Fri, Dec 14, 2018 at 01:11:14PM +0100, Christian Brauner wrote:
> As discussed at Linux Plumbers Conference 2018 in Vancouver [1] this is the
> implementation of binderfs.



Looks good to me, thanks so much for doing this, now queued up!

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


Re: [PATCH RFC 01/11] staging: bcm2835-camera: Abort probe if there is no camera

2018-12-19 Thread Peter Robinson
On Thu, Oct 25, 2018 at 4:30 PM Stefan Wahren  wrote:
>
> Abort the probing of the camera driver in case there isn't a camera
> actually connected to the Raspberry Pi. This solution also avoids a
> NULL ptr dereference of mmal instance on driver unload.
>
> Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera 
> driver.")
> Signed-off-by: Stefan Wahren 
Tested-by: Peter Robinson 

In testing this both with and without a camera module attached it
appears to still load the entire v4l stack even if there's no camera
attached and it remains post probe, the /dev/video0 interface doesn't
appear, which is what I'd expect, and from the dmesg output
with/without a camera module it certainly seems to do less. I'm not
sure if it's possible to detect whether we have a camera module before
we start up the full media/v4l stack and exit the process and unload
the module but I suspect having all the v4l bits loaded without
various interfaces might cause confusion.

# lsmod| grep v4l
bcm2835_v4l2   61440  0
videobuf2_vmalloc  20480  1 bcm2835_v4l2
videobuf2_v4l2 24576  1 bcm2835_v4l2
videobuf2_common   49152  2 bcm2835_v4l2,videobuf2_v4l2
v4l2_common16384  1 bcm2835_v4l2
videodev  180224  4
v4l2_common,videobuf2_common,bcm2835_v4l2,videobuf2_v4l2
media  49152  3 videobuf2_common,videodev,videobuf2_v4l2
vchiq 237568  2 bcm2835_v4l2,snd_bcm2835

Peter

> ---
>  drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c 
> b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> index c04bdf0..d6fbef7 100644
> --- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> +++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
> @@ -1841,6 +1841,12 @@ static int bcm2835_mmal_probe(struct platform_device 
> *pdev)
> num_cameras = get_num_cameras(instance,
>   resolutions,
>   MAX_BCM2835_CAMERAS);
> +
> +   if (num_cameras < 1) {
> +   ret = -ENODEV;
> +   goto cleanup_mmal;
> +   }
> +
> if (num_cameras > MAX_BCM2835_CAMERAS)
> num_cameras = MAX_BCM2835_CAMERAS;
>
> @@ -1940,6 +1946,9 @@ static int bcm2835_mmal_probe(struct platform_device 
> *pdev)
> pr_info("%s: error %d while loading driver\n",
> BM2835_MMAL_MODULE_NAME, ret);
>
> +cleanup_mmal:
> +   vchiq_mmal_finalise(instance);
> +
> return ret;
>  }
>
> --
> 2.7.4
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel