[PATCH v3 1/3] Staging: iio: adt7316: Remove irq from bus structure

2019-01-20 Thread Shreeya Patel
interrupt request is not needed to be present in the bus
structure. It is a good option to pass it as a parameter
in the probe function instead of having it in the bus structure.

Signed-off-by: Shreeya Patel 
---
 drivers/staging/iio/addac/adt7316-i2c.c |  3 +--
 drivers/staging/iio/addac/adt7316-spi.c |  4 ++--
 drivers/staging/iio/addac/adt7316.c | 15 +++
 drivers/staging/iio/addac/adt7316.h |  3 +--
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316-i2c.c 
b/drivers/staging/iio/addac/adt7316-i2c.c
index 2d51bd425662..b6571db2e8d8 100644
--- a/drivers/staging/iio/addac/adt7316-i2c.c
+++ b/drivers/staging/iio/addac/adt7316-i2c.c
@@ -99,14 +99,13 @@ static int adt7316_i2c_probe(struct i2c_client *client,
 {
struct adt7316_bus bus = {
.client = client,
-   .irq = client->irq,
.read = adt7316_i2c_read,
.write = adt7316_i2c_write,
.multi_read = adt7316_i2c_multi_read,
.multi_write = adt7316_i2c_multi_write,
};
 
-   return adt7316_probe(&client->dev, &bus, id->name);
+   return adt7316_probe(&client->dev, &bus, id->name, client->irq);
 }
 
 static const struct i2c_device_id adt7316_i2c_id[] = {
diff --git a/drivers/staging/iio/addac/adt7316-spi.c 
b/drivers/staging/iio/addac/adt7316-spi.c
index e75827e326a6..adaaa3eecd04 100644
--- a/drivers/staging/iio/addac/adt7316-spi.c
+++ b/drivers/staging/iio/addac/adt7316-spi.c
@@ -93,7 +93,6 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
 {
struct adt7316_bus bus = {
.client = spi_dev,
-   .irq = spi_dev->irq,
.read = adt7316_spi_read,
.write = adt7316_spi_write,
.multi_read = adt7316_spi_multi_read,
@@ -112,7 +111,8 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
adt7316_spi_write(spi_dev, 0, 0);
adt7316_spi_write(spi_dev, 0, 0);
 
-   return adt7316_probe(&spi_dev->dev, &bus, spi_dev->modalias);
+   return adt7316_probe(&spi_dev->dev, &bus, spi_dev->modalias,
+spi_dev->irq);
 }
 
 static const struct spi_device_id adt7316_spi_id[] = {
diff --git a/drivers/staging/iio/addac/adt7316.c 
b/drivers/staging/iio/addac/adt7316.c
index 8cf3ff25eb62..30808a897fc2 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -1809,12 +1809,12 @@ static irqreturn_t adt7316_event_handler(int irq, void 
*private)
return IRQ_HANDLED;
 }
 
-static int adt7316_setup_irq(struct iio_dev *indio_dev)
+static int adt7316_setup_irq(struct iio_dev *indio_dev, int irq)
 {
struct adt7316_chip_info *chip = iio_priv(indio_dev);
int irq_type, ret;
 
-   irq_type = irqd_get_trigger_type(irq_get_irq_data(chip->bus.irq));
+   irq_type = irqd_get_trigger_type(irq_get_irq_data(irq));
 
switch (irq_type) {
case IRQF_TRIGGER_HIGH:
@@ -1830,13 +1830,12 @@ static int adt7316_setup_irq(struct iio_dev *indio_dev)
break;
}
 
-   ret = devm_request_threaded_irq(&indio_dev->dev, chip->bus.irq,
+   ret = devm_request_threaded_irq(&indio_dev->dev, irq,
NULL, adt7316_event_handler,
irq_type | IRQF_ONESHOT,
indio_dev->name, indio_dev);
if (ret) {
-   dev_err(&indio_dev->dev, "failed to request irq %d\n",
-   chip->bus.irq);
+   dev_err(&indio_dev->dev, "failed to request irq %d\n", irq);
return ret;
}
 
@@ -2136,7 +2135,7 @@ static const struct iio_info adt7516_info = {
  * device probe and remove
  */
 int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
- const char *name)
+ const char *name, int irq)
 {
struct adt7316_chip_info *chip;
struct iio_dev *indio_dev;
@@ -2182,8 +2181,8 @@ int adt7316_probe(struct device *dev, struct adt7316_bus 
*bus,
indio_dev->name = name;
indio_dev->modes = INDIO_DIRECT_MODE;
 
-   if (chip->bus.irq > 0) {
-   ret = adt7316_setup_irq(indio_dev);
+   if (irq > 0) {
+   ret = adt7316_setup_irq(indio_dev, irq);
if (ret)
return ret;
}
diff --git a/drivers/staging/iio/addac/adt7316.h 
b/drivers/staging/iio/addac/adt7316.h
index 84ca4f6c88f5..03d5300a98cd 100644
--- a/drivers/staging/iio/addac/adt7316.h
+++ b/drivers/staging/iio/addac/adt7316.h
@@ -16,7 +16,6 @@
 
 struct adt7316_bus {
void *client;
-   int irq;
int (*read)(void *client, u8 reg, u8 *data);
int (*write)(void *client, u8 reg, u8 val);
int (*multi_read)(void *client, u8 first_reg, u8 count, u8 *data);
@@ -30,6 +29,6 @@ extern const struct dev_pm_ops adt7316_pm_ops;
 #define ADT7316_PM_OPS NUL

[PATCH v3 0/3] adt7316 regmap implementation

2019-01-20 Thread Shreeya Patel
This patchset consist of some initial patches for heading
towards the regmap implementation and also the final patch
which enables the driver to use regmap API thus removing
the redundant and common code.

Changes in v3
  -Fetch the changes from remote and rebase to have it in
the current working directory.

Changes in v2
  -Change the val_bits to 8 and add two more patches
having a different change before the final implemetation
of regmap.

Shreeya Patel (3):
  Staging: iio: adt7316: Remove irq from bus structure
  Staging: iio: adt7316: Remove multi read and write functions
  Staging: iio: adt7316: Add regmap support

 drivers/staging/iio/addac/adt7316-i2c.c |  97 ++--
 drivers/staging/iio/addac/adt7316-spi.c |  95 +++
 drivers/staging/iio/addac/adt7316.c | 147 
 drivers/staging/iio/addac/adt7316.h |  15 +--
 4 files changed, 103 insertions(+), 251 deletions(-)

-- 
2.17.1

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


[PATCH v3 2/3] Staging: iio: adt7316: Remove multi read and write functions

2019-01-20 Thread Shreeya Patel
Currently, adt7316 doesn't use multi read and multi write
functions hence remove the redundant code and make the
necessary changes in the code.

Signed-off-by: Shreeya Patel 
---
 drivers/staging/iio/addac/adt7316-i2c.c | 40 -
 drivers/staging/iio/addac/adt7316-spi.c | 31 ---
 drivers/staging/iio/addac/adt7316.h |  2 --
 3 files changed, 6 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316-i2c.c 
b/drivers/staging/iio/addac/adt7316-i2c.c
index b6571db2e8d8..c7f82c3fe27c 100644
--- a/drivers/staging/iio/addac/adt7316-i2c.c
+++ b/drivers/staging/iio/addac/adt7316-i2c.c
@@ -52,44 +52,6 @@ static int adt7316_i2c_write(void *client, u8 reg, u8 data)
return ret;
 }
 
-static int adt7316_i2c_multi_read(void *client, u8 reg, u8 count, u8 *data)
-{
-   struct i2c_client *cl = client;
-   int i, ret = 0;
-
-   if (count > ADT7316_REG_MAX_ADDR)
-   count = ADT7316_REG_MAX_ADDR;
-
-   for (i = 0; i < count; i++) {
-   ret = adt7316_i2c_read(cl, reg, &data[i]);
-   if (ret < 0) {
-   dev_err(&cl->dev, "I2C multi read error\n");
-   return ret;
-   }
-   }
-
-   return 0;
-}
-
-static int adt7316_i2c_multi_write(void *client, u8 reg, u8 count, u8 *data)
-{
-   struct i2c_client *cl = client;
-   int i, ret = 0;
-
-   if (count > ADT7316_REG_MAX_ADDR)
-   count = ADT7316_REG_MAX_ADDR;
-
-   for (i = 0; i < count; i++) {
-   ret = adt7316_i2c_write(cl, reg, data[i]);
-   if (ret < 0) {
-   dev_err(&cl->dev, "I2C multi write error\n");
-   return ret;
-   }
-   }
-
-   return 0;
-}
-
 /*
  * device probe and remove
  */
@@ -101,8 +63,6 @@ static int adt7316_i2c_probe(struct i2c_client *client,
.client = client,
.read = adt7316_i2c_read,
.write = adt7316_i2c_write,
-   .multi_read = adt7316_i2c_multi_read,
-   .multi_write = adt7316_i2c_multi_write,
};
 
return adt7316_probe(&client->dev, &bus, id->name, client->irq);
diff --git a/drivers/staging/iio/addac/adt7316-spi.c 
b/drivers/staging/iio/addac/adt7316-spi.c
index adaaa3eecd04..1a78dc1e2840 100644
--- a/drivers/staging/iio/addac/adt7316-spi.c
+++ b/drivers/staging/iio/addac/adt7316-spi.c
@@ -23,15 +23,12 @@
  * adt7316 register access by SPI
  */
 
-static int adt7316_spi_multi_read(void *client, u8 reg, u8 count, u8 *data)
+static int adt7316_spi_read(void *client, u8 reg, u8 *data)
 {
struct spi_device *spi_dev = client;
u8 cmd[2];
int ret = 0;
 
-   if (count > ADT7316_REG_MAX_ADDR)
-   count = ADT7316_REG_MAX_ADDR;
-
cmd[0] = ADT7316_SPI_CMD_WRITE;
cmd[1] = reg;
 
@@ -43,7 +40,7 @@ static int adt7316_spi_multi_read(void *client, u8 reg, u8 
count, u8 *data)
 
cmd[0] = ADT7316_SPI_CMD_READ;
 
-   ret = spi_write_then_read(spi_dev, cmd, 1, data, count);
+   ret = spi_write_then_read(spi_dev, cmd, 1, data, 1);
if (ret < 0) {
dev_err(&spi_dev->dev, "SPI read data error\n");
return ret;
@@ -52,21 +49,17 @@ static int adt7316_spi_multi_read(void *client, u8 reg, u8 
count, u8 *data)
return 0;
 }
 
-static int adt7316_spi_multi_write(void *client, u8 reg, u8 count, u8 *data)
+static int adt7316_spi_write(void *client, u8 reg, u8 val)
 {
struct spi_device *spi_dev = client;
u8 buf[ADT7316_REG_MAX_ADDR + 2];
-   int i, ret = 0;
-
-   if (count > ADT7316_REG_MAX_ADDR)
-   count = ADT7316_REG_MAX_ADDR;
+   int ret = 0;
 
buf[0] = ADT7316_SPI_CMD_WRITE;
buf[1] = reg;
-   for (i = 0; i < count; i++)
-   buf[i + 2] = data[i];
+   buf[2] = val;
 
-   ret = spi_write(spi_dev, buf, count + 2);
+   ret = spi_write(spi_dev, buf, 3);
if (ret < 0) {
dev_err(&spi_dev->dev, "SPI write error\n");
return ret;
@@ -75,16 +68,6 @@ static int adt7316_spi_multi_write(void *client, u8 reg, u8 
count, u8 *data)
return ret;
 }
 
-static int adt7316_spi_read(void *client, u8 reg, u8 *data)
-{
-   return adt7316_spi_multi_read(client, reg, 1, data);
-}
-
-static int adt7316_spi_write(void *client, u8 reg, u8 val)
-{
-   return adt7316_spi_multi_write(client, reg, 1, &val);
-}
-
 /*
  * device probe and remove
  */
@@ -95,8 +78,6 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
.client = spi_dev,
.read = adt7316_spi_read,
.write = adt7316_spi_write,
-   .multi_read = adt7316_spi_multi_read,
-   .multi_write = adt7316_spi_multi_write,
};
 
/* don't exceed max specified SPI CLK frequency */
diff --git a/drivers/staging/iio/addac/adt7316.h 
b/drivers/staging/iio/addac

[PATCH v3 3/3] Staging: iio: adt7316: Add regmap support

2019-01-20 Thread Shreeya Patel
Both i2c and spi drivers have functions for reading and writing
to/from registers. Remove this redundant and common code by using
regmap API.

Signed-off-by: Shreeya Patel 
---
 drivers/staging/iio/addac/adt7316-i2c.c |  56 +++---
 drivers/staging/iio/addac/adt7316-spi.c |  74 +++--
 drivers/staging/iio/addac/adt7316.c | 132 
 drivers/staging/iio/addac/adt7316.h |  10 +-
 4 files changed, 94 insertions(+), 178 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316-i2c.c 
b/drivers/staging/iio/addac/adt7316-i2c.c
index c7f82c3fe27c..435b65845174 100644
--- a/drivers/staging/iio/addac/adt7316-i2c.c
+++ b/drivers/staging/iio/addac/adt7316-i2c.c
@@ -12,60 +12,28 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "adt7316.h"
 
-/*
- * adt7316 register access by I2C
- */
-static int adt7316_i2c_read(void *client, u8 reg, u8 *data)
-{
-   struct i2c_client *cl = client;
-   int ret;
-
-   ret = i2c_smbus_write_byte(cl, reg);
-   if (ret < 0) {
-   dev_err(&cl->dev, "I2C fail to select reg\n");
-   return ret;
-   }
-
-   ret = i2c_smbus_read_byte(client);
-   if (ret < 0) {
-   dev_err(&cl->dev, "I2C read error\n");
-   return ret;
-   }
-
-   *data = ret;
-
-   return 0;
-}
-
-static int adt7316_i2c_write(void *client, u8 reg, u8 data)
-{
-   struct i2c_client *cl = client;
-   int ret = 0;
-
-   ret = i2c_smbus_write_byte_data(cl, reg, data);
-   if (ret < 0)
-   dev_err(&cl->dev, "I2C write error\n");
-
-   return ret;
-}
-
 /*
  * device probe and remove
  */
-
 static int adt7316_i2c_probe(struct i2c_client *client,
 const struct i2c_device_id *id)
 {
-   struct adt7316_bus bus = {
-   .client = client,
-   .read = adt7316_i2c_read,
-   .write = adt7316_i2c_write,
-   };
+   struct regmap *regmap;
+
+   regmap = devm_regmap_init_i2c(client, &adt7316_regmap_config);
+
+   if (IS_ERR(regmap)) {
+   dev_err(&client->dev, "Error initializing i2c regmap: %ld\n",
+   PTR_ERR(regmap));
+   return PTR_ERR(regmap);
+   }
 
-   return adt7316_probe(&client->dev, &bus, id->name, client->irq);
+   return adt7316_probe(&client->dev, regmap, id ? id->name : NULL,
+client->irq);
 }
 
 static const struct i2c_device_id adt7316_i2c_id[] = {
diff --git a/drivers/staging/iio/addac/adt7316-spi.c 
b/drivers/staging/iio/addac/adt7316-spi.c
index 1a78dc1e2840..203b5c3ada6e 100644
--- a/drivers/staging/iio/addac/adt7316-spi.c
+++ b/drivers/staging/iio/addac/adt7316-spi.c
@@ -11,74 +11,19 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "adt7316.h"
 
 #define ADT7316_SPI_MAX_FREQ_HZ500
-#define ADT7316_SPI_CMD_READ   0x91
-#define ADT7316_SPI_CMD_WRITE  0x90
-
-/*
- * adt7316 register access by SPI
- */
-
-static int adt7316_spi_read(void *client, u8 reg, u8 *data)
-{
-   struct spi_device *spi_dev = client;
-   u8 cmd[2];
-   int ret = 0;
-
-   cmd[0] = ADT7316_SPI_CMD_WRITE;
-   cmd[1] = reg;
-
-   ret = spi_write(spi_dev, cmd, 2);
-   if (ret < 0) {
-   dev_err(&spi_dev->dev, "SPI fail to select reg\n");
-   return ret;
-   }
-
-   cmd[0] = ADT7316_SPI_CMD_READ;
-
-   ret = spi_write_then_read(spi_dev, cmd, 1, data, 1);
-   if (ret < 0) {
-   dev_err(&spi_dev->dev, "SPI read data error\n");
-   return ret;
-   }
-
-   return 0;
-}
-
-static int adt7316_spi_write(void *client, u8 reg, u8 val)
-{
-   struct spi_device *spi_dev = client;
-   u8 buf[ADT7316_REG_MAX_ADDR + 2];
-   int ret = 0;
-
-   buf[0] = ADT7316_SPI_CMD_WRITE;
-   buf[1] = reg;
-   buf[2] = val;
-
-   ret = spi_write(spi_dev, buf, 3);
-   if (ret < 0) {
-   dev_err(&spi_dev->dev, "SPI write error\n");
-   return ret;
-   }
-
-   return ret;
-}
 
 /*
  * device probe and remove
  */
-
 static int adt7316_spi_probe(struct spi_device *spi_dev)
 {
-   struct adt7316_bus bus = {
-   .client = spi_dev,
-   .read = adt7316_spi_read,
-   .write = adt7316_spi_write,
-   };
+   struct regmap *regmap;
 
/* don't exceed max specified SPI CLK frequency */
if (spi_dev->max_speed_hz > ADT7316_SPI_MAX_FREQ_HZ) {
@@ -87,12 +32,19 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
return -EINVAL;
}
 
+   regmap = devm_regmap_init_spi(spi_dev, &adt7316_regmap_config);
+   if (IS_ERR(regmap)) {
+   dev_err(&spi_dev->dev, "Error initializing spi regmap: %ld\n",
+   PTR_ERR(regmap));
+   return PTR_ERR(regmap);
+   }
+
/* switch from default I2C protocol to SPI protocol *

[PATCH] staging: netlogic: replace ---help--- with help in Kconfig

2019-01-20 Thread Bharath Vedartham
This patch fixes the checkpatch.pl warning:

WARNING: prefer 'help' over '---help---' for new help texts

Signed-off-by: Bharath Vedartham 
---
 drivers/staging/netlogic/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/netlogic/Kconfig b/drivers/staging/netlogic/Kconfig
index d660de5..c25a00d 100644
--- a/drivers/staging/netlogic/Kconfig
+++ b/drivers/staging/netlogic/Kconfig
@@ -2,6 +2,6 @@ config NETLOGIC_XLR_NET
tristate "Netlogic XLR/XLS network device"
depends on CPU_XLR
select PHYLIB
-   ---help---
+   help
This driver support Netlogic XLR/XLS on chip gigabit
Ethernet.
-- 
2.7.4

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


[PATCH] staging: netlogic: replace ---help--- with help in Kconfig

2019-01-20 Thread Bharath Vedartham
This patch fixes the checkpatch.pl warning:

WARNING: prefer 'help' over '---help---' for new help texts

Signed-off-by: Bharath Vedartham 
---
 drivers/staging/netlogic/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/netlogic/Kconfig b/drivers/staging/netlogic/Kconfig
index d660de5..c25a00d 100644
--- a/drivers/staging/netlogic/Kconfig
+++ b/drivers/staging/netlogic/Kconfig
@@ -2,6 +2,6 @@ config NETLOGIC_XLR_NET
tristate "Netlogic XLR/XLS network device"
depends on CPU_XLR
select PHYLIB
-   ---help---
+   help
This driver support Netlogic XLR/XLS on chip gigabit
Ethernet.
-- 
2.7.4

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


[PATCH] staging: wlan-ng: replace ---help--- with help in Kconfig

2019-01-20 Thread Bharath Vedartham
This patch fixes the checkpatch.pl warning:

WARNING: prefer 'help' over '---help---' for new help texts

Signed-off-by: Bharath Vedartham 
---
 drivers/staging/wlan-ng/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/Kconfig b/drivers/staging/wlan-ng/Kconfig
index 426d4ef..9723801 100644
--- a/drivers/staging/wlan-ng/Kconfig
+++ b/drivers/staging/wlan-ng/Kconfig
@@ -4,7 +4,7 @@ config PRISM2_USB
select WIRELESS_EXT
select WEXT_PRIV
default n
-   ---help---
+   help
  This is the wlan-ng prism 2.5/3 USB driver for a wide range of
  old USB wireless devices.
 
-- 
2.7.4

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


[PATCH] media: imx: Validate frame intervals before setting

2019-01-20 Thread Steve Longerbeam
In the .s_frame_interval() subdev op, don't accept or set a
frame interval with a zero numerator or denominator. This fixes
a v4l2-compliance failure:

fail: v4l2-test-formats.cpp(1146):
cap->timeperframe.numerator == 0 || cap->timeperframe.denominator == 0
test VIDIOC_G/S_PARM: FAIL

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/imx-ic-prp.c  | 9 +++--
 drivers/staging/media/imx/imx-ic-prpencvf.c | 9 +++--
 drivers/staging/media/imx/imx-media-csi.c   | 5 -
 drivers/staging/media/imx/imx-media-vdic.c  | 5 -
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/imx/imx-ic-prp.c 
b/drivers/staging/media/imx/imx-ic-prp.c
index 98923fc844ce..a2bb5c702d74 100644
--- a/drivers/staging/media/imx/imx-ic-prp.c
+++ b/drivers/staging/media/imx/imx-ic-prp.c
@@ -422,9 +422,14 @@ static int prp_s_frame_interval(struct v4l2_subdev *sd,
if (fi->pad >= PRP_NUM_PADS)
return -EINVAL;
 
-   /* No limits on frame interval */
mutex_lock(&priv->lock);
-   priv->frame_interval = fi->interval;
+
+   /* No limits on valid frame intervals */
+   if (fi->interval.numerator == 0 || fi->interval.denominator == 0)
+   fi->interval = priv->frame_interval;
+   else
+   priv->frame_interval = fi->interval;
+
mutex_unlock(&priv->lock);
 
return 0;
diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c 
b/drivers/staging/media/imx/imx-ic-prpencvf.c
index 33ada6612fee..d35591e9933b 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -1215,9 +1215,14 @@ static int prp_s_frame_interval(struct v4l2_subdev *sd,
if (fi->pad >= PRPENCVF_NUM_PADS)
return -EINVAL;
 
-   /* No limits on frame interval */
mutex_lock(&priv->lock);
-   priv->frame_interval = fi->interval;
+
+   /* No limits on valid frame intervals */
+   if (fi->interval.numerator == 0 || fi->interval.denominator == 0)
+   fi->interval = priv->frame_interval;
+   else
+   priv->frame_interval = fi->interval;
+
mutex_unlock(&priv->lock);
 
return 0;
diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 555aa45e02e3..81f78a928048 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -905,7 +905,10 @@ static int csi_s_frame_interval(struct v4l2_subdev *sd,
 
switch (fi->pad) {
case CSI_SINK_PAD:
-   /* No limits on input frame interval */
+   /* No limits on valid input frame intervals */
+   if (fi->interval.numerator == 0 ||
+   fi->interval.denominator == 0)
+   fi->interval = *input_fi;
/* Reset output intervals and frame skipping ratio to 1:1 */
priv->frame_interval[CSI_SRC_PAD_IDMAC] = fi->interval;
priv->frame_interval[CSI_SRC_PAD_DIRECT] = fi->interval;
diff --git a/drivers/staging/media/imx/imx-media-vdic.c 
b/drivers/staging/media/imx/imx-media-vdic.c
index 4a890714193e..62e09a53d171 100644
--- a/drivers/staging/media/imx/imx-media-vdic.c
+++ b/drivers/staging/media/imx/imx-media-vdic.c
@@ -818,7 +818,10 @@ static int vdic_s_frame_interval(struct v4l2_subdev *sd,
switch (fi->pad) {
case VDIC_SINK_PAD_DIRECT:
case VDIC_SINK_PAD_IDMAC:
-   /* No limits on input frame interval */
+   /* No limits on valid input frame intervals */
+   if (fi->interval.numerator == 0 ||
+   fi->interval.denominator == 0)
+   fi->interval = priv->frame_interval[fi->pad];
/* Reset output interval */
*output_fi = fi->interval;
if (priv->csi_direct)
-- 
2.17.1

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


Re: [PATCH] staging: vchiq: Fix local event signalling

2019-01-20 Thread Anisse Astier
Hi Phil,

On Fri, Jan 11, 2019 at 11:34:53AM +, Phil Elwell wrote:
> Prior to the recent event reworking (see Fixes), thread synchronisation
> was implemented using completions, the worker thread being woken with
> a call to complete(). The replacement uses waitqueues, which are more
> like condition variables in that the waiting thread is only woken if
> the condition is true.
> 
> When the VPU signals the ARM, it first sets the event's fired flag to
> indicate which event is being signalled, but the places in the
> ARM-side code where the worker thread is being woken -
> remote_event_signal_local via request_poll - did not do so as it
> wasn't previously necessary, and since the armed flag was being
> cleared this lead to a deadlock.

This fixes an issue I've had on linux 5.0-pre to 5.0-rc2+: the
bcm2835-audio driver would block on close, and then nothing would work
until the process was killed. Sample log:

bcm2835_audio bcm2835_audio: failed to close VCHI service connection (status=1)

> 
> Fixes: 852b2876a8a8 ("staging: vchiq: rework remove_event handling")
> Signed-off-by: Phil Elwell 

Tested-by: Anisse Astier 


Regards,

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


RE: [PATCH 2/4] arm64: hyperv: Add support for Hyper-V as a hypervisor

2019-01-20 Thread Michael Kelley
From: Michael Kelley  Sent: Friday, January 4, 2019 12:05 PM
> 
> > >> As Will said, this isn't a viable option. Please follow SMCCC 1.1.
> > >
> > > I'll have to start a conversation with the Hyper-V team about this.
> > > I don't know why they chose to use HVC #1 or this register scheme
> > > for output values.  It may be tough to change at this point because
> > > there are Windows guests on Hyper-V for ARM64 that are already
> > > using this approach.
> >
> > I appreciate you already have stuff in the wild, but there is definitely
> > a case to be made for supporting architecturally specified mechanisms in
> > a hypervisor, and SMCCC is definitely part of it (I'm certainly curious
> > of how you support the Spectre mitigation otherwise).
> >
> 
> The Hyper-V guys I need to discuss this with are not back from the
> holidays until January 7th.  I'll follow up on this thread once I've
> had that conversation.
> 

Feedback from the Hyper-V guys is that they believe the Hyper-V
specific hypercall sequence *is* compliant with SMCCC 1.1, in the
sense of being outside the requirements per Section 2.9 since the
Hyper-V hypercall sequence uses HVC #1.  Hyper-V wanted to use a
simpler calling sequence that doesn't have the full register
save/restore requirements, for better performance.  The details
of the Hyper-V hypercall sequence are documented internally,
but we do still need to get it published externally as part of a
Hyper-V TLFS version that includes ARM64.

Hyper-V uses the full SMC Calling Conventions in other places,
such as for PSCI calls, for SMCs to EL3, and for the Spectre
mitigation related calls.

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


[PATCH -next] staging: rtl8712: drop pointless static qualifier in r8712_efuse_pg_packet_write()

2019-01-20 Thread YueHaibing
There is no need to have the 'intrepeat_times' variable static since new
value always be assigned before use it.

Signed-off-by: YueHaibing 
---
 drivers/staging/rtl8712/rtl8712_efuse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl8712_efuse.c 
b/drivers/staging/rtl8712/rtl8712_efuse.c
index 8bc45ff..39eb743 100644
--- a/drivers/staging/rtl8712/rtl8712_efuse.c
+++ b/drivers/staging/rtl8712/rtl8712_efuse.c
@@ -358,7 +358,7 @@ u8 r8712_efuse_pg_packet_write(struct _adapter *padapter, 
const u8 offset,
u8 pg_header = 0;
u16 efuse_addr = 0, curr_size = 0;
u8 efuse_data, target_word_cnts = 0;
-   static int repeat_times;
+   int repeat_times;
int sub_repeat;
u8 bResult = true;
 





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