[PATCH] staging: comedi: Fix spelling mistake

2019-04-03 Thread Hariprasad Kelam
changes interupts --> interrupts to fix warning reported by checkpatch
tool

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/comedi/drivers/dt2811.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/dt2811.c 
b/drivers/staging/comedi/drivers/dt2811.c
index 05207a5..8a1f9ef 100644
--- a/drivers/staging/comedi/drivers/dt2811.c
+++ b/drivers/staging/comedi/drivers/dt2811.c
@@ -52,7 +52,7 @@
 #define DT2811_ADCSR_ADBUSYBIT(5)  /* r  1=A/D busy */
 #define DT2811_ADCSR_CLRERROR  BIT(4)
 #define DT2811_ADCSR_DMAENBBIT(3)  /* r/w1=dma ena */
-#define DT2811_ADCSR_INTENBBIT(2)  /* r/w1=interupts ena */
+#define DT2811_ADCSR_INTENBBIT(2)  /* r/w1=interrupts ena */
 #define DT2811_ADCSR_ADMODE(x) (((x) & 0x3) << 0)
 
 #define DT2811_ADGCR_REG   0x01/* r/w  A/D Gain/Channel */
-- 
2.7.4

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


Re: [PATCH] Staging: rtlwifi: Remove unwanted parentheses

2019-04-03 Thread Madhumthia Prabakaran
On Wed, Apr 03, 2019 at 07:21:45PM +0300, Dan Carpenter wrote:
> On Wed, Apr 03, 2019 at 07:18:03PM +0300, Dan Carpenter wrote:
> > data_bit  = (data & BIT(i)) ? 1 : 0;
> 
> I quite like the !! idiom also...
> 
>   data_bit = !!(data & BIT(i));

Thanks for reviewing it.

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


[PATCH v2] Staging: rtlwifi: Remove unwanted parentheses

2019-04-03 Thread Madhumitha Prabakaran
Remove unwanted parentheses and use !! idiom in place of ternary
operator to make code simple and more understandable.

Signed-off-by: Madhumitha Prabakaran 

---
Changes in v2:
- Changed commit log
- Replaced ternary operator with !! idiom
- Modified a BIT operator
---
 drivers/staging/rtlwifi/core.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtlwifi/core.c b/drivers/staging/rtlwifi/core.c
index a9902818ae7e..c70f062cf4b9 100644
--- a/drivers/staging/rtlwifi/core.c
+++ b/drivers/staging/rtlwifi/core.c
@@ -341,8 +341,8 @@ static u16 crc16_ccitt(u8 data, u16 crc)
u16 result;
 
for (i = 0; i < 8; i++) {
-   crc_bit15 = ((crc & BIT(15)) ? 1 : 0);
-   data_bit  = (data & (BIT(0) << i) ? 1 : 0);
+   crc_bit15 = !!(crc & BIT(15));
+   data_bit  = !!(data & BIT(i));
shift_in = crc_bit15 ^ data_bit;
 
result = crc << 1;
@@ -351,13 +351,13 @@ static u16 crc16_ccitt(u8 data, u16 crc)
else
result |= BIT(0);
 
-   crc_bit11 = ((crc & BIT(11)) ? 1 : 0) ^ shift_in;
+   crc_bit11 = !!(crc & BIT(11)) ^ shift_in;
if (crc_bit11 == 0)
result &= (~BIT(12));
else
result |= BIT(12);
 
-   crc_bit4 = ((crc & BIT(4)) ? 1 : 0) ^ shift_in;
+   crc_bit4 = !!(crc & BIT(4)) ^ shift_in;
if (crc_bit4 == 0)
result &= (~BIT(5));
else
-- 
2.17.1

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


[PATCH] staging: greybus: power_supply: Use struct_size() helper

2019-04-03 Thread Gustavo A. R. Silva
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes, in particular in the
context in which this code is being used.

So, replace code of the following form:

sizeof(*resp) + props_count * sizeof(struct gb_power_supply_props_desc)

with:

struct_size(resp, props, props_count)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/staging/greybus/power_supply.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/power_supply.c 
b/drivers/staging/greybus/power_supply.c
index 0529e5628c24..40cc2d462ba0 100644
--- a/drivers/staging/greybus/power_supply.c
+++ b/drivers/staging/greybus/power_supply.c
@@ -520,8 +520,8 @@ static int gb_power_supply_prop_descriptors_get(struct 
gb_power_supply *gbpsy)
 
op = gb_operation_create(connection,
 GB_POWER_SUPPLY_TYPE_GET_PROP_DESCRIPTORS,
-sizeof(req), sizeof(*resp) + props_count *
-sizeof(struct gb_power_supply_props_desc),
+sizeof(req),
+struct_size(resp, props, props_count),
 GFP_KERNEL);
if (!op)
return -ENOMEM;
-- 
2.21.0

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


[PATCH] staging: ralink-gdma: Use struct_size() in kzalloc()

2019-04-03 Thread Gustavo A. R. Silva
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct foo {
int stuff;
struct boo entry[];
};

size = sizeof(struct foo) + count * sizeof(struct boo);
instance = kzalloc(size, GFP_KERNEL)

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

size = struct_size(instance, entry, count);

or

instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL)

Based on the above, replace gdma_dma_alloc_desc() with kzalloc() and
use the new struct_size() helper.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/staging/ralink-gdma/ralink-gdma.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ralink-gdma/ralink-gdma.c 
b/drivers/staging/ralink-gdma/ralink-gdma.c
index b6d484532269..3228227776dc 100644
--- a/drivers/staging/ralink-gdma/ralink-gdma.c
+++ b/drivers/staging/ralink-gdma/ralink-gdma.c
@@ -169,12 +169,6 @@ static inline void gdma_dma_write(struct gdma_dma_dev 
*dma_dev,
writel(val, dma_dev->base + reg);
 }
 
-static struct gdma_dma_desc *gdma_dma_alloc_desc(unsigned int num_sgs)
-{
-   return kzalloc(sizeof(struct gdma_dma_desc) +
-   sizeof(struct gdma_dma_sg) * num_sgs, GFP_ATOMIC);
-}
-
 static enum gdma_dma_transfer_size gdma_dma_maxburst(u32 maxburst)
 {
if (maxburst < 2)
@@ -531,7 +525,7 @@ static struct dma_async_tx_descriptor 
*gdma_dma_prep_slave_sg(
struct scatterlist *sg;
unsigned int i;
 
-   desc = gdma_dma_alloc_desc(sg_len);
+   desc = kzalloc(struct_size(desc, sg, sg_len), GFP_ATOMIC);
if (!desc) {
dev_err(c->device->dev, "alloc sg decs error\n");
return NULL;
@@ -586,7 +580,7 @@ static struct dma_async_tx_descriptor 
*gdma_dma_prep_dma_memcpy(
xfer_count = GDMA_REG_CTRL0_TX_MASK;
num_periods = DIV_ROUND_UP(len, xfer_count);
 
-   desc = gdma_dma_alloc_desc(num_periods);
+   desc = kzalloc(struct_size(desc, sg, num_periods), GFP_ATOMIC);
if (!desc) {
dev_err(c->device->dev, "alloc memcpy decs error\n");
return NULL;
@@ -631,7 +625,7 @@ static struct dma_async_tx_descriptor 
*gdma_dma_prep_dma_cyclic(
}
 
num_periods = buf_len / period_len;
-   desc = gdma_dma_alloc_desc(num_periods);
+   desc = kzalloc(struct_size(desc, sg, num_periods), GFP_ATOMIC);
if (!desc) {
dev_err(c->device->dev, "alloc cyclic decs error\n");
return NULL;
-- 
2.21.0

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


[PATCH] staging: iio: cdc: ad7746: Replace bitshift by BIT

2019-04-03 Thread Lucas Oshiro
Replace bitshifts on lines 54, 56 and 78 of ad7746.c.

Signed-off-by: Lucas Oshiro 
---
 drivers/staging/iio/cdc/ad7746.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index 0eb28fea876e..ea48b14cee72 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -51,9 +51,9 @@
 #define AD7746_CAPSETUP_CACHOP BIT(0)
 
 /* Voltage/Temperature Setup Register Bit Designations (AD7746_REG_VT_SETUP) */
-#define AD7746_VTSETUP_VTEN(1 << 7)
+#define AD7746_VTSETUP_VTENBIT(7)
 #define AD7746_VTSETUP_VTMD_INT_TEMP   (0 << 5)
-#define AD7746_VTSETUP_VTMD_EXT_TEMP   (1 << 5)
+#define AD7746_VTSETUP_VTMD_EXT_TEMP   BIT(5)
 #define AD7746_VTSETUP_VTMD_VDD_MON(2 << 5)
 #define AD7746_VTSETUP_VTMD_EXT_VIN(3 << 5)
 #define AD7746_VTSETUP_EXTREF  BIT(4)
@@ -75,7 +75,7 @@
 #define AD7746_CONF_VTFS_MASK  GENMASK(7, 6)
 #define AD7746_CONF_CAPFS_MASK GENMASK(5, 3)
 #define AD7746_CONF_MODE_IDLE  (0 << 0)
-#define AD7746_CONF_MODE_CONT_CONV (1 << 0)
+#define AD7746_CONF_MODE_CONT_CONV BIT(0)
 #define AD7746_CONF_MODE_SINGLE_CONV   (2 << 0)
 #define AD7746_CONF_MODE_PWRDN (3 << 0)
 #define AD7746_CONF_MODE_OFFS_CAL  (5 << 0)
-- 
2.21.0

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


Re: [Lkcamp] [PATCH] staging/rtl8723bs: Fix code indent.

2019-04-03 Thread Helen Koike
Hi Beatriz,

Thank you for the patch, just some small comments.

Regarding the patch title, if you run

git log drivers/staging/rtl8723bs/hal/hal_com_phycfg.c

You will see that commits starts with the following tags "staging:
rtl8723bs: "

Also, try to add a bit more information to the title, for example:

"staging: rtl8723bs: replace spaces by tabs"

See my other comments below:

On Wed, Apr 3, 2019 at 3:42 PM Beatriz Martins de Carvalho
 wrote:
>
> Fix Error: code indent

Please, add more information to your messages, you can add which
checkpatch error you fixed.
See this example: https://lkml.org/lkml/2019/4/2/1184

Please, re-submit version 2 of this patch, it should start with: [PATCH v2]
If you are using git send-email, you can use the option "-v2" and it
will fix the title for you.
Remember to add a change log, see this example:
https://marc.info/?l=linux-kernel=154201089629031=2
See the change log after the "---". It is important to be after the
triple dashes, as this is a comment to help reviewers and it is not
meant for mainline.

I hope this helps! Let me know if you have any questions :)

Regards,
Helen

>
> Signed-off-by: Beatriz Martins de Carvalho 
> 
> ---
>  drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c 
> b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
> index 828b328adab8..fc49cdfcd477 100644
> --- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
> +++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
> @@ -1723,7 +1723,7 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 
> reg_pwr_tbl_sel,
> idx_rate_sctn = get_rate_sctn_idx(data_rate);
>
> if (band_type == BAND_ON_5G && idx_rate_sctn == 0)
> -DBG_871X("Wrong rate 0x%x: No CCK in 5G Band\n", DataRate);
> +   DBG_871X("Wrong rate 0x%x: No CCK in 5G Band\n", DataRate);
>
> /*  workaround for wrong index combination to obtain tx power limit, 
> */
> /*  OFDM only exists in BW 20M */
> --
> 2.17.1
>
>
> ___
> Lkcamp mailing list
> lkc...@lists.libreplanetbr.org
> https://lists.libreplanetbr.org/mailman/listinfo/lkcamp
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 03/16] staging: m57621-mmc: delete driver from the tree.

2019-04-03 Thread George Hilliard
On Tue, Apr 2, 2019 at 3:45 PM Christian Lütke-Stetzkamp
 wrote:
> There are two other larger differences that I found during my
> work. One is that drivers/mmc/host/mtk-sd.c has much more features,
> like voltage and clock handling and some support for high speed
> modes. I don't know if these features are required/useful for this
> device.

For what it's worth, I found an old forum post of someone who was
dealing with a crashy kernel on their mt7688.  They removed the
mt7621-mmc driver and hacked the clock code out of the mainline
driver.  Apparently it worked.  I never got around to duplicating
their work, however.  (I too ran into severe instability problems with
the mt7621-mmc driver, but they only appeared in conjunction with
using the SLOB allocator.  I could never debug it because when JTAG
was turned on, the SDMC peripheral was disabled for some reason I
never discovered.  More info on that if someone is interested.)

The correct way to do this would be to have a "compatible" flag that
bypassed the clock handling code.  I don't think there are any
relevant clocks to set up on the MT7628/MT7688 - the MSDC peripheral
does not appear in the clock plan.

> The other thing is the card detect handling. This driver is
> doing the card detect / read only detection on its own, where the in
> tree one just uses some default gpio functions there and I don't know
> weather this must be changed or weather there is a gpio driver for the
> mt7621.

There is a "mtk,mt7621-gpio"-compatible GPIO driver available.
Probably it would work with GPIO on new hardware that did not to route
CD to the CD pin, because the CD pin is muxed using the same "SD card"
pin state as the SD data pins.  I do not know if it is possible for
the GPIO peripheral to read the pin while it is muxed to the SD
controller, as would be necessary for existing hardware.

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


[PATCH] staging/rtl8723bs: Fix code indent.

2019-04-03 Thread Beatriz Martins de Carvalho
Fix Error: code indent

Signed-off-by: Beatriz Martins de Carvalho 
---
 drivers/staging/rtl8723bs/hal/hal_com_phycfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c 
b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
index 828b328adab8..fc49cdfcd477 100644
--- a/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
@@ -1723,7 +1723,7 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 
reg_pwr_tbl_sel,
idx_rate_sctn = get_rate_sctn_idx(data_rate);
 
if (band_type == BAND_ON_5G && idx_rate_sctn == 0)
-DBG_871X("Wrong rate 0x%x: No CCK in 5G Band\n", DataRate);
+   DBG_871X("Wrong rate 0x%x: No CCK in 5G Band\n", DataRate);
 
/*  workaround for wrong index combination to obtain tx power limit, */
/*  OFDM only exists in BW 20M */
-- 
2.17.1

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


[PATCH 1/2] staging: rtl8188eu: remove unnecessary declaration

2019-04-03 Thread Michael Straube
The declaration of sta2sta_data_frame() is directly above
the function definition. Remove the unnecessary declaration.

This also clears a checkpatch issue.
CHECK: Lines should not end with a '('

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index b7abe8c7c8cd..3a621d58e53d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -632,12 +632,6 @@ static void count_rx_stats(struct adapter *padapter,
}
 }
 
-int sta2sta_data_frame(
-   struct adapter *adapter,
-   struct recv_frame *precv_frame,
-   struct sta_info **psta
-);
-
 int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame,
   struct sta_info **psta)
 {
-- 
2.21.0

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


[PATCH 2/2] staging: rtl8188eu: make sta2sta_data_frame() static

2019-04-03 Thread Michael Straube
Function sta2sta_data_frame() is only used in rtw_recv.c.
So make it static.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 3a621d58e53d..087f6c9a5826 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -632,8 +632,9 @@ static void count_rx_stats(struct adapter *padapter,
}
 }
 
-int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame,
-  struct sta_info **psta)
+static int sta2sta_data_frame(struct adapter *adapter,
+ struct recv_frame *precv_frame,
+ struct sta_info **psta)
 {
int ret = _SUCCESS;
struct rx_pkt_attrib *pattrib = _frame->attrib;
-- 
2.21.0

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


Re: [PATCH] Staging: rtlwifi: Remove unwanted parentheses

2019-04-03 Thread Dan Carpenter
On Wed, Apr 03, 2019 at 07:18:03PM +0300, Dan Carpenter wrote:
>   data_bit  = (data & BIT(i)) ? 1 : 0;

I quite like the !! idiom also...

data_bit = !!(data & BIT(i));

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


Re: [PATCH] Staging: rtlwifi: Remove unwanted parentheses

2019-04-03 Thread Dan Carpenter
On Wed, Apr 03, 2019 at 11:04:45AM -0500, Madhumitha Prabakaran wrote:
> Remove unwanted parentheses around right hand side of an assignment to
> make code better and more understandable.
> 
> Issue found by Coccinelle.
> 
> Signed-off-by: Madhumitha Prabakaran 
> ---
>  drivers/staging/rtlwifi/core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtlwifi/core.c b/drivers/staging/rtlwifi/core.c
> index a9902818ae7e..970343048b69 100644
> --- a/drivers/staging/rtlwifi/core.c
> +++ b/drivers/staging/rtlwifi/core.c
> @@ -341,8 +341,8 @@ static u16 crc16_ccitt(u8 data, u16 crc)
>   u16 result;
>  
>   for (i = 0; i < 8; i++) {
> - crc_bit15 = ((crc & BIT(15)) ? 1 : 0);
> - data_bit  = (data & (BIT(0) << i) ? 1 : 0);
> + crc_bit15 = (crc & BIT(15)) ? 1 : 0;
> + data_bit  = data & (BIT(0) << i) ? 1 : 0;

The original is obviously unhelpful, yes.  And the code works correctly,
true.  But my preferred format would be like this:

data_bit  = (data & BIT(i)) ? 1 : 0;

Left shifting BIT() is silly.  But I like the extra parentheses around
the bitwise AND operation because that's a hard precedence to remember.

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


[PATCH] Staging: rtlwifi: Remove unwanted parentheses

2019-04-03 Thread Madhumitha Prabakaran
Remove unwanted parentheses around right hand side of an assignment to
make code better and more understandable.

Issue found by Coccinelle.

Signed-off-by: Madhumitha Prabakaran 
---
 drivers/staging/rtlwifi/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtlwifi/core.c b/drivers/staging/rtlwifi/core.c
index a9902818ae7e..970343048b69 100644
--- a/drivers/staging/rtlwifi/core.c
+++ b/drivers/staging/rtlwifi/core.c
@@ -341,8 +341,8 @@ static u16 crc16_ccitt(u8 data, u16 crc)
u16 result;
 
for (i = 0; i < 8; i++) {
-   crc_bit15 = ((crc & BIT(15)) ? 1 : 0);
-   data_bit  = (data & (BIT(0) << i) ? 1 : 0);
+   crc_bit15 = (crc & BIT(15)) ? 1 : 0;
+   data_bit  = data & (BIT(0) << i) ? 1 : 0;
shift_in = crc_bit15 ^ data_bit;
 
result = crc << 1;
-- 
2.17.1

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


[PATCH] Staging: mt7621-mmc: Use DIV_ROUND_UP in function msdc_set_mclk

2019-04-03 Thread Madhumitha Prabakaran
Use DIV_ROUND_UP to make code simple and more understandable.

Signed-off-by: Madhumitha Prabakaran 
---
 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 4b26ec896a96..b12ed2c988fd 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -240,7 +240,7 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, 
unsigned int hz)
div  = 1; /* mean div = 1/4 */
sclk = hclk >> 2; /* sclk = clk / 4 */
} else {
-   div  = (hclk + ((hz << 2) - 1)) / (hz << 2);
+   div  = DIV_ROUND_UP(hclk, (hz << 2));
sclk = (hclk >> 2) / div;
}
} else if (hz >= hclk) { /* bug fix */
@@ -253,7 +253,7 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, 
unsigned int hz)
div  = 0; /* mean div = 1/2 */
sclk = hclk >> 1; /* sclk = clk / 2 */
} else {
-   div  = (hclk + ((hz << 2) - 1)) / (hz << 2);
+   div  = DIV_ROUND_UP(hclk, (hz << 2));
sclk = (hclk >> 2) / div;
}
}
-- 
2.17.1

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


[PATCH v3] Staging: gasket: Use DIV_ROUND_UP

2019-04-03 Thread Madhumitha Prabakaran
Use DIV_ROUND_UP in-kernel function to make code simple and more
understandable.

Issue found using Coccinelle.

Signed-off-by: Madhumitha Prabakaran 

---
Changes in v3:
- Included version no in patch

Changes in v2:
- Commit log modified
---
 drivers/staging/gasket/gasket_page_table.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c 
b/drivers/staging/gasket/gasket_page_table.c
index 26755d9ca41d..600928f63577 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -768,8 +768,7 @@ static bool gasket_is_extended_dev_addr_bad(struct 
gasket_page_table *pg_tbl,
page_lvl0_idx = gasket_extended_lvl0_page_idx(pg_tbl, dev_addr);
 
/* Get the count of affected level 0 pages. */
-   num_lvl0_pages = (num_pages + GASKET_PAGES_PER_SUBTABLE - 1) /
-   GASKET_PAGES_PER_SUBTABLE;
+   num_lvl0_pages = DIV_ROUND_UP(num_pages, GASKET_PAGES_PER_SUBTABLE);
 
if (gasket_components_to_dev_address(pg_tbl, 0, page_global_idx,
 page_offset) != dev_addr) {
@@ -1258,7 +1257,7 @@ int gasket_alloc_coherent_memory(struct gasket_dev 
*gasket_dev, u64 size,
dma_addr_t handle;
void *mem;
int j;
-   unsigned int num_pages = (size + PAGE_SIZE - 1) / PAGE_SIZE;
+   unsigned int num_pages = DIV_ROUND_UP(size, PAGE_SIZE);
const struct gasket_driver_desc *driver_desc =
gasket_get_driver_desc(gasket_dev);
 
-- 
2.17.1

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


[PATCH] Staging: gasket: Use DIV_ROUND_UP

2019-04-03 Thread Madhumitha Prabakaran
Use DIV_ROUND_UP in-kernel function to make code simple and more
understandable.

Issue found using Coccinelle.

Signed-off-by: Madhumitha Prabakaran 

---
Changes in v2:
- Commit log modified
---
 drivers/staging/gasket/gasket_page_table.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c 
b/drivers/staging/gasket/gasket_page_table.c
index 26755d9ca41d..600928f63577 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -768,8 +768,7 @@ static bool gasket_is_extended_dev_addr_bad(struct 
gasket_page_table *pg_tbl,
page_lvl0_idx = gasket_extended_lvl0_page_idx(pg_tbl, dev_addr);
 
/* Get the count of affected level 0 pages. */
-   num_lvl0_pages = (num_pages + GASKET_PAGES_PER_SUBTABLE - 1) /
-   GASKET_PAGES_PER_SUBTABLE;
+   num_lvl0_pages = DIV_ROUND_UP(num_pages, GASKET_PAGES_PER_SUBTABLE);
 
if (gasket_components_to_dev_address(pg_tbl, 0, page_global_idx,
 page_offset) != dev_addr) {
@@ -1258,7 +1257,7 @@ int gasket_alloc_coherent_memory(struct gasket_dev 
*gasket_dev, u64 size,
dma_addr_t handle;
void *mem;
int j;
-   unsigned int num_pages = (size + PAGE_SIZE - 1) / PAGE_SIZE;
+   unsigned int num_pages = DIV_ROUND_UP(size, PAGE_SIZE);
const struct gasket_driver_desc *driver_desc =
gasket_get_driver_desc(gasket_dev);
 
-- 
2.17.1

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


Re: [PATCH 1/2] staging:iio:accel:adis16203: add SPDX license identifier tag

2019-04-03 Thread Greg Kroah-Hartman
On Wed, Apr 03, 2019 at 11:41:28AM +0200, Nicholas Mc Guire wrote:
> Pop in the SPDX tag as the license is clearly indicated
> as GPL V2 or later this should also be indicated with a SPDX license
> identifier tag.
> 
> Signed-off-by: Nicholas Mc Guire 

I sent patches yesterday to fix up all of drivers/staging/ for all spdx
issues so as to keep people from accidentally getting this wrong.  That
patch is now in my tree and will show up in linux-next tomorrow.

Sorry,

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


[PATCH v4 10/12] staging: most: configfs: make create attributes write-only

2019-04-03 Thread Christian Gromm
Reading the create attribute that triggers the creation of a link to
a certain channel is not necessary. Hence, it is being removed.

Signed-off-by: Christian Gromm 
---
v2:
v3:
v4:

 drivers/staging/most/configfs.c | 17 ++---
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c
index 24b63a3..11c3001 100644
--- a/drivers/staging/most/configfs.c
+++ b/drivers/staging/most/configfs.c
@@ -103,12 +103,6 @@ static struct mdev_link *to_mdev_link(struct config_item 
*item)
return container_of(item, struct mdev_link, item);
 }
 
-static ssize_t mdev_link_create_link_show(struct config_item *item, char *page)
-{
-   return snprintf(page, PAGE_SIZE, "%d\n",
-   to_mdev_link(item)->create_link);
-}
-
 static int set_config_and_add_link(struct mdev_link *mdev_link)
 {
int i;
@@ -331,7 +325,7 @@ static ssize_t mdev_link_dbr_size_store(struct config_item 
*item,
return count;
 }
 
-CONFIGFS_ATTR(mdev_link_, create_link);
+CONFIGFS_ATTR_WO(mdev_link_, create_link);
 CONFIGFS_ATTR(mdev_link_, device);
 CONFIGFS_ATTR(mdev_link_, channel);
 CONFIGFS_ATTR(mdev_link_, comp);
@@ -479,13 +473,6 @@ static struct config_item *most_snd_grp_make_item(struct 
config_group *group,
return _link->item;
 }
 
-static ssize_t most_snd_grp_create_card_show(struct config_item *item,
-char *page)
-{
-   return snprintf(page, PAGE_SIZE, "%d\n",
-   to_most_snd_grp(item)->create_card);
-}
-
 static ssize_t most_snd_grp_create_card_store(struct config_item *item,
  const char *page, size_t count)
 {
@@ -505,7 +492,7 @@ static ssize_t most_snd_grp_create_card_store(struct 
config_item *item,
return count;
 }
 
-CONFIGFS_ATTR(most_snd_grp_, create_card);
+CONFIGFS_ATTR_WO(most_snd_grp_, create_card);
 
 static struct configfs_attribute *most_snd_grp_attrs[] = {
_snd_grp_attr_create_card,
-- 
2.7.4

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


[PATCH v4 12/12] staging: most: Documentation: update driver documentation

2019-04-03 Thread Christian Gromm
This patch updates the driver documentation files to reflect the
latest changes regarding configfs.

Signed-off-by: Christian Gromm 
v2:
- changed kernel version to 5.2
v3:
v4:

Signed-off-by: Christian Gromm 
---
 .../most/Documentation/ABI/configfs-most.txt   | 204 +
 .../staging/most/Documentation/driver_usage.txt| 131 +++--
 2 files changed, 284 insertions(+), 51 deletions(-)
 create mode 100644 drivers/staging/most/Documentation/ABI/configfs-most.txt

diff --git a/drivers/staging/most/Documentation/ABI/configfs-most.txt 
b/drivers/staging/most/Documentation/ABI/configfs-most.txt
new file mode 100644
index 000..25b3e18
--- /dev/null
+++ b/drivers/staging/most/Documentation/ABI/configfs-most.txt
@@ -0,0 +1,204 @@
+What:  /sys/kernel/config/most_
+Date:  March 8, 2019
+KernelVersion:  5.2
+Description:   Interface is used to configure and connect device channels
+   to component drivers.
+
+   Attributes are visible only when configfs is mounted. To mount
+   configfs in /sys/kernel/config directory use:
+   # mount -t configfs none /sys/kernel/config/
+
+
+What:  /sys/kernel/config/most_cdev/
+Date:  March 8, 2019
+KernelVersion:  5.2
+Description:
+   The attributes:
+
+   buffer_size configure the buffer size for this channel
+
+   subbuffer_size  configure the sub-buffer size for this channel
+   (needed for synchronous and isochrnous data)
+
+
+   num_buffers configure number of buffers used for this
+   channel
+
+   datatypeconfigure type of data that will travel over
+   this channel
+
+   direction   configure whether this link will be an input
+   or output
+
+   dbr_sizeconfigure DBR data buffer size (this is used
+   for MediaLB communiction only)
+
+   packets_per_xact
+   configure the number of packets that will be
+   collected from the network before being
+   transmitted via USB (this is used for USB
+   communiction only)
+
+   device  name of the device the link is to be attached to
+
+   channel name of the channel the link is to be attached 
to
+
+   comp_params pass parameters needed by some components
+
+   create_link write '1' to this attribute to trigger the
+   creation of the link. In case of speculative
+   configuration, the creation is post-poned until
+   a physical device is being attached to the bus.
+
+   destroy_linkwrite '1' to this attribute to destroy an
+   active link
+
+What:  /sys/kernel/config/most_video/
+Date:  March 8, 2019
+KernelVersion:  5.2
+Description:
+   The attributes:
+
+   buffer_size configure the buffer size for this channel
+
+   subbuffer_size  configure the sub-buffer size for this channel
+   (needed for synchronous and isochrnous data)
+
+
+   num_buffers configure number of buffers used for this
+   channel
+
+   datatypeconfigure type of data that will travel over
+   this channel
+
+   direction   configure whether this link will be an input
+   or output
+
+   dbr_sizeconfigure DBR data buffer size (this is used
+   for MediaLB communiction only)
+
+   packets_per_xact
+   configure the number of packets that will be
+   collected from the network before being
+   transmitted via USB (this is used for USB
+   communiction only)
+
+   device  name of the device the link is to be attached to
+
+   channel name of the channel the link is to be attached 
to
+
+   comp_params pass parameters needed by some components
+
+   create_link write '1' to this attribute to trigger the
+   creation of the link. In case of speculative
+   configuration, the creation is post-poned until
+   a physical device is being attached to the bus.
+
+   destroy_linkwrite '1' to this attribute to destroy an
+   active link
+
+What:  /sys/kernel/config/most_net/
+Date:  March 

[PATCH v4 01/12] staging: most: add new file configfs.c

2019-04-03 Thread Christian Gromm
This patch adds the file configfs.c to the driver directory. The file
registers the necessary subsystems with configfs in order to move the
driver configuration from sysfs to configfs.

Signed-off-by: Christian Gromm 
---
v2:
Reported-by: Dan Carpenter 
- remove unnecessary variable init
- replace strcmp w/ sysfs_streq
- prefer snprintf over sprintf
- fix array size
- remove empty exit function
- use bool type for create attributes and kstrtobool function
- remove redundant local variables
- remove inline keyword
- remove check for NULL pointers for struct config_item
v3:
- invert sysfs_streq return value evaluation
v4:
- merged with patch 13/14 of v3 series

 drivers/staging/most/configfs.c | 627 
 1 file changed, 627 insertions(+)
 create mode 100644 drivers/staging/most/configfs.c

diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c
new file mode 100644
index 000..46bf64d
--- /dev/null
+++ b/drivers/staging/most/configfs.c
@@ -0,0 +1,627 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * configfs.c - Implementation of configfs interface to the driver stack
+ *
+ * Copyright (C) 2013-2015 Microchip Technology Germany II GmbH & Co. KG
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct mdev_link {
+   struct config_item item;
+   bool create_link;
+   u16 num_buffers;
+   u16 buffer_size;
+   u16 subbuffer_size;
+   u16 packets_per_xact;
+   u16 dbr_size;
+   char datatype[PAGE_SIZE];
+   char direction[PAGE_SIZE];
+   char name[PAGE_SIZE];
+   char device[PAGE_SIZE];
+   char channel[PAGE_SIZE];
+   char comp[PAGE_SIZE];
+   char comp_params[PAGE_SIZE];
+};
+
+static int set_cfg_buffer_size(struct mdev_link *link)
+{
+   if (!link->buffer_size)
+   return -ENODATA;
+   return most_set_cfg_buffer_size(link->device, link->channel,
+   link->buffer_size);
+}
+
+static int set_cfg_subbuffer_size(struct mdev_link *link)
+{
+   if (!link->subbuffer_size)
+   return -ENODATA;
+   return most_set_cfg_subbuffer_size(link->device, link->channel,
+  link->subbuffer_size);
+}
+
+static int set_cfg_dbr_size(struct mdev_link *link)
+{
+   if (!link->dbr_size)
+   return -ENODATA;
+   return most_set_cfg_dbr_size(link->device, link->channel,
+link->dbr_size);
+}
+
+static int set_cfg_num_buffers(struct mdev_link *link)
+{
+   if (!link->num_buffers)
+   return -ENODATA;
+   return most_set_cfg_num_buffers(link->device, link->channel,
+   link->num_buffers);
+}
+
+static int set_cfg_packets_xact(struct mdev_link *link)
+{
+   if (!link->packets_per_xact)
+   return -ENODATA;
+   return most_set_cfg_packets_xact(link->device, link->channel,
+link->packets_per_xact);
+}
+
+static int set_cfg_direction(struct mdev_link *link)
+{
+   if (!strlen(link->direction))
+   return -ENODATA;
+   return most_set_cfg_direction(link->device, link->channel,
+ link->direction);
+}
+
+static int set_cfg_datatype(struct mdev_link *link)
+{
+   if (!strlen(link->datatype))
+   return -ENODATA;
+   return most_set_cfg_datatype(link->device, link->channel,
+link->datatype);
+}
+
+static int (*set_config_val[])(struct mdev_link *link) = {
+   set_cfg_buffer_size,
+   set_cfg_subbuffer_size,
+   set_cfg_dbr_size,
+   set_cfg_num_buffers,
+   set_cfg_packets_xact,
+   set_cfg_direction,
+   set_cfg_datatype,
+};
+
+static struct mdev_link *to_mdev_link(struct config_item *item)
+{
+   return container_of(item, struct mdev_link, item);
+}
+
+static ssize_t mdev_link_create_link_show(struct config_item *item, char *page)
+{
+   return snprintf(page, PAGE_SIZE, "%d\n",
+   to_mdev_link(item)->create_link);
+}
+
+static ssize_t mdev_link_create_link_store(struct config_item *item,
+  const char *page, size_t count)
+{
+   struct mdev_link *mdev_link = to_mdev_link(item);
+   bool tmp;
+   int ret;
+   int i;
+
+   ret = kstrtobool(page, );
+   if (ret)
+   return ret;
+
+   for (i = 0; i < ARRAY_SIZE(set_config_val); i++) {
+   ret = set_config_val[i](mdev_link);
+   if (ret < 0)
+   return ret;
+   }
+
+   if (tmp)
+   ret = most_add_link(mdev_link->device, mdev_link->channel,
+   mdev_link->comp, mdev_link->name,
+   

[PATCH v4 06/12] staging: most: core: make sysfs attributes read-only

2019-04-03 Thread Christian Gromm
This patch changes the access flags of the channel attributes to
read-only. This is needed, because configuration is done via configfs.

Signed-off-by: Christian Gromm 
---
v2:
v3:
v4:

 drivers/staging/most/core.c | 122 +++-
 1 file changed, 7 insertions(+), 115 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index dbca6b0..e0a6806 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -272,19 +272,6 @@ static ssize_t set_number_of_buffers_show(struct device 
*dev,
return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.num_buffers);
 }
 
-static ssize_t set_number_of_buffers_store(struct device *dev,
-  struct device_attribute *attr,
-  const char *buf,
-  size_t count)
-{
-   struct most_channel *c = to_channel(dev);
-   int ret = kstrtou16(buf, 0, >cfg.num_buffers);
-
-   if (ret)
-   return ret;
-   return count;
-}
-
 static ssize_t set_buffer_size_show(struct device *dev,
struct device_attribute *attr,
char *buf)
@@ -294,19 +281,6 @@ static ssize_t set_buffer_size_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.buffer_size);
 }
 
-static ssize_t set_buffer_size_store(struct device *dev,
-struct device_attribute *attr,
-const char *buf,
-size_t count)
-{
-   struct most_channel *c = to_channel(dev);
-   int ret = kstrtou16(buf, 0, >cfg.buffer_size);
-
-   if (ret)
-   return ret;
-   return count;
-}
-
 static ssize_t set_direction_show(struct device *dev,
  struct device_attribute *attr,
  char *buf)
@@ -320,28 +294,6 @@ static ssize_t set_direction_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "unconfigured\n");
 }
 
-static ssize_t set_direction_store(struct device *dev,
-  struct device_attribute *attr,
-  const char *buf,
-  size_t count)
-{
-   struct most_channel *c = to_channel(dev);
-
-   if (!strcmp(buf, "dir_rx\n")) {
-   c->cfg.direction = MOST_CH_RX;
-   } else if (!strcmp(buf, "rx\n")) {
-   c->cfg.direction = MOST_CH_RX;
-   } else if (!strcmp(buf, "dir_tx\n")) {
-   c->cfg.direction = MOST_CH_TX;
-   } else if (!strcmp(buf, "tx\n")) {
-   c->cfg.direction = MOST_CH_TX;
-   } else {
-   pr_info("WARN: invalid attribute settings\n");
-   return -EINVAL;
-   }
-   return count;
-}
-
 static ssize_t set_datatype_show(struct device *dev,
 struct device_attribute *attr,
 char *buf)
@@ -356,28 +308,6 @@ static ssize_t set_datatype_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "unconfigured\n");
 }
 
-static ssize_t set_datatype_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf,
- size_t count)
-{
-   int i;
-   struct most_channel *c = to_channel(dev);
-
-   for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
-   if (!strcmp(buf, ch_data_type[i].name)) {
-   c->cfg.data_type = ch_data_type[i].most_ch_data_type;
-   break;
-   }
-   }
-
-   if (i == ARRAY_SIZE(ch_data_type)) {
-   pr_info("WARN: invalid attribute settings\n");
-   return -EINVAL;
-   }
-   return count;
-}
-
 static ssize_t set_subbuffer_size_show(struct device *dev,
   struct device_attribute *attr,
   char *buf)
@@ -387,19 +317,6 @@ static ssize_t set_subbuffer_size_show(struct device *dev,
return snprintf(buf, PAGE_SIZE, "%d\n", c->cfg.subbuffer_size);
 }
 
-static ssize_t set_subbuffer_size_store(struct device *dev,
-   struct device_attribute *attr,
-   const char *buf,
-   size_t count)
-{
-   struct most_channel *c = to_channel(dev);
-   int ret = kstrtou16(buf, 0, >cfg.subbuffer_size);
-
-   if (ret)
-   return ret;
-   return count;
-}
-
 static ssize_t set_packets_per_xact_show(struct device *dev,
 struct device_attribute *attr,
 char *buf)
@@ -409,19 +326,6 @@ static ssize_t set_packets_per_xact_show(struct device 
*dev,
return snprintf(buf, 

[PATCH v4 02/12] staging: most: change signature of function probe_channel

2019-04-03 Thread Christian Gromm
This patch adds the param argument to the function parameter of
the call-back probe_channel. This parameter is needed to configure
the channels of an attached device.

Signed-off-by: Christian Gromm 
---
v2:
v3:
v4:

 drivers/staging/most/cdev/cdev.c   | 2 +-
 drivers/staging/most/core.c| 6 --
 drivers/staging/most/core.h| 3 ++-
 drivers/staging/most/net/net.c | 3 ++-
 drivers/staging/most/sound/sound.c | 3 +--
 drivers/staging/most/video/video.c | 3 ++-
 6 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index f2b347c..97408ec 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -425,7 +425,7 @@ static int comp_tx_completion(struct most_interface *iface, 
int channel_id)
  * Returns 0 on success or error code otherwise.
  */
 static int comp_probe(struct most_interface *iface, int channel_id,
- struct most_channel_config *cfg, char *name)
+ struct most_channel_config *cfg, char *name, char *args)
 {
struct comp_channel *c;
unsigned long cl_flags;
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 956daf8..3671482 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -701,6 +701,7 @@ static struct most_channel *get_channel(char *mdev, char 
*mdev_ch)
 static
 inline int link_channel_to_component(struct most_channel *c,
 struct core_component *comp,
+char *name,
 char *comp_param)
 {
int ret;
@@ -714,7 +715,8 @@ inline int link_channel_to_component(struct most_channel *c,
return -ENOSPC;
 
*comp_ptr = comp;
-   ret = comp->probe_channel(c->iface, c->channel_id, >cfg, comp_param);
+   ret = comp->probe_channel(c->iface, c->channel_id, >cfg, name,
+ comp_param);
if (ret) {
*comp_ptr = NULL;
return ret;
@@ -775,7 +777,7 @@ static ssize_t add_link_store(struct device_driver *drv,
if (!c)
return -ENODEV;
 
-   ret = link_channel_to_component(c, comp, comp_param);
+   ret = link_channel_to_component(c, comp, "name", comp_param);
if (ret)
return ret;
return len;
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index 64cc02f..025dd1d 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -266,7 +266,8 @@ struct core_component {
struct list_head list;
const char *name;
int (*probe_channel)(struct most_interface *iface, int channel_idx,
-struct most_channel_config *cfg, char *name);
+struct most_channel_config *cfg, char *name,
+char *param);
int (*disconnect_channel)(struct most_interface *iface,
  int channel_idx);
int (*rx_completion)(struct mbo *mbo);
diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index e20584b..c8a64e2 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -293,7 +293,8 @@ static struct net_dev_context *get_net_dev_hold(struct 
most_interface *iface)
 }
 
 static int comp_probe_channel(struct most_interface *iface, int channel_idx,
- struct most_channel_config *ccfg, char *name)
+ struct most_channel_config *ccfg, char *name,
+ char *args)
 {
struct net_dev_context *nd;
struct net_dev_channel *ch;
diff --git a/drivers/staging/most/sound/sound.c 
b/drivers/staging/most/sound/sound.c
index 79ab3a7..02fcd32 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -579,7 +579,7 @@ static void release_adapter(struct sound_adapter *adpt)
  */
 static int audio_probe_channel(struct most_interface *iface, int channel_id,
   struct most_channel_config *cfg,
-  char *arg_list)
+  char *device_name, char *arg_list)
 {
struct channel *channel;
struct sound_adapter *adpt;
@@ -588,7 +588,6 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
int capture_count = 0;
int ret;
int direction;
-   char *device_name;
u16 ch_num;
u8 create = 0;
char *sample_res;
diff --git a/drivers/staging/most/video/video.c 
b/drivers/staging/most/video/video.c
index ad7e28a..adca250 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -453,7 +453,8 @@ static void comp_v4l2_dev_release(struct v4l2_device 
*v4l2_dev)
 }
 
 static int comp_probe_channel(struct most_interface *iface, int channel_idx,
-   

[PATCH v4 05/12] staging: most: enable configfs support

2019-04-03 Thread Christian Gromm
This patch enables the configfs functionality of the driver by
registering the configfs subsystems and compiling the configfs
part of the sources.

Signed-off-by: Christian Gromm 
---
v2:
- remove call to configfs_exit function
v3:
v4:
- add dependency to CONFIGFS_FS

 drivers/staging/most/Kconfig   |  2 +-
 drivers/staging/most/Makefile  |  1 +
 drivers/staging/most/cdev/cdev.c   |  6 ++
 drivers/staging/most/core.c|  2 +-
 drivers/staging/most/sound/sound.c | 11 ++-
 5 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/Kconfig b/drivers/staging/most/Kconfig
index 20047ab..fb6b8f7 100644
--- a/drivers/staging/most/Kconfig
+++ b/drivers/staging/most/Kconfig
@@ -1,6 +1,6 @@
 menuconfig MOST
 tristate "MOST support"
-   depends on HAS_DMA
+   depends on HAS_DMA && CONFIGFS_FS
 default n
 ---help---
  Say Y here if you want to enable MOST support.
diff --git a/drivers/staging/most/Makefile b/drivers/staging/most/Makefile
index c7662f6..85ea5a4 100644
--- a/drivers/staging/most/Makefile
+++ b/drivers/staging/most/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_MOST) += most_core.o
 most_core-y := core.o
+most_core-y += configfs.o
 ccflags-y += -I $(srctree)/drivers/staging/
 
 obj-$(CONFIG_MOST_CDEV)+= cdev/
diff --git a/drivers/staging/most/cdev/cdev.c b/drivers/staging/most/cdev/cdev.c
index 97408ec..d98977c 100644
--- a/drivers/staging/most/cdev/cdev.c
+++ b/drivers/staging/most/cdev/cdev.c
@@ -527,8 +527,13 @@ static int __init mod_init(void)
err = most_register_component();
if (err)
goto free_cdev;
+   err = most_register_configfs_subsys();
+   if (err)
+   goto deregister_comp;
return 0;
 
+deregister_comp:
+   most_deregister_component();
 free_cdev:
unregister_chrdev_region(comp.devno, CHRDEV_REGION_SIZE);
 dest_ida:
@@ -543,6 +548,7 @@ static void __exit mod_exit(void)
 
pr_info("exit module\n");
 
+   most_deregister_configfs_subsys();
most_deregister_component();
 
list_for_each_entry_safe(c, tmp, _list, list) {
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 0bdd24d..dbca6b0 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -1765,7 +1765,7 @@ static int __init most_init(void)
err = -ENOMEM;
goto err_unregister_driver;
}
-
+   configfs_init();
return 0;
 
 err_unregister_driver:
diff --git a/drivers/staging/most/sound/sound.c 
b/drivers/staging/most/sound/sound.c
index 8261742..6b5438c 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -790,16 +790,25 @@ static struct core_component comp = {
 
 static int __init audio_init(void)
 {
+   int ret;
+
pr_info("init()\n");
 
INIT_LIST_HEAD(_list);
 
-   return most_register_component();
+   ret = most_register_component();
+   if (ret)
+   pr_err("Failed to register %s\n", comp.name);
+   ret = most_register_configfs_subsys();
+   if (ret)
+   pr_err("Failed to register %s configfs subsys\n", comp.name);
+   return ret;
 }
 
 static void __exit audio_exit(void)
 {
pr_info("exit()\n");
+   most_deregister_configfs_subsys();
most_deregister_component();
 }
 
-- 
2.7.4

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


[PATCH v4 00/12] staging: most: switch to configfs

2019-04-03 Thread Christian Gromm
This patch set makes the driver provide its configuration interface via
configfs. The configuration interface is being switched to simplify the
process of setting up the driver and to introduce the new feature of
speculative configuration.

v2:
v3:
v4:
Reported-by: Greg Kroah-Hartman 
- removed patch 7/14 and sent in as stand-alone
- squashed patch 13/14 into 1/14
Hence, this series is two patches shorter than its predecessor.

Christian Gromm (12):
  staging: most: add new file configfs.c
  staging: most: change signature of function probe_channel
  staging: most: core: add configfs interface functions
  staging: most: sound: introduce new sound adapter management
  staging: most: enable configfs support
  staging: most: core: make sysfs attributes read-only
  staging: most: usb: remove prefix from description tag
  staging: most: core: remove attribute add_link
  staging: most: allow speculative configuration
  staging: most: configfs: make create attributes write-only
  staging: most: configfs: add code for link removal
  staging: most: Documentation: update driver documentation

 .../most/Documentation/ABI/configfs-most.txt   | 204 +++
 .../staging/most/Documentation/driver_usage.txt| 131 ++--
 drivers/staging/most/Kconfig   |   2 +-
 drivers/staging/most/Makefile  |   1 +
 drivers/staging/most/cdev/cdev.c   |   8 +-
 drivers/staging/most/configfs.c| 676 +
 drivers/staging/most/core.c| 303 -
 drivers/staging/most/core.h|  20 +-
 drivers/staging/most/net/net.c |   3 +-
 drivers/staging/most/sound/sound.c |  59 +-
 drivers/staging/most/usb/usb.c |   2 +-
 drivers/staging/most/video/video.c |   3 +-
 12 files changed, 1164 insertions(+), 248 deletions(-)
 create mode 100644 drivers/staging/most/Documentation/ABI/configfs-most.txt
 create mode 100644 drivers/staging/most/configfs.c

-- 
2.7.4

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


[PATCH v4 08/12] staging: most: core: remove attribute add_link

2019-04-03 Thread Christian Gromm
This patch removes the driver attribute add_link. It is not needed, because
the link management is now done via configfs.

Signed-off-by: Christian Gromm 
---
v2:
v3:
v4:

 drivers/staging/most/core.c | 61 -
 1 file changed, 61 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index e0a6806..df1d774 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -616,65 +616,6 @@ inline int link_channel_to_component(struct most_channel 
*c,
return 0;
 }
 
-/**
- * add_link_store - store function for add_link attribute
- * @drv: device driver
- * @buf: buffer
- * @len: buffer length
- *
- * This parses the string given by buf and splits it into
- * four substrings. Note: last substring is optional. In case a cdev
- * component is loaded the optional 4th substring will make up the name of
- * device node in the /dev directory. If omitted, the device node will
- * inherit the channel's name within sysfs.
- *
- * Searches for (device, channel) pair and probes the component
- *
- * Example:
- * (1) echo "mdev0:ch6:cdev:my_rxchannel" >add_link
- * (2) echo "mdev1:ep81:cdev" >add_link
- *
- * (1) would create the device node /dev/my_rxchannel
- * (2) would create the device node /dev/mdev1-ep81
- */
-static ssize_t add_link_store(struct device_driver *drv,
- const char *buf,
- size_t len)
-{
-   struct most_channel *c;
-   struct core_component *comp;
-   char buffer[STRING_SIZE];
-   char *mdev;
-   char *mdev_ch;
-   char *comp_name;
-   char *comp_param;
-   char devnod_buf[STRING_SIZE];
-   int ret;
-   size_t max_len = min_t(size_t, len + 1, STRING_SIZE);
-
-   strlcpy(buffer, buf, max_len);
-   ret = split_string(buffer, , _ch, _name, _param);
-   if (ret)
-   return ret;
-   comp = match_component(comp_name);
-   if (!comp)
-   return -ENODEV;
-   if (!comp_param || *comp_param == 0) {
-   snprintf(devnod_buf, sizeof(devnod_buf), "%s-%s", mdev,
-mdev_ch);
-   comp_param = devnod_buf;
-   }
-
-   c = get_channel(mdev, mdev_ch);
-   if (!c)
-   return -ENODEV;
-
-   ret = link_channel_to_component(c, comp, "name", comp_param);
-   if (ret)
-   return ret;
-   return len;
-}
-
 int most_set_cfg_buffer_size(char *mdev, char *mdev_ch, u16 val)
 {
struct most_channel *c = get_channel(mdev, mdev_ch);
@@ -863,13 +804,11 @@ int most_remove_link(char *mdev, char *mdev_ch, char 
*comp_name)
 
 static DRIVER_ATTR_RO(links);
 static DRIVER_ATTR_RO(components);
-static DRIVER_ATTR_WO(add_link);
 static DRIVER_ATTR_WO(remove_link);
 
 static struct attribute *mc_attrs[] = {
DRV_ATTR(links),
DRV_ATTR(components),
-   DRV_ATTR(add_link),
DRV_ATTR(remove_link),
NULL,
 };
-- 
2.7.4

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


[PATCH v4 11/12] staging: most: configfs: add code for link removal

2019-04-03 Thread Christian Gromm
This patch adds code that cleans up established links whenever the destroy
attribute is set or if the config_item (directory) is being removed.

Signed-off-by: Christian Gromm 
---
v2:
- follow-up adaptions due to changes introduced w/ [PATCH v2 01/14]
v3:
v4:

 drivers/staging/most/configfs.c | 38 --
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c
index 11c3001..29b0dd1 100644
--- a/drivers/staging/most/configfs.c
+++ b/drivers/staging/most/configfs.c
@@ -16,6 +16,7 @@ struct mdev_link {
struct config_item item;
struct list_head list;
bool create_link;
+   bool destroy_link;
u16 num_buffers;
u16 buffer_size;
u16 subbuffer_size;
@@ -132,8 +133,7 @@ static ssize_t mdev_link_create_link_store(struct 
config_item *item,
if (ret)
return ret;
if (!tmp)
-   return most_remove_link(mdev_link->device, mdev_link->channel,
-   mdev_link->comp);
+   return count;
ret = set_config_and_add_link(mdev_link);
if (ret && ret != -ENODEV)
return ret;
@@ -142,6 +142,28 @@ static ssize_t mdev_link_create_link_store(struct 
config_item *item,
return count;
 }
 
+static ssize_t mdev_link_destroy_link_store(struct config_item *item,
+   const char *page, size_t count)
+{
+   struct mdev_link *mdev_link = to_mdev_link(item);
+   bool tmp;
+   int ret;
+
+   ret = kstrtobool(page, );
+   if (ret)
+   return ret;
+   if (!tmp)
+   return count;
+   mdev_link->destroy_link = tmp;
+   ret = most_remove_link(mdev_link->device, mdev_link->channel,
+  mdev_link->comp);
+   if (ret)
+   return ret;
+   if (!list_empty(_link_list))
+   list_del(_link->list);
+   return count;
+}
+
 static ssize_t mdev_link_direction_show(struct config_item *item, char *page)
 {
return snprintf(page, PAGE_SIZE, "%s\n", to_mdev_link(item)->direction);
@@ -326,6 +348,7 @@ static ssize_t mdev_link_dbr_size_store(struct config_item 
*item,
 }
 
 CONFIGFS_ATTR_WO(mdev_link_, create_link);
+CONFIGFS_ATTR_WO(mdev_link_, destroy_link);
 CONFIGFS_ATTR(mdev_link_, device);
 CONFIGFS_ATTR(mdev_link_, channel);
 CONFIGFS_ATTR(mdev_link_, comp);
@@ -340,6 +363,7 @@ CONFIGFS_ATTR(mdev_link_, dbr_size);
 
 static struct configfs_attribute *mdev_link_attrs[] = {
_link_attr_create_link,
+   _link_attr_destroy_link,
_link_attr_device,
_link_attr_channel,
_link_attr_comp,
@@ -356,6 +380,16 @@ static struct configfs_attribute *mdev_link_attrs[] = {
 
 static void mdev_link_release(struct config_item *item)
 {
+   struct mdev_link *mdev_link = to_mdev_link(item);
+   int ret;
+
+   if (!list_empty(_link_list)) {
+   ret = most_remove_link(mdev_link->device, mdev_link->channel,
+  mdev_link->comp);
+   if (ret && (ret != -ENODEV))
+   pr_err("Removing link failed.\n");
+   list_del(_link->list);
+   }
kfree(to_mdev_link(item));
 }
 
-- 
2.7.4

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


[PATCH v4 09/12] staging: most: allow speculative configuration

2019-04-03 Thread Christian Gromm
This patch makes the driver accept a link configuration eventhough no
device is attached to the bus. Instead the configuration is being applied
as soon as a device is being registered with the core.

Signed-off-by: Christian Gromm 
---
v2:
- follow-up adaptions due to changes introduced w/ [PATCH v2 01/14]
v3:
Reported-by: Dan Carpenter 
- remove filter for particular error message ENODATA in function
  set_config_and_add_link and check for negative values instead
v4:

 drivers/staging/most/configfs.c| 60 --
 drivers/staging/most/core.c| 16 +++---
 drivers/staging/most/core.h|  1 +
 drivers/staging/most/sound/sound.c |  6 ++--
 4 files changed, 53 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/most/configfs.c b/drivers/staging/most/configfs.c
index 46bf64d..24b63a3 100644
--- a/drivers/staging/most/configfs.c
+++ b/drivers/staging/most/configfs.c
@@ -14,6 +14,7 @@
 
 struct mdev_link {
struct config_item item;
+   struct list_head list;
bool create_link;
u16 num_buffers;
u16 buffer_size;
@@ -29,6 +30,8 @@ struct mdev_link {
char comp_params[PAGE_SIZE];
 };
 
+struct list_head mdev_link_list;
+
 static int set_cfg_buffer_size(struct mdev_link *link)
 {
if (!link->buffer_size)
@@ -106,33 +109,41 @@ static ssize_t mdev_link_create_link_show(struct 
config_item *item, char *page)
to_mdev_link(item)->create_link);
 }
 
+static int set_config_and_add_link(struct mdev_link *mdev_link)
+{
+   int i;
+   int ret;
+
+   for (i = 0; i < ARRAY_SIZE(set_config_val); i++) {
+   ret = set_config_val[i](mdev_link);
+   if (ret < 0 && ret != -ENODEV) {
+   pr_err("Config failed\n");
+   return ret;
+   }
+   }
+
+   return most_add_link(mdev_link->device, mdev_link->channel,
+mdev_link->comp, mdev_link->name,
+mdev_link->comp_params);
+}
+
 static ssize_t mdev_link_create_link_store(struct config_item *item,
   const char *page, size_t count)
 {
struct mdev_link *mdev_link = to_mdev_link(item);
bool tmp;
int ret;
-   int i;
 
ret = kstrtobool(page, );
if (ret)
return ret;
-
-   for (i = 0; i < ARRAY_SIZE(set_config_val); i++) {
-   ret = set_config_val[i](mdev_link);
-   if (ret < 0)
-   return ret;
-   }
-
-   if (tmp)
-   ret = most_add_link(mdev_link->device, mdev_link->channel,
-   mdev_link->comp, mdev_link->name,
-   mdev_link->comp_params);
-   else
-   ret = most_remove_link(mdev_link->device, mdev_link->channel,
-  mdev_link->comp);
-   if (ret)
+   if (!tmp)
+   return most_remove_link(mdev_link->device, mdev_link->channel,
+   mdev_link->comp);
+   ret = set_config_and_add_link(mdev_link);
+   if (ret && ret != -ENODEV)
return ret;
+   list_add_tail(_link->list, _link_list);
mdev_link->create_link = tmp;
return count;
 }
@@ -594,6 +605,22 @@ int most_register_configfs_subsys(struct core_component *c)
 }
 EXPORT_SYMBOL_GPL(most_register_configfs_subsys);
 
+void most_interface_register_notify(const char *mdev)
+{
+   bool register_snd_card = false;
+   struct mdev_link *mdev_link;
+
+   list_for_each_entry(mdev_link, _link_list, list) {
+   if (!strcmp(mdev_link->device, mdev)) {
+   set_config_and_add_link(mdev_link);
+   if (!strcmp(mdev_link->comp, "sound"))
+   register_snd_card = true;
+   }
+   }
+   if (register_snd_card)
+   most_cfg_complete("sound");
+}
+
 void most_deregister_configfs_subsys(struct core_component *c)
 {
if (!strcmp(c->name, "cdev"))
@@ -622,6 +649,7 @@ int __init configfs_init(void)
mutex_init(_sound_subsys.subsys.su_mutex);
 
INIT_LIST_HEAD(_sound_subsys.soundcard_list);
+   INIT_LIST_HEAD(_link_list);
 
return 0;
 }
diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index df1d774..b1f7f70 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -720,19 +720,10 @@ int most_cfg_complete(char *comp_name)
 int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name,
  char *comp_param)
 {
-   struct most_channel *c;
-   struct core_component *comp;
-   char buf[STRING_SIZE];
+   struct most_channel *c = get_channel(mdev, mdev_ch);
+   struct core_component *comp = match_component(comp_name);
 
-   comp = match_component(comp_name);
-

[PATCH v4 03/12] staging: most: core: add configfs interface functions

2019-04-03 Thread Christian Gromm
This patch adds the core's interface to configfs file.

Signed-off-by: Christian Gromm 
---
v2:
v3:
v4:

 drivers/staging/most/core.c | 142 
 drivers/staging/most/core.h |  16 -
 2 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 3671482..0bdd24d 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -783,6 +783,127 @@ static ssize_t add_link_store(struct device_driver *drv,
return len;
 }
 
+int most_set_cfg_buffer_size(char *mdev, char *mdev_ch, u16 val)
+{
+   struct most_channel *c = get_channel(mdev, mdev_ch);
+
+   if (!c)
+   return -ENODEV;
+   c->cfg.buffer_size = val;
+   return 0;
+}
+
+int most_set_cfg_subbuffer_size(char *mdev, char *mdev_ch, u16 val)
+{
+   struct most_channel *c = get_channel(mdev, mdev_ch);
+
+   if (!c)
+   return -ENODEV;
+   c->cfg.subbuffer_size = val;
+   return 0;
+}
+
+int most_set_cfg_dbr_size(char *mdev, char *mdev_ch, u16 val)
+{
+   struct most_channel *c = get_channel(mdev, mdev_ch);
+
+   if (!c)
+   return -ENODEV;
+   c->cfg.dbr_size = val;
+   return 0;
+}
+
+int most_set_cfg_num_buffers(char *mdev, char *mdev_ch, u16 val)
+{
+   struct most_channel *c = get_channel(mdev, mdev_ch);
+
+   if (!c)
+   return -ENODEV;
+   c->cfg.num_buffers = val;
+   return 0;
+}
+
+int most_set_cfg_datatype(char *mdev, char *mdev_ch, char *buf)
+{
+   int i;
+   struct most_channel *c = get_channel(mdev, mdev_ch);
+
+   if (!c)
+   return -ENODEV;
+   for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
+   if (!strcmp(buf, ch_data_type[i].name)) {
+   c->cfg.data_type = ch_data_type[i].most_ch_data_type;
+   break;
+   }
+   }
+
+   if (i == ARRAY_SIZE(ch_data_type))
+   pr_info("WARN: invalid attribute settings\n");
+   return 0;
+}
+
+int most_set_cfg_direction(char *mdev, char *mdev_ch, char *buf)
+{
+   struct most_channel *c = get_channel(mdev, mdev_ch);
+
+   if (!c)
+   return -ENODEV;
+   if (!strcmp(buf, "dir_rx\n")) {
+   c->cfg.direction = MOST_CH_RX;
+   } else if (!strcmp(buf, "rx\n")) {
+   c->cfg.direction = MOST_CH_RX;
+   } else if (!strcmp(buf, "dir_tx\n")) {
+   c->cfg.direction = MOST_CH_TX;
+   } else if (!strcmp(buf, "tx\n")) {
+   c->cfg.direction = MOST_CH_TX;
+   } else {
+   pr_info("Invalid direction\n");
+   return -ENODATA;
+   }
+   return 0;
+}
+
+int most_set_cfg_packets_xact(char *mdev, char *mdev_ch, u16 val)
+{
+   struct most_channel *c = get_channel(mdev, mdev_ch);
+
+   if (!c)
+   return -ENODEV;
+   c->cfg.packets_per_xact = val;
+   return 0;
+}
+
+int most_cfg_complete(char *comp_name)
+{
+   struct core_component *comp;
+
+   comp = match_component(comp_name);
+   if (!comp)
+   return -ENODEV;
+
+   return comp->cfg_complete();
+}
+
+int most_add_link(char *mdev, char *mdev_ch, char *comp_name, char *link_name,
+ char *comp_param)
+{
+   struct most_channel *c;
+   struct core_component *comp;
+   char buf[STRING_SIZE];
+
+   comp = match_component(comp_name);
+   if (!comp)
+   return -ENODEV;
+   if (!comp_param || *comp_param == 0) {
+   snprintf(buf, sizeof(buf), "%s-%s", mdev, mdev_ch);
+   comp_param = buf;
+   }
+   c = get_channel(mdev, mdev_ch);
+   if (!c)
+   return -ENODEV;
+
+   return link_channel_to_component(c, comp, link_name, comp_param);
+}
 /**
  * remove_link_store - store function for remove_link attribute
  * @drv: device driver
@@ -825,6 +946,27 @@ static ssize_t remove_link_store(struct device_driver *drv,
return len;
 }
 
+int most_remove_link(char *mdev, char *mdev_ch, char *comp_name)
+{
+   struct most_channel *c;
+   struct core_component *comp;
+
+   comp = match_component(comp_name);
+   if (!comp)
+   return -ENODEV;
+   c = get_channel(mdev, mdev_ch);
+   if (!c)
+   return -ENODEV;
+
+   if (comp->disconnect_channel(c->iface, c->channel_id))
+   return -EIO;
+   if (c->pipe0.comp == comp)
+   c->pipe0.comp = NULL;
+   if (c->pipe1.comp == comp)
+   c->pipe1.comp = NULL;
+   return 0;
+}
+
 #define DRV_ATTR(_name)  (_attr_##_name.attr)
 
 static DRIVER_ATTR_RO(links);
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index 025dd1d..12c5992 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -272,6 +272,7 @@ struct core_component {
  int channel_idx);
int 

[PATCH v4 04/12] staging: most: sound: introduce new sound adapter management

2019-04-03 Thread Christian Gromm
This patch adapts the sound card management to the configfs changes.

Signed-off-by: Christian Gromm 
---
v2:
v3:
Reported-by: Dan Carpenter 
- return 0 in function audio_create_sound_card
v4:

 drivers/staging/most/sound/sound.c | 41 +-
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/most/sound/sound.c 
b/drivers/staging/most/sound/sound.c
index 02fcd32..8261742 100644
--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -471,17 +471,11 @@ static const struct snd_pcm_ops pcm_ops = {
.page   = snd_pcm_lib_get_vmalloc_page,
 };
 
-static int split_arg_list(char *buf, char **device_name, u16 *ch_num,
- char **sample_res, u8 *create)
+static int split_arg_list(char *buf, u16 *ch_num, char **sample_res)
 {
char *num;
int ret;
 
-   *device_name = strsep(, ".");
-   if (!*device_name) {
-   pr_err("Missing sound card name\n");
-   return -EIO;
-   }
num = strsep(, "x");
if (!num)
goto err;
@@ -492,8 +486,6 @@ static int split_arg_list(char *buf, char **device_name, 
u16 *ch_num,
if (!*sample_res)
goto err;
 
-   if (buf && !strcmp(buf, "create"))
-   *create = 1;
return 0;
 
 err:
@@ -589,7 +581,6 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
int ret;
int direction;
u16 ch_num;
-   u8 create = 0;
char *sample_res;
 
if (!iface)
@@ -600,8 +591,7 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
return -EINVAL;
}
 
-   ret = split_arg_list(arg_list, _name, _num, _res,
-);
+   ret = split_arg_list(arg_list, _num, _res);
if (ret < 0)
return ret;
 
@@ -672,12 +662,6 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
strscpy(pcm->name, device_name, sizeof(pcm->name));
snd_pcm_set_ops(pcm, direction, _ops);
 
-   if (create) {
-   ret = snd_card_register(adpt->card);
-   if (ret < 0)
-   goto err_free_adpt;
-   adpt->registered = true;
-   }
return 0;
 
 err_free_adpt:
@@ -685,6 +669,26 @@ static int audio_probe_channel(struct most_interface 
*iface, int channel_id,
return ret;
 }
 
+static int audio_create_sound_card(void)
+{
+   int ret;
+   struct sound_adapter *adpt;
+
+   list_for_each_entry(adpt, _list, list) {
+   if (!adpt->registered)
+   goto adpt_alloc;
+   }
+   return -ENODEV;
+adpt_alloc:
+   ret = snd_card_register(adpt->card);
+   if (ret < 0) {
+   release_adapter(adpt);
+   return ret;
+   }
+   adpt->registered = true;
+   return 0;
+}
+
 /**
  * audio_disconnect_channel - function to disconnect a channel
  * @iface: pointer to interface instance
@@ -781,6 +785,7 @@ static struct core_component comp = {
.disconnect_channel = audio_disconnect_channel,
.rx_completion = audio_rx_completion,
.tx_completion = audio_tx_completion,
+   .cfg_complete = audio_create_sound_card,
 };
 
 static int __init audio_init(void)
-- 
2.7.4

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


[PATCH v4 07/12] staging: most: usb: remove prefix from description tag

2019-04-03 Thread Christian Gromm
This patch cuts off the usb_device prefix of the description string.
It is not needed, as the interface type is already available with the
interface attribute of a channel.

Signed-off-by: Christian Gromm 
---
v2:
v3:
v4:

 drivers/staging/most/usb/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c
index c0293d8..360cb5b 100644
--- a/drivers/staging/most/usb/usb.c
+++ b/drivers/staging/most/usb/usb.c
@@ -1072,7 +1072,7 @@ hdm_probe(struct usb_interface *interface, const struct 
usb_device_id *id)
mdev->iface.num_channels = num_endpoints;
 
snprintf(mdev->description, sizeof(mdev->description),
-"usb_device %d-%s:%d.%d",
+"%d-%s:%d.%d",
 usb_dev->bus->busnum,
 usb_dev->devpath,
 usb_dev->config->desc.bConfigurationValue,
-- 
2.7.4

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


Re: [PATCH 1/2] staging:iio:accel:adis16203: add SPDX license identifier tag

2019-04-03 Thread Himanshu Jha
On Wed, Apr 03, 2019 at 11:41:28AM +0200, Nicholas Mc Guire wrote:
> Pop in the SPDX tag as the license is clearly indicated
> as GPL V2 or later this should also be indicated with a SPDX license
> identifier tag.
> 
> Signed-off-by: Nicholas Mc Guire 
> ---
> 
> chackpatch.pl was warning:
> WARNING: Missing or malformed SPDX-License-Identifier tag in line 1
> 
> Patch was compile tested with: X86_64_defconfig + SPI=y, IIO=m
> STAGING=y, ADIS16203=m
> 
> Patch is against 5.1-rc3 (localversion-next is next-20190403)
> 
>  drivers/staging/iio/accel/adis16203.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/iio/accel/adis16203.c 
> b/drivers/staging/iio/accel/adis16203.c
> index 5cc96c80..cf9d41a 100644
> --- a/drivers/staging/iio/accel/adis16203.c
> +++ b/drivers/staging/iio/accel/adis16203.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later

SPDX-License-Identifier: GPL-2.0+ ?

Documentation/process/license-rules.rst

 For 'GNU General Public License (GPL) version 2 or any later version' use:
   SPDX-License-Identifier: GPL-2.0+

The following should also be removed in this same patch:

* Licensed under the GPL-2 or later.

And lastly, MODULE_LICENSE() should also be checked, which appear
to be correct in its current form.

>  /*
>   * ADIS16203 Programmable 360 Degrees Inclinometer
>   *
> -- 
> 2.1.4
> 

-- 
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: most: core: use device description as name

2019-04-03 Thread Sasha Levin
Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.0.5, v4.19.32, v4.14.109, v4.9.166, 
v4.4.177, v3.18.137.

v5.0.5: Build OK!
v4.19.32: Build OK!
v4.14.109: Failed to apply! Possible dependencies:
057301cd972e ("staging: most: move core files")
1a79f22de810 ("staging: most: add SPDX identifiers to all most driver 
files")
4d5f022f3a66 ("staging: most: remove proprietary kobjects")
9136fccf38a7 ("staging: most: core: replace struct most_inst_obj")
9249c6a6d356 ("staging: most: dim2: rename module")
e6e79b449ed9 ("staging: most: core: encapsulate code in function")
fcb7fad82e23 ("staging: most: core: rename structure")

v4.9.166: Failed to apply! Possible dependencies:
057301cd972e ("staging: most: move core files")
1a79f22de810 ("staging: most: add SPDX identifiers to all most driver 
files")
1c74e3ab95da ("staging: most: core: make use of __ATTR_* macros")
4d5f022f3a66 ("staging: most: remove proprietary kobjects")
4dd7c7c7b367 ("staging: most: core: fix function names")
5f788625cd4c ("staging: most: consolidate attributes for list of links")
648377cd2125 ("staging: most: dim2: enable flow control for isoc channels")
7dc70220e92f ("staging: most: core: consolidate channel attributes")
7e47629e7af1 ("staging: most: Eliminate usage of symbolic permissions")
9136fccf38a7 ("staging: most: core: replace struct most_inst_obj")
9249c6a6d356 ("staging: most: dim2: rename module")
931161b7141e ("staging: most: core: remove read option from remove_link")
add98da7da79 ("staging: most: core: separate property showing links")
b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to 
files with no license")
b5478c1b67bc ("alpha: add asm/extable.h")
bdc58e3bef64 ("staging: most: Using macro DIV_ROUND_UP")
d2892ebc5bb4 ("staging: most: dim2: replace function parameter with the 
expression")
fcb7fad82e23 ("staging: most: core: rename structure")

v4.4.177: Failed to apply! Possible dependencies:
092c78f24a89 ("staging: most: add __iomem for io_base and registers")
17ac98ac7339 ("staging: most: fix error comparison")
1a79f22de810 ("staging: most: add SPDX identifiers to all most driver 
files")
1c74e3ab95da ("staging: most: core: make use of __ATTR_* macros")
1efc45646240 ("staging: most: rename DIMCB_IoWrite to dimcb_io_write")
245dc23d2368 ("staging: most: move mutex")
3eced21a5afb ("staging: most: hdm-dim2: Replace request_irq with 
devm_request_irq")
42e252a65d3b ("staging: most: move initialization of pointer")
44fe57818b80 ("staging: most: move call to disconnect_channel callback")
4d5f022f3a66 ("staging: most: remove proprietary kobjects")
4dd7c7c7b367 ("staging: most: core: fix function names")
52076fe26c28 ("staging: most: hdm-dim2: remove structure member")
58889788fc80 ("staging: most: rename DIMCB_IoRead to dimcb_io_read")
5f788625cd4c ("staging: most: consolidate attributes for list of links")
6417267f17c7 ("staging: most: rename DIM_Startup to dim_startup")
7dc70220e92f ("staging: most: core: consolidate channel attributes")
7e47629e7af1 ("staging: most: Eliminate usage of symbolic permissions")
8661fca6f679 ("staging: most: hdm-dim2: Replace kzalloc with devm_kzalloc")
9136fccf38a7 ("staging: most: core: replace struct most_inst_obj")
9249c6a6d356 ("staging: most: dim2: rename module")
931161b7141e ("staging: most: core: remove read option from remove_link")
99d753463a9a ("staging: most: core: rename device struct of core module")
9b762fdfe26e ("staging: most: hdm-dim2: relocate variable declarations")
9ce039a08add ("staging: most: remove function destroy_most_c_obj")
9d521ca71d95 ("Staging: most: Replace pr_err with dev_err")
a0fceb1fb853 ("staging: most: move channel disconnect to function 
most_deregister_interface")
a6424138 ("staging: most: hdm-dim2: Replace pr_err with dev_err")
a85ee2aa9968 ("staging: most: hdm-dim2: round up DBR memory for async/ctrl")
add98da7da79 ("staging: most: core: separate property showing links")
b7382d44a530 ("staging: most: add missing call to ida_simple_remove")
bab469cdb667 ("staging: most: hdm-dim2: Switch to devm_ioremap_resource()")
bc5f96a15658 ("staging: most: core: show all linked channels")
bdc58e3bef64 ("staging: most: Using macro DIV_ROUND_UP")
cc4188b6bb44 ("staging: most: return proper error")
de6687313df4 ("staging: most: rename DIMCB_OnError to dimcb_on_error")
e7f2b70fd3a9 ("staging: most: replace multiple if..else with table lookup")
fcb7fad82e23 ("staging: most: core: rename structure")

v3.18.137: Failed to apply! Possible dependencies:
2cbf7fe2d5d3 ("i2o: move to staging")
57562a72414c ("Staging: most: add MOST driver's 

[PATCH 1/2] staging:iio:accel:adis16203: add SPDX license identifier tag

2019-04-03 Thread Nicholas Mc Guire
Pop in the SPDX tag as the license is clearly indicated
as GPL V2 or later this should also be indicated with a SPDX license
identifier tag.

Signed-off-by: Nicholas Mc Guire 
---

chackpatch.pl was warning:
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1

Patch was compile tested with: X86_64_defconfig + SPI=y, IIO=m
STAGING=y, ADIS16203=m

Patch is against 5.1-rc3 (localversion-next is next-20190403)

 drivers/staging/iio/accel/adis16203.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/adis16203.c 
b/drivers/staging/iio/accel/adis16203.c
index 5cc96c80..cf9d41a 100644
--- a/drivers/staging/iio/accel/adis16203.c
+++ b/drivers/staging/iio/accel/adis16203.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ADIS16203 Programmable 360 Degrees Inclinometer
  *
-- 
2.1.4

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


[PATCH 2/2] staging:iio:accel:adis16240: add SPDX license identifier tag

2019-04-03 Thread Nicholas Mc Guire
Pop in the SPDX tag as the license is clearly indicated
as GPL V2 or later this should also be indicated with a SPDX license
identifier tag.

Signed-off-by: Nicholas Mc Guire 
---

chackpatch.pl was warning:
WARNING: Missing or malformed SPDX-License-Identifier tag in line 1

Patch was compile tested with: x86_64_defconfig + SPI=y, IIO=m
STAGING=y, ADIS16240=m

Patch is against 5.1-rc3 (localversion-next is next-20190403)

 drivers/staging/iio/accel/adis16240.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/accel/adis16240.c 
b/drivers/staging/iio/accel/adis16240.c
index 24e525f..b2d71ae 100644
--- a/drivers/staging/iio/accel/adis16240.c
+++ b/drivers/staging/iio/accel/adis16240.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * ADIS16240 Programmable Impact Sensor and Recorder driver
  *
-- 
2.1.4

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


Re: [PATCH 06/16] staging: vc04_services: remove remaining redundant license text

2019-04-03 Thread Greg Kroah-Hartman
On Tue, Apr 02, 2019 at 12:37:57PM +0200, Stefan Wahren wrote:
> Am 02.04.19 um 12:31 schrieb Greg Kroah-Hartman:
> > Now that the SPDX tag is in all vc04_services files, that identifies the
> > license in a specific and legally-defined manner.  So the extra GPL and
> > BSD text wording can be removed as it is no longer needed at all.
> >
> > This is done on a quest to remove the 700+ different ways that files in
> > the kernel describe the license text.
> >
> > No copyright headers or other non-license-description text was removed.
> >
> > Cc: Eric Anholt 
> > Cc: Stefan Wahren 
> > Cc: Tuomas Tynkkynen 
> > Cc: Aymen Qader 
> > Cc: "Tobias Büttner" 
> > Cc: Dominic Braun 
> > Cc: Nicolas Saenz Julienne 
> > Cc: Alejandro Ismael Silva 
> > Cc: Phil Elwell 
> > Cc: Luis Chamberlain 
> > Cc: Arnd Bergmann 
> > Signed-off-by: Greg Kroah-Hartman 
> 
> Acked-by: Stefan Wahren 

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


Re: [PATCH 02/16] staging: add missing SPDX lines to Makefile files

2019-04-03 Thread Greg Kroah-Hartman
On Tue, Apr 02, 2019 at 05:36:20PM +0530, Mukesh Ojha wrote:
> 
> On 4/2/2019 4:01 PM, Greg Kroah-Hartman wrote:
> > There are a few remaining drivers/staging/*/Makefile files that do not
> > have SPDX identifiers in them.  Add the correct GPL-2.0 identifier to
> > them to make scanning tools happy.
> > 
> > Signed-off-by: Greg Kroah-Hartman 
> 
> Lesson learnt :-)

Heh :)

> Reviewed-by: Mukesh Ojha 

thanks for the review.

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


Re: [driver-core:driver-core-testing 4/14] arch/ia64/kernel/acpi.c:669:38: error: passing argument 2 of 'acpi_table_parse' from incompatible pointer type

2019-04-03 Thread Greg Kroah-Hartman
On Wed, Apr 03, 2019 at 02:18:18AM +0800, kbuild test robot wrote:
> tree:   
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
> driver-core-testing
> head:   5e29ef654e7be73a579b96c1b912dac5cea33046
> commit: 088d0b345be1952be1a5004fb78cfffa0835cbe1 [4/14] acpi: Create subtable 
> parsing infrastructure
> config: ia64-allmodconfig (attached as .config)
> compiler: ia64-linux-gcc (GCC) 8.1.0
> reproduce:
> wget 
> https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
> ~/bin/make.cross
> chmod +x ~/bin/make.cross
> git checkout 088d0b345be1952be1a5004fb78cfffa0835cbe1
> # save the attached .config to linux build tree
> GCC_VERSION=8.1.0 make.cross ARCH=ia64 
> 
> All errors (new ones prefixed by >>):
> 
>arch/ia64/kernel/acpi.c: In function 'early_acpi_boot_init':
> >> arch/ia64/kernel/acpi.c:669:38: error: passing argument 2 of 
> >> 'acpi_table_parse' from incompatible pointer type 
> >> [-Werror=incompatible-pointer-types]
>  if (acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt)) {
>  ^~~
>In file included from arch/ia64/kernel/acpi.c:43:
>include/linux/acpi.h:241:55: note: expected 'acpi_tbl_table_handler' {aka 
> 'int (*)(struct acpi_table_header *)'} but argument is of type 'int (*)(union 
> acpi_subtable_headers *)'
> int acpi_table_parse(char *id, acpi_tbl_table_handler handler);

Keith, any ideas about this?

thanks,

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


Re: [PATCH] staging: vchiq_arm: remove space after open '('

2019-04-03 Thread Stefan Wahren
Am 03.04.19 um 05:07 schrieb Mario Balan:
> Fix checkpatch error "ERROR: space prohibited after that open
> parenthesis '('" in vchiq_arm.c:563.
>
> Signed-off-by: Mario Balan 

Acked-by: Stefan Wahren 

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