Re: [PATCH 05/13] staging: nvec: Switch from strlcpy to strscpy

2021-02-03 Thread Marc Dietrich

Hi Kumar,

On Sun, 31 Jan 2021, Kumar Kartikeya Dwivedi wrote:


strlcpy is marked as deprecated in Documentation/process/deprecated.rst,
and there is no functional difference when the caller expects truncation
(when not checking the return value). strscpy is relatively better as it
also avoids scanning the whole source string.

This silences the related checkpatch warnings from:
5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy")

Signed-off-by: Kumar Kartikeya Dwivedi 
---
drivers/staging/nvec/nvec_ps2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index 45db29262..157009015 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -112,8 +112,8 @@ static int nvec_mouse_probe(struct platform_device *pdev)
ser_dev->start = ps2_startstreaming;
ser_dev->stop = ps2_stopstreaming;

-   strlcpy(ser_dev->name, "nvec mouse", sizeof(ser_dev->name));
-   strlcpy(ser_dev->phys, "nvec", sizeof(ser_dev->phys));
+   strscpy(ser_dev->name, "nvec mouse", sizeof(ser_dev->name));
+   strscpy(ser_dev->phys, "nvec", sizeof(ser_dev->phys));


lgtm, so

Acked-by: Marc Dietrich 

Thanks!

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


Re: [PATCH 2/2] Staging: nvec: nvec: fixed check style issues

2018-12-17 Thread Marc Dietrich



Hi,

On Mon, 17 Dec 2018, Greg KH wrote:


On Sun, Dec 16, 2018 at 08:57:43AM -0800, Amir Mahdi Ghorbanian wrote:

@@ -626,7 +628,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
break;
case 2: /* first byte after command */
if (status == (I2C_SL_IRQ | RNW | RCVD)) {
-   udelay(33);
+   usleep_range(0, 33);


Why is this a valid range to sleep for for this device?  Have you been
able to verify/test this?


oh no, not again. Why does this come up again every half year? This udelay 
is a workaround for a hw bug which only seldom triggers (if it triggers at 
all). Secondly, this is in interrupt context, so *sleep timers are no go, 
afaik.


Marc

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


Re: [PATCH] staging: nvec: make use of devm_platform_ioremap_resource

2019-09-09 Thread Marc Dietrich

Hi Hariprased,

On Sun, 8 Sep 2019, hariprasad@MISSING_DOMAIN wrote:
 ^^
something is wrong with your git mail config...


From: Hariprasad Kelam 

fix below issue reported by coccicheck
drivers/staging//nvec/nvec.c:794:1-5: WARNING: Use
devm_platform_ioremap_resource for base

Signed-off-by: Hariprasad Kelam 


Acked-by: Marc Dietrich 

Thanks!

Marc


---
drivers/staging/nvec/nvec.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 1cbd7b7..360ec04 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -767,7 +767,6 @@ static int tegra_nvec_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct nvec_chip *nvec;
struct nvec_msg *msg;
-   struct resource *res;
void __iomem *base;
charget_firmware_version[] = { NVEC_CNTL, GET_FIRMWARE_VERSION },
unmute_speakers[] = { NVEC_OEM0, 0x10, 0x59, 0x95 },
@@ -790,8 +789,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
return -ENODEV;
}

-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   base = devm_ioremap_resource(dev, res);
+   base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);

--
2.7.4



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


Re: [PATCH v5 33/48] staging: nvec: Register with kernel power-off handler

2014-11-09 Thread Marc Dietrich
Am Donnerstag 06 November 2014, 08:43:17 schrieb Guenter Roeck:
> Register with kernel power-off handler instead of setting pm_power_off
> directly. Register with default priority since we don't know any better.
> 
> Cc: Julian Andres Klode 
> Cc: Marc Dietrich 
> Cc: Greg Kroah-Hartman 
> Acked-by: Greg Kroah-Hartman 
> Signed-off-by: Guenter Roeck 

> ---
> v5:
> - Rebase to v3.18-rc3
> v4:
> - Do not use notifiers but internal functions and data structures to manage
>   the list of power-off handlers. Drop unused parameters from callbacks, and
> make the power-off function type void
> v3:
> - Replace poweroff in all newly introduced variables and in text
>   with power_off or power-off as appropriate
> - Replace POWEROFF_PRIORITY_xxx with POWER_OFF_PRIORITY_xxx
> v2:
> - Use define to specify poweroff handler priority
> - Use dev_warn instead of dev_err
> 
>  drivers/staging/nvec/nvec.c | 21 -
>  drivers/staging/nvec/nvec.h |  2 ++
>  2 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index a93208a..acf2ea6 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -33,6 +33,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -80,8 +81,6 @@ enum nvec_sleep_subcmds {
>  #define LID_SWITCH BIT(1)
>  #define PWR_BUTTON BIT(15)
> 
> -static struct nvec_chip *nvec_power_handle;
> -
>  static const struct mfd_cell nvec_devices[] = {
>   {
>   .name = "nvec-kbd",
> @@ -759,12 +758,14 @@ static void nvec_disable_i2c_slave(struct nvec_chip
> *nvec) }
>  #endif
> 
> -static void nvec_power_off(void)
> +static void nvec_power_off(struct power_off_handler_block *this)
>  {
> + struct nvec_chip *nvec = container_of(this, struct nvec_chip,
> +   power_off_hb);
>   char ap_pwr_down[] = { NVEC_SLEEP, AP_PWR_DOWN };
> 
> - nvec_toggle_global_events(nvec_power_handle, false);
> - nvec_write_async(nvec_power_handle, ap_pwr_down, 2);
> + nvec_toggle_global_events(nvec, false);
> + nvec_write_async(nvec, ap_pwr_down, 2);
>  }
> 
>  /*
> @@ -878,8 +879,11 @@ static int tegra_nvec_probe(struct platform_device
> *pdev) nvec->nvec_status_notifier.notifier_call = nvec_status_notifier;
> nvec_register_notifier(nvec, &nvec->nvec_status_notifier, 0);
> 
> - nvec_power_handle = nvec;
> - pm_power_off = nvec_power_off;
> + nvec->power_off_hb.handler = nvec_power_off;
> + nvec->power_off_hb.priority = POWER_OFF_PRIORITY_DEFAULT;
> + ret = register_power_off_handler(&nvec->power_off_hb);
> + if (ret)
> + dev_warn(nvec->dev, "Failed to register power-off handler\n");
> 
>   /* Get Firmware Version */
>   msg = nvec_write_sync(nvec, get_firmware_version, 2);
> @@ -914,13 +918,12 @@ static int tegra_nvec_remove(struct platform_device
> *pdev) {
>   struct nvec_chip *nvec = platform_get_drvdata(pdev);
> 
> + unregister_power_off_handler(&nvec->power_off_hb);
>   nvec_toggle_global_events(nvec, false);
>   mfd_remove_devices(nvec->dev);
>   nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier);
>   cancel_work_sync(&nvec->rx_work);
>   cancel_work_sync(&nvec->tx_work);
> - /* FIXME: needs check wether nvec is responsible for power off */
> - pm_power_off = NULL;
> 
>   return 0;
>  }
> diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
> index e271375..d4145da 100644
> --- a/drivers/staging/nvec/nvec.h
> +++ b/drivers/staging/nvec/nvec.h
> @@ -163,6 +163,8 @@ struct nvec_chip {
>   struct nvec_msg *last_sync_msg;
> 
>   int state;
> +
> + struct power_off_handler_block power_off_hb;
>  };
> 
>  extern int nvec_write_async(struct nvec_chip *nvec, const unsigned char
> *data,

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


Re: [PATCH] staging: nvec: Fix incorrect type of i2c address

2017-02-14 Thread Marc Dietrich
Am Montag, 13. Februar 2017, 09:35:19 CET schrieb Franck Demathieu:
> From: Franck Demathieu 
> 
> The i2c address is unsigned according to the dt-bindings.
> Fix sparse issue (-Wtypesign):
> 
>   drivers/staging/nvec/nvec.c:781:35: warning: incorrect type in argument 3
> (different signedness) drivers/staging/nvec/nvec.c:781:35:expected
> unsigned int [usertype] *out_value drivers/staging/nvec/nvec.c:781:35:   
> got int *
> 
> Signed-off-by: Franck Demathieu 

looks correct. Thanks!

Acked-by: Marc Dietrich 

> ---
>  drivers/staging/nvec/nvec.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
> index c03ca8d..aa7c70e 100644
> --- a/drivers/staging/nvec/nvec.h
> +++ b/drivers/staging/nvec/nvec.h
> @@ -138,7 +138,7 @@ struct nvec_chip {
>   struct device *dev;
>   int gpio;
>   int irq;
> - int i2c_addr;
> + u32 i2c_addr;
>   void __iomem *base;
>   struct clk *i2c_clk;
>   struct reset_control *rst;



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:nvec:nvec_ps2.c: Preferingkzalloc(sizeof(*ser_dev)...) over kzalloc(sizeof(struct serio)...)

2017-02-15 Thread Marc Dietrich
Am Dienstag, 14. Februar 2017, 22:31:20 CET schrieb Arushi Singhal:
> Prefer kzalloc(sizeof(*ser_dev)...) over kzalloc(sizeof(struct
> serio)...) as reported by checkpatch.pl.
> 
> Signed-off-by: Arushi Singhal 

looks like we are in a (make everyone) happy week.

Acked-by: Marc Dietrich 


> ---
>  drivers/staging/nvec/nvec_ps2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/nvec/nvec_ps2.c
> b/drivers/staging/nvec/nvec_ps2.c index 499952c8ef39..3b7bce3ffd19 100644
> --- a/drivers/staging/nvec/nvec_ps2.c
> +++ b/drivers/staging/nvec/nvec_ps2.c
> @@ -107,7 +107,7 @@ static int nvec_mouse_probe(struct platform_device
> *pdev) struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
>   struct serio *ser_dev;
> 
> - ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL);
> + ser_dev = kzalloc(sizeof(*ser_dev), GFP_KERNEL);
>   if (!ser_dev)
>   return -ENOMEM;



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Outreachy kernel] [PATCH] staging: nvec: cleanup USLEEP_RANGEcheckpatch checks

2017-03-02 Thread Marc Dietrich
Hi Simran,

Am Donnerstag, 2. März 2017, 15:48:13 CET schrieb SIMRAN SINGHAL:
> On Thursday, March 2, 2017 at 8:06:40 PM UTC+5:30, Julia Lawall wrote:
> > On Thu, 2 Mar 2017, simran singhal wrote:
> > > Resolve strict checkpatch USLEEP_RANGE checks by converting delays and
> > > sleeps as described in ./Documentation/timers/timers-howto.txt.
> > > 
> > > CHECK: usleep_range is preferred over udelay; see Documentation/
> > > timers/timers-howto.txt
> > > 
> > > Signed-off-by: simran singhal >

I prefer not to change this. The whole interrupt routine is very wonky, and 
changing some delays might break the communication with the i2c master. Also 
this is in interrupt context, so a change to usleep_range may not by 
justified.

Marc



> > > ---
> > > 
> > >  drivers/staging/nvec/nvec.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> > > index c1feccf..cd35e64 100644
> > > --- a/drivers/staging/nvec/nvec.c
> > > +++ b/drivers/staging/nvec/nvec.c
> > > @@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void
> > 
> > *dev)
> > 
> > >  break;
> > >  
> > >  case 2:/* first byte after command */
> > >  
> > >  if (status == (I2C_SL_IRQ | RNW | RCVD)) {
> > > 
> > > -udelay(33);
> > > +usleep_range(33, 100);
> > 
> > How did you choose the upper limit.
> > 
> > I believe that Greg previously suggested not to make these changes if you
> > have no way to test them.
> > 
> > Julia, After going through the reply given by Nicholas Mc Guire
> 
> https://www.mail-archive.com/kernelnewbies@kernelnewbies.org/msg16464.html
> in this reply he has mentioned that even the range of 10 microsecond is
> enough,
> so I prefer to take 100 as upper limit.
> 
> Simran
> 
> julia
> 
> > >  if (nvec->rx->data[0] != 0x01) {
> > >  
> > >  dev_err(nvec->dev,
> > >  
> > >  "Read without prior read
> > 
> > command\n");
> > 
> > > @@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void
> > 
> > *dev)
> > 
> > >   * We experience less incomplete messages with this delay than
> > 
> > without
> > 
> > >   * it, but we don't know why. Help is appreciated.
> > >   */
> > > 
> > > -udelay(100);
> > > +usleep_range(100, 200);
> > > 
> > >  return IRQ_HANDLED;
> > >  
> > >  }
> > 
> > Groups "outreachy-kernel" group.
> > 
> > > To unsubscribe from this group and stop receiving emails from it, send
> > 
> > an email to outreachy-kern...@googlegroups.com .
> > 
> > > To post to this group, send email to outreach...@googlegroups.com
> > 
> > .
> > 
> > > To view this discussion on the web visit
> > 
> > https://groups.google.com/d/msgid/outreachy-kernel/20170302142418.GA16773%
> > 40singhal-Inspiron-5558.> 
> > > For more options, visit https://groups.google.com/d/optout.



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: nvec: cleanup use of dev in probe function

2018-04-19 Thread Marc Dietrich
This cleanups the probe function a bit by using a dev variable instead
of &pdev-dev.

Signed-off-by: Marc Dietrich 
---
 drivers/staging/nvec/nvec.c | 35 ++-
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 52054a528723..599b01f2ad58 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -786,6 +786,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
 {
int err, ret;
struct clk *i2c_clk;
+   struct device *dev = &pdev->dev;
struct nvec_chip *nvec;
struct nvec_msg *msg;
struct resource *res;
@@ -794,42 +795,42 @@ static int tegra_nvec_probe(struct platform_device *pdev)
unmute_speakers[] = { NVEC_OEM0, 0x10, 0x59, 0x95 },
enable_event[7] = { NVEC_SYS, CNF_EVENT_REPORTING, true };
 
-   if (!pdev->dev.of_node) {
-   dev_err(&pdev->dev, "must be instantiated using device tree\n");
+   if (!dev->of_node) {
+   dev_err(dev, "must be instantiated using device tree\n");
return -ENODEV;
}
 
-   nvec = devm_kzalloc(&pdev->dev, sizeof(struct nvec_chip), GFP_KERNEL);
+   nvec = devm_kzalloc(dev, sizeof(struct nvec_chip), GFP_KERNEL);
if (!nvec)
return -ENOMEM;
 
platform_set_drvdata(pdev, nvec);
-   nvec->dev = &pdev->dev;
+   nvec->dev = dev;
 
err = nvec_i2c_parse_dt_pdata(nvec);
if (err < 0)
return err;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   base = devm_ioremap_resource(&pdev->dev, res);
+   base = devm_ioremap_resource(dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
 
nvec->irq = platform_get_irq(pdev, 0);
if (nvec->irq < 0) {
-   dev_err(&pdev->dev, "no irq resource?\n");
+   dev_err(dev, "no irq resource?\n");
return -ENODEV;
}
 
-   i2c_clk = devm_clk_get(&pdev->dev, "div-clk");
+   i2c_clk = devm_clk_get(dev, "div-clk");
if (IS_ERR(i2c_clk)) {
-   dev_err(nvec->dev, "failed to get controller clock\n");
+   dev_err(dev, "failed to get controller clock\n");
return -ENODEV;
}
 
-   nvec->rst = devm_reset_control_get_exclusive(&pdev->dev, "i2c");
+   nvec->rst = devm_reset_control_get_exclusive(dev, "i2c");
if (IS_ERR(nvec->rst)) {
-   dev_err(nvec->dev, "failed to get controller reset\n");
+   dev_err(dev, "failed to get controller reset\n");
return PTR_ERR(nvec->rst);
}
 
@@ -849,17 +850,17 @@ static int tegra_nvec_probe(struct platform_device *pdev)
INIT_WORK(&nvec->rx_work, nvec_dispatch);
INIT_WORK(&nvec->tx_work, nvec_request_master);
 
-   err = devm_gpio_request_one(&pdev->dev, nvec->gpio, GPIOF_OUT_INIT_HIGH,
+   err = devm_gpio_request_one(dev, nvec->gpio, GPIOF_OUT_INIT_HIGH,
"nvec gpio");
if (err < 0) {
-   dev_err(nvec->dev, "couldn't request gpio\n");
+   dev_err(dev, "couldn't request gpio\n");
return -ENODEV;
}
 
-   err = devm_request_irq(&pdev->dev, nvec->irq, nvec_interrupt, 0,
+   err = devm_request_irq(dev, nvec->irq, nvec_interrupt, 0,
   "nvec", nvec);
if (err) {
-   dev_err(nvec->dev, "couldn't request irq\n");
+   dev_err(dev, "couldn't request irq\n");
return -ENODEV;
}
disable_irq(nvec->irq);
@@ -879,7 +880,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
err = nvec_write_sync(nvec, get_firmware_version, 2, &msg);
 
if (!err) {
-   dev_warn(nvec->dev,
+   dev_warn(dev,
 "ec firmware version %02x.%02x.%02x / %02x\n",
 msg->data[4], msg->data[5],
 msg->data[6], msg->data[7]);
@@ -887,10 +888,10 @@ static int tegra_nvec_probe(struct platform_device *pdev)
nvec_msg_free(nvec, msg);
}
 
-   ret = mfd_add_devices(nvec->dev, 0, nvec_devices,
+   ret = mfd_add_devices(dev, 0, nvec_devices,
  ARRAY_SIZE(nvec_devices), NULL, 0, NULL);
if (ret)
-   dev_err(nvec->dev, "error adding subdevices\n");
+   dev_err(dev, "error adding subdevices\n");
 
/* unmute speakers? */
nvec_write_async(nvec, unmute_speakers, 4);
-- 
2.17.0

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


[PATCH 2/2] staging: nvec: convert to use GPIO descriptors

2018-04-19 Thread Marc Dietrich
Use GPIO descriptors instead of relying on the old method.

Cc: Linus Walleij 
Signed-off-by: Marc Dietrich 
---
This obsolets the ToDo reminder sent by Linus a few hours ago.
---
 drivers/staging/nvec/nvec.c | 42 +
 drivers/staging/nvec/nvec.h |  2 +-
 2 files changed, 11 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 599b01f2ad58..5a3a621bb84b 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -17,12 +17,11 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -236,8 +235,8 @@ static size_t nvec_msg_size(struct nvec_msg *msg)
 static void nvec_gpio_set_value(struct nvec_chip *nvec, int value)
 {
dev_dbg(nvec->dev, "GPIO changed from %u to %u\n",
-   gpio_get_value(nvec->gpio), value);
-   gpio_set_value(nvec->gpio, value);
+   gpiod_get_value(nvec->gpiod), value);
+   gpiod_set_value(nvec->gpiod, value);
 }
 
 /**
@@ -761,27 +760,6 @@ static void nvec_power_off(void)
nvec_write_async(nvec_power_handle, ap_pwr_down, 2);
 }
 
-/*
- *  Parse common device tree data
- */
-static int nvec_i2c_parse_dt_pdata(struct nvec_chip *nvec)
-{
-   nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios", 0);
-
-   if (nvec->gpio < 0) {
-   dev_err(nvec->dev, "no gpio specified");
-   return -ENODEV;
-   }
-
-   if (of_property_read_u32(nvec->dev->of_node, "slave-addr",
-&nvec->i2c_addr)) {
-   dev_err(nvec->dev, "no i2c address specified");
-   return -ENODEV;
-   }
-
-   return 0;
-}
-
 static int tegra_nvec_probe(struct platform_device *pdev)
 {
int err, ret;
@@ -807,9 +785,10 @@ static int tegra_nvec_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, nvec);
nvec->dev = dev;
 
-   err = nvec_i2c_parse_dt_pdata(nvec);
-   if (err < 0)
-   return err;
+   if (of_property_read_u32(dev->of_node, "slave-addr", &nvec->i2c_addr)) {
+   dev_err(dev, "no i2c address specified");
+   return -ENODEV;
+   }
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(dev, res);
@@ -850,11 +829,10 @@ static int tegra_nvec_probe(struct platform_device *pdev)
INIT_WORK(&nvec->rx_work, nvec_dispatch);
INIT_WORK(&nvec->tx_work, nvec_request_master);
 
-   err = devm_gpio_request_one(dev, nvec->gpio, GPIOF_OUT_INIT_HIGH,
-   "nvec gpio");
-   if (err < 0) {
+   nvec->gpiod = devm_gpiod_get(dev, "request", GPIOD_OUT_HIGH);
+   if (IS_ERR(nvec->gpiod)) {
dev_err(dev, "couldn't request gpio\n");
-   return -ENODEV;
+   return PTR_ERR(nvec->gpiod);
}
 
err = devm_request_irq(dev, nvec->irq, nvec_interrupt, 0,
diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
index 25efcdfa4f20..80c0353f141c 100644
--- a/drivers/staging/nvec/nvec.h
+++ b/drivers/staging/nvec/nvec.h
@@ -132,7 +132,7 @@ struct nvec_msg {
  */
 struct nvec_chip {
struct device *dev;
-   int gpio;
+   struct gpio_desc *gpiod;
int irq;
u32 i2c_addr;
void __iomem *base;
-- 
2.17.0

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


Re: [PATCH 7/9] staging: nvec: Augment TODO file with GPIO work item

2018-04-19 Thread Marc Dietrich
Hi Linus,

Am Donnerstag, 19. April 2018, 10:41:19 CEST schrieb Linus Walleij:
> To make sure that this driver does not leave staging before it
> is properly converted to use the new GPIO descriptor API,
> augment the TODO file with this work item.

I just sent a patch to convert it. Thanks for the reminder!

Marc

> 
> Cc: Marc Dietrich 
> Signed-off-by: Linus Walleij 
> ---
>  drivers/staging/nvec/TODO | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/staging/nvec/TODO b/drivers/staging/nvec/TODO
> index e4d85d9b4681..78b84c243df4 100644
> --- a/drivers/staging/nvec/TODO
> +++ b/drivers/staging/nvec/TODO
> @@ -4,3 +4,8 @@ ToDo list (incomplete, unordered)
>   - move event handling to nvec_events
>   - finish suspend/resume support
>   - add support for more device implementations
> + - convert all uses of the old GPIO API from  to the
> +   GPIO descriptor API in  and look up GPIO
> +   line descriptor from device tree, ACPI or board files
> + - drop the dependency on  altogether when migrating
> +   to GPIO descriptors




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


Re: [PATCH 49/61] staging: nvec: simplify getting .drvdata

2018-04-20 Thread Marc Dietrich
Am Donnerstag, 19. April 2018, 16:06:19 CEST schrieb Wolfram Sang:
> We should get drvdata from struct device directly. Going via
> platform_device is an unneeded step back and forth.
> 
> Signed-off-by: Wolfram Sang 

Acked-by: Marc Dietrich 

> ---
> 
> Build tested only. buildbot is happy. Please apply individually.
> 
>  drivers/staging/nvec/nvec.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 52054a528723..2a5e0dcf4162 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -925,8 +925,7 @@ static int tegra_nvec_remove(struct platform_device
> *pdev) static int nvec_suspend(struct device *dev)
>  {
>   int err;
> - struct platform_device *pdev = to_platform_device(dev);
> - struct nvec_chip *nvec = platform_get_drvdata(pdev);
> + struct nvec_chip *nvec = dev_get_drvdata(dev);
>   struct nvec_msg *msg;
>   char ap_suspend[] = { NVEC_SLEEP, AP_SUSPEND };
> 
> @@ -946,8 +945,7 @@ static int nvec_suspend(struct device *dev)
> 
>  static int nvec_resume(struct device *dev)
>  {
> - struct platform_device *pdev = to_platform_device(dev);
> - struct nvec_chip *nvec = platform_get_drvdata(pdev);
> + struct nvec_chip *nvec = dev_get_drvdata(dev);
> 
>   dev_dbg(nvec->dev, "resuming\n");
>   tegra_init_i2c_slave(nvec);




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


[PATCH] Revert "staging: nvec: Augment TODO file with GPIO work item"

2018-04-23 Thread Marc Dietrich
This reverts commit 5a3e59ce3acf2f52c8b4a6fc656c3b1e4a329f06, because the
necessary changes were applied in the "staging: nvec: convert to use GPIO
descriptors" patch.

Signed-off-by: Marc Dietrich 
---
 drivers/staging/nvec/TODO | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/nvec/TODO b/drivers/staging/nvec/TODO
index 78b84c243df4..e4d85d9b4681 100644
--- a/drivers/staging/nvec/TODO
+++ b/drivers/staging/nvec/TODO
@@ -4,8 +4,3 @@ ToDo list (incomplete, unordered)
- move event handling to nvec_events
- finish suspend/resume support
- add support for more device implementations
-   - convert all uses of the old GPIO API from  to the
- GPIO descriptor API in  and look up GPIO
- line descriptor from device tree, ACPI or board files
-   - drop the dependency on  altogether when migrating
- to GPIO descriptors
-- 
2.17.0

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


Re: [PATCH] staging:nvec:nvec - Fix for typo in comment to function tegra_nvec_remove().

2015-05-26 Thread Marc Dietrich
Hi Shailendra,

you should fill the patch description with something, even if trivial, and 
trim the subject line a bit, e.g.

---
staging: nvec: fix typo in comment (all lowercase, no full stop at the end)

Fix spelling error in comment in function tegra_nvec_remove.

S-o-b
-

Thanks,

Marc

Am Dienstag, 26. Mai 2015, 02:16:41 schrieb Shailendra Verma:
> Signed-off-by: Shailendra Verma 
> ---
>  drivers/staging/nvec/nvec.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 1bdc8d0..164634d 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -916,7 +916,7 @@ static int tegra_nvec_remove(struct platform_device
> *pdev) nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier);
>   cancel_work_sync(&nvec->rx_work);
>   cancel_work_sync(&nvec->tx_work);
> - /* FIXME: needs check wether nvec is responsible for power off */
> + /* FIXME: needs check whether nvec is responsible for power off */
>   pm_power_off = NULL;
> 
>   return 0;


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:nvec: fix typo in comment

2015-05-27 Thread Marc Dietrich
Am Mittwoch, 27. Mai 2015, 07:00:54 schrieb Shailendra Verma:
> Fix spelling error in comment in function tegra_nvec_remove.
> 
> Signed-off-by: Shailendra Verma 

Acked-by: Marc Dietrich 

> ---
>  drivers/staging/nvec/nvec.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 1bdc8d0..164634d 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -916,7 +916,7 @@ static int tegra_nvec_remove(struct platform_device
> *pdev) nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier);
>   cancel_work_sync(&nvec->rx_work);
>   cancel_work_sync(&nvec->tx_work);
> - /* FIXME: needs check wether nvec is responsible for power off */
> + /* FIXME: needs check whether nvec is responsible for power off */
>   pm_power_off = NULL;
> 
>   return 0;


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] staging: nvec: check return value

2019-12-19 Thread Marc Dietrich

Hello Xidong,

On Wed, 18 Dec 2019, Xidong Wang wrote:


In nvec_kbd_probe(), the return value of devm_input_allocate_device()
should be checked before it is used.

Signed-off-by: Xidong Wang 


looks good to me. Thanks!

Acked-by: Marc Dietrich 


---
drivers/staging/nvec/nvec_kbd.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c
index 01dbb66..386d619 100644
--- a/drivers/staging/nvec/nvec_kbd.c
+++ b/drivers/staging/nvec/nvec_kbd.c
@@ -123,6 +123,8 @@ static int nvec_kbd_probe(struct platform_device *pdev)
keycodes[j++] = extcode_tab_us102[i];

idev = devm_input_allocate_device(&pdev->dev);
+   if (!idev)
+   return -ENOMEM;
idev->name = "nvec keyboard";
idev->phys = "nvec";
idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | BIT_MASK(EV_LED);
--
2.7.4



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


Re: [PATCH] staging: nvec: fix block comments

2015-12-14 Thread Marc Dietrich
Hi Simon,

Am Mittwoch, 9. Dezember 2015, 08:14:06 schrieb Simon Guinot:
> This patch fixes a couple of checkpatch warnings about block comments.
> 
> Signed-off-by: Simon Guinot 
> ---
>  drivers/staging/nvec/nvec.c   |  6 --
>  drivers/staging/nvec/nvec_power.c | 14 +-
>  2 files changed, 13 insertions(+), 7 deletions(-)

there was a similar patch from Sakshi Bansal [1] (cc'd) a while ago which also 
fixed a few other stuff. But it had a small bug inside so it wasn't applied. 
Up to now, Sakshi didn't sent a corrected version yet, but I want to give him 
some more time - *ping Sakshi ping* !
 
If there is no reply, I will send a corrected version of his patch with proper 
credits.

Thanks!

Marc

[1] https://lkml.org/lkml/2015/10/14/516


> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 802c9597d421..cb0927ddd78f 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -508,8 +508,10 @@ static void nvec_rx_completed(struct nvec_chip *nvec)
> 
>   spin_lock(&nvec->rx_lock);
> 
> - /* add the received data to the work list
> -and move the ring buffer pointer to the next entry */
> + /*
> +  * Add the received data to the work list and move the ring buffer
> +  * pointer to the next entry.
> +  */
>   list_add_tail(&nvec->rx->node, &nvec->rx_data);
> 
>   spin_unlock(&nvec->rx_lock);
> diff --git a/drivers/staging/nvec/nvec_power.c
> b/drivers/staging/nvec/nvec_power.c index 04a7402ae2df..b4a0545e8806 100644
> --- a/drivers/staging/nvec/nvec_power.c
> +++ b/drivers/staging/nvec/nvec_power.c
> @@ -207,8 +207,10 @@ static int nvec_power_bat_notifier(struct
> notifier_block *nb, case TYPE:
>   memcpy(power->bat_type, &res->plc, res->length - 2);
>   power->bat_type[res->length - 2] = '\0';
> - /* this differs a little from the spec
> -fill in more if you find some */
> + /*
> +  * This differs a little from the spec fill in more if you find
> +  * some.
> +  */
>   if (!strncmp(power->bat_type, "Li", 30))
>   power->bat_type_enum = POWER_SUPPLY_TECHNOLOGY_LION;
>   else
> @@ -356,12 +358,14 @@ static void nvec_power_poll(struct work_struct *work)
>   if (counter >= ARRAY_SIZE(bat_iter))
>   counter = 0;
> 
> -/* AC status via sys req */
> + /* AC status via sys req */
>   nvec_write_async(power->nvec, buf, 2);
>   msleep(100);
> 
> -/* select a battery request function via round robin
> -   doing it all at once seems to overload the power supply */
> + /*
> +  * Select a battery request function via round robin doing it all at
> +  * once seems to overload the power supply.
> +  */
>   buf[0] = NVEC_BAT;
>   buf[1] = bat_iter[counter++];
>   nvec_write_async(power->nvec, buf, 2);


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: nvec: replace led_classdev_register

2016-01-25 Thread Marc Dietrich
Am Donnerstag 21 Januar 2016, 10:23:46 schrieb Gujulan Elango, Hari Prasath:
> From: Hari Prasath Gujulan Elango 
> 
> Replace the led_classdev_register() with the platform managed version
> devm_led_classdev_register() & henceforth remove the redundant
> nvec_paz00_remove() function.
> 
> Signed-off-by: Hari Prasath Gujulan Elango 

Thanks!

Acked-by: Marc Dietrich 

> ---
>  drivers/staging/nvec/nvec_paz00.c | 12 +---
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec_paz00.c
> b/drivers/staging/nvec/nvec_paz00.c index 68146bf..cddbfd2 100644
> --- a/drivers/staging/nvec/nvec_paz00.c
> +++ b/drivers/staging/nvec/nvec_paz00.c
> @@ -63,7 +63,7 @@ static int nvec_paz00_probe(struct platform_device *pdev)
> 
>   platform_set_drvdata(pdev, led);
> 
> - ret = led_classdev_register(&pdev->dev, &led->cdev);
> + ret = devm_led_classdev_register(&pdev->dev, &led->cdev);
>   if (ret < 0)
>   return ret;
> 
> @@ -73,18 +73,8 @@ static int nvec_paz00_probe(struct platform_device *pdev)
> return 0;
>  }
> 
> -static int nvec_paz00_remove(struct platform_device *pdev)
> -{
> - struct nvec_led *led = platform_get_drvdata(pdev);
> -
> - led_classdev_unregister(&led->cdev);
> -
> - return 0;
> -}
> -
>  static struct platform_driver nvec_paz00_driver = {
>   .probe  = nvec_paz00_probe,
> - .remove = nvec_paz00_remove,
>   .driver = {
>   .name  = "nvec-paz00",
>   },


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: nvec: Avoid the use of BUG_ON

2016-02-24 Thread Marc Dietrich
Am Dienstag, 23. Februar 2016, 21:59:04 CET schrieb Laura Garcia Liebana:
> Prevent a kernel panic by avoiding the use of the BUG_ON macro.
> Checkpatch detected this issue.
> 
> Signed-off-by: Laura Garcia Liebana 

Acked-by: Marc Dietrich 

> ---
> Changes in v2:
>   - According to Marc Dietrich, module creator, the WARN_ON macro is not
> needed as such cases shouldn't happen and they were introduced for
> debugging purposes.
> 
>  drivers/staging/nvec/nvec.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index c335ae2..f6a1dbb 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -641,11 +641,9 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
>   nvec_msg_free(nvec, nvec->rx);
>   nvec->state = 3;
>   nvec_tx_set(nvec);
> - BUG_ON(nvec->tx->size < 1);
>   to_send = nvec->tx->data[0];
>   nvec->tx->pos = 1;
>   } else if (status == (I2C_SL_IRQ)) {
> - BUG_ON(nvec->rx == NULL);
>   nvec->rx->data[1] = received;
>   nvec->rx->pos = 2;
>   nvec->state = 4;



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: nvec: Fixed 12 code style checks and changed udelay() to usleep_range() on 2 lines

2016-02-29 Thread Marc Dietrich
Hi Parth,

please also cc de...@linuxdriverproject.org next time.

Some comments below.

Am Freitag, 26. Februar 2016, 15:24:21 CET schrieb Parth Sane:
> 1)Null comparison
> 2)Extra Line after curly braces
> 3)Changed udelay to udelay_range
> 4)BUG_ON to WARN_ON to avoid crashing kernel
> 5)Removed copyright notice as recommended by checkpatch script
> 
> Signed-off-by: Parth Sane 
> ---
>  drivers/staging/nvec/nvec-keytable.h | 13 -
>  drivers/staging/nvec/nvec.c  | 18 +-
>  drivers/staging/nvec/nvec_paz00.c|  1 -
>  3 files changed, 9 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec-keytable.h
> b/drivers/staging/nvec/nvec-keytable.h index 1dc22cb..9f369d5 100644
> --- a/drivers/staging/nvec/nvec-keytable.h
> +++ b/drivers/staging/nvec/nvec-keytable.h
> @@ -6,19 +6,6 @@
>   *
>   * Copyright (c) 2009, NVIDIA Corporation.
>   *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful, but
> WITHOUT - * ANY WARRANTY; without even the implied warranty of
> MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> General Public License for - * more details.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, write to the Free Software Foundation, Inc.,
> - * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
>   */
> 
>  static unsigned short code_tab_102us[] = {
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index c335ae2..03dbc09 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -1,4 +1,4 @@
> -/*
> +2/*

stray "2"

>   * NVEC: NVIDIA compliant embedded controller interface
>   *
>   * Copyright (C) 2011 The AC100 Kernel Team 
> @@ -264,7 +264,7 @@ int nvec_write_async(struct nvec_chip *nvec, const
> unsigned char *data,
> 
>   msg = nvec_msg_alloc(nvec, NVEC_MSG_TX);
> 
> - if (msg == NULL)
> + if (!msg)
>   return -ENOMEM;
> 
>   msg->data[0] = size;
> @@ -620,7 +620,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
>   } else {I had sent a patch for the staging nvec driver. It had 
> some 
checkpatch 

>   nvec->rx = nvec_msg_alloc(nvec, NVEC_MSG_RX);
>   /* Should not happen in a normal world */
> - if (unlikely(nvec->rx == NULL)) {
> + if (unlikely(!nvec->rx)) {
>   nvec->state = 0;
>   break;
>   }
> @@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
>   break;
>   case 2: /* first byte after command */
>   if (status == (I2C_SL_IRQ | RNW | RCVD)) {
> - udelay(33);
> + usleep_range(32, 33);
>   if (nvec->rx->data[0] != 0x01) {
>   dev_err(nvec->dev,
>   "Read without prior read command\n");
> @@ -641,11 +641,11 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
>   nvec_msg_free(nvec, nvec->rx);
>   nvec->state = 3;
>   nvec_tx_set(nvec);
> - BUG_ON(nvec->tx->size < 1);
> + WARN_ON(nvec->tx->size < 1);
>   to_send = nvec->tx->data[0];
>   nvec->tx->pos = 1;
>   } else if (status == (I2C_SL_IRQ)) {
> - BUG_ON(nvec->rx == NULL);
> + WARN_ON(!nvec->rx);
>   nvec->rx->data[1] = received;
>   nvec->rx->pos = 2;
>   nvec->state = 4;


Laura Garcia Liebana  sent a a fix for this a few days ago. 
So please remove this hunk.

> @@ -663,8 +663,8 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
>   } else {
>   dev_err(nvec->dev, "tx buffer underflow on %p (%u > 
> %u)\n",
>   nvec->tx,
> - (uint) (nvec->tx ? nvec->tx->pos : 0),
> - (uint) (nvec->tx ? nvec->tx->size : 0));
> + (uint)(nvec->tx ? nvec->tx->pos : 0),
> + (uint)(nvec->tx ? nvec->tx->size : 0));
>   nvec->state = 0;
>   }
>   break;
> @@ -719,7 +719,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
>* We experience less incomplete messages with this delay than without
>* it, but we don't know why. Help is appreciated.
>*/
> - udelay(100);
> + usleep_range(99, 100);

Re: [PATCH] staging: nvec: Fixed 12 code style checks and changed udelay() to usleep_range() on 2 lines

2016-02-29 Thread Marc Dietrich
Hi,

Am Montag, 29. Februar 2016, 17:21:14 CET schrieb Parth Sane:
> Hi,
> As per the previous email, I understand that some patches were
> unnecessary(For example the fix for the spaces ).

not sure what you mean here. I was referring to the BUG_ON removal not the 
space changes.

It's common (or better a rule) on linux mailing lists to add comments below 
the concerning block. Top-posts (putting comments or replies on top of 
concerning block) are disliked.

See: http://kernelnewbies.org/mailinglistguidelines


> But it was a bit
> confusing. Can someone please let me know which patches are needed and
> which are not? 

you should not send patches which others already did.

Marc

> > On 29-Feb-2016, at 5:00 PM, Marc Dietrich  wrote:
> > 
> > Hi Parth,
> > 
> > please also cc de...@linuxdriverproject.org next time.
> > 
> > Some comments below.
> > 
> > Am Freitag, 26. Februar 2016, 15:24:21 CET schrieb Parth Sane:
> >> 1)Null comparison
> >> 2)Extra Line after curly braces
> >> 3)Changed udelay to udelay_range
> >> 4)BUG_ON to WARN_ON to avoid crashing kernel
> >> 5)Removed copyright notice as recommended by checkpatch script
> >> 
> >> Signed-off-by: Parth Sane 
> >> ---
> >> drivers/staging/nvec/nvec-keytable.h | 13 -
> >> drivers/staging/nvec/nvec.c  | 18 +-
> >> drivers/staging/nvec/nvec_paz00.c|  1 -
> >> 3 files changed, 9 insertions(+), 23 deletions(-)
> >> 
> >> diff --git a/drivers/staging/nvec/nvec-keytable.h
> >> b/drivers/staging/nvec/nvec-keytable.h index 1dc22cb..9f369d5 100644
> >> --- a/drivers/staging/nvec/nvec-keytable.h
> >> +++ b/drivers/staging/nvec/nvec-keytable.h
> >> @@ -6,19 +6,6 @@
> >> 
> >>  *
> >>  * Copyright (c) 2009, NVIDIA Corporation.
> >>  *
> >> 
> >> - * This program is free software; you can redistribute it and/or modify
> >> - * it under the terms of the GNU General Public License as published by
> >> - * the Free Software Foundation; either version 2 of the License, or
> >> - * (at your option) any later version.
> >> - *
> >> - * This program is distributed in the hope that it will be useful, but
> >> WITHOUT - * ANY WARRANTY; without even the implied warranty of
> >> MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> >> General Public License for - * more details.
> >> - *
> >> - * You should have received a copy of the GNU General Public License
> >> along
> >> - * with this program; if not, write to the Free Software Foundation,
> >> Inc.,
> >> - * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
> >> 
> >>  */
> >> 
> >> static unsigned short code_tab_102us[] = {
> >> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> >> index c335ae2..03dbc09 100644
> >> --- a/drivers/staging/nvec/nvec.c
> >> +++ b/drivers/staging/nvec/nvec.c
> >> @@ -1,4 +1,4 @@
> >> -/*
> >> +2/*
> > 
> > stray "2"
> > 
> >>  * NVEC: NVIDIA compliant embedded controller interface
> >>  *
> >>  * Copyright (C) 2011 The AC100 Kernel Team 
> >> 
> >> @@ -264,7 +264,7 @@ int nvec_write_async(struct nvec_chip *nvec, const
> >> unsigned char *data,
> >> 
> >>msg = nvec_msg_alloc(nvec, NVEC_MSG_TX);
> >> 
> >> -  if (msg == NULL)
> >> +  if (!msg)
> >> 
> >>return -ENOMEM;
> >>
> >>msg->data[0] = size;
> >> 
> >> @@ -620,7 +620,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
> >> 
> >>} else {I had sent a patch for the staging nvec driver. It had 
> >> some
> > 
> > checkpatch
> > 
> >>nvec->rx = nvec_msg_alloc(nvec, NVEC_MSG_RX);
> >>/* Should not happen in a normal world */
> >> 
> >> -  if (unlikely(nvec->rx == NULL)) {
> >> +  if (unlikely(!nvec->rx)) {
> >> 
> >>nvec->state = 0;
> >>break;
> >>
> >>}
> >> 
> >> @@ -631,7 +631,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
> >> 
> >>break;
> >>
> >>case 2: /* first byte after command */
> >>

Re: [PATCH] staging: nvec: remove duplicated const

2015-06-17 Thread Marc Dietrich
Am Dienstag, 16. Juni 2015, 23:13:21 schrieb Peng Fan:
> Sparse checking warning:
> "drivers/staging/nvec/nvec_ps2.c:172:14: warning: duplicate const".
> Remove the duplicated const to fix the warning.
> 
> Signed-off-by: Peng Fan 

Thanks!

Acked-by: Marc Dietrich 

> ---
>  drivers/staging/nvec/nvec_ps2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec_ps2.c
> b/drivers/staging/nvec/nvec_ps2.c index 6ebbc82..0922dd3 100644
> --- a/drivers/staging/nvec/nvec_ps2.c
> +++ b/drivers/staging/nvec/nvec_ps2.c
> @@ -169,8 +169,8 @@ static int nvec_mouse_resume(struct device *dev)
>  }
>  #endif
> 
> -static const SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend,
> - nvec_mouse_resume);
> +static SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend,
> +  nvec_mouse_resume);
> 
>  static struct platform_driver nvec_mouse_driver = {
>   .probe  = nvec_mouse_probe,


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 4/4] dt: paz00: define nvec as child of i2c bus

2015-07-21 Thread Marc Dietrich
Am Dienstag, 21. Juli 2015, 09:35:21 schrieb Andrey Danin:
> On 21.07.2015 1:19, Stephen Warren wrote:
> > On 07/20/2015 02:35 PM, Andrey Danin wrote:
> >> NVEC driver was reimplemented to use tegra i2c. Use common i2c bindings
> >> for NVEC node.
> >> 
> >> diff --git a/arch/arm/boot/dts/tegra20-paz00.dts
> >> b/arch/arm/boot/dts/tegra20-paz00.dts
> >> 
> >> +nvec: nvec@45 {
> >> +compatible = "nvidia,nvec-slave";
> >> +reg = <0x45>;
> > 
> > I think you need to or in I2C_OWN_SLAVE_ADDRESS from
> >  here?
> 
> Sorry, I mentioned it in letter 0 only.
> I will rework nvec driver and device tree according to i2c core slave
> implementation later. v3 of this patchset is for fixing tegra i2c driver
> only.

I think in this case it would be better to leave nvec and dt as it is for now, 
and just add the slave function to tegra-i2c. Otherwise we will again have two 
different "nvidia,nvec-slave" bindings (one for the intermediate hack and one 
for the final representation). As an alternative, you could also add slave 
function and port nvec in the same series.

Marc


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 4/4] dt: paz00: define nvec as child of i2c bus

2015-07-21 Thread Marc Dietrich
Am Dienstag, 21. Juli 2015, 11:51:15 schrieb Andrey Danin:
> On 21.07.2015 11:25, Marc Dietrich wrote:
> > I think in this case it would be better to leave nvec and dt as it is for
> > now, and just add the slave function to tegra-i2c. Otherwise we will
> > again have two different "nvidia,nvec-slave" bindings (one for the
> > intermediate hack and one for the final representation). As an
> > alternative, you could also add slave function and port nvec in the same
> > series.
> 
> First patch only adds slave functionality to tegra-i2c driver. I sent v3
> to fix only tegra-i2c as Wolfram suggested.
> 
> Unfortunately I haven't fixed all defects and I will resend patch(es).
> I can resend only first patch (for tegra-i2c) if it is more obvious for
> everyone.

It's up to you. I think if the NV guys are ok with the tegra i2c change, 
Wolfram can merge it right away for 4.3. Not sure about the state of the nvec 
changes though and if they can be ready soon.

Marc


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: nvec: specify a platform-device base id

2015-01-20 Thread Marc Dietrich
commit 6e3f62f079 (mfd: core: Fix platform-device id generation) modified
the computation of the mfd cell id. Negative numbers forbit the specification
of cell ids as we do. Fix this for now by specifying a base of 0 instead. In
the long run, this may be changed to automatic cell ids (base -2).

Reported-by: Misha Komarovskiy 
Signed-off-by: Marc Dietrich 
---
 drivers/staging/nvec/nvec.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 093535c..120b70d 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -85,23 +85,20 @@ static struct nvec_chip *nvec_power_handle;
 static const struct mfd_cell nvec_devices[] = {
{
.name = "nvec-kbd",
-   .id = 1,
},
{
.name = "nvec-mouse",
-   .id = 1,
},
{
.name = "nvec-power",
-   .id = 1,
+   .id = 0,
},
{
.name = "nvec-power",
-   .id = 2,
+   .id = 1,
},
{
.name = "nvec-paz00",
-   .id = 1,
},
 };
 
@@ -891,7 +888,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
nvec_msg_free(nvec, msg);
}
 
-   ret = mfd_add_devices(nvec->dev, -1, nvec_devices,
+   ret = mfd_add_devices(nvec->dev, 0, nvec_devices,
  ARRAY_SIZE(nvec_devices), NULL, 0, NULL);
if (ret)
dev_err(nvec->dev, "error adding subdevices\n");
-- 
1.9.1

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


Re: [PATCH 2/3] staging/nvec: reimplement on top of tegra i2c driver

2015-01-29 Thread Marc Dietrich
return ret;
> 
> - nvec->base = base;
> - nvec->i2c_clk = i2c_clk;
>   nvec->rx = &nvec->msg_pool[0];
> 
>   ATOMIC_INIT_NOTIFIER_HEAD(&nvec->notifier_list);
> @@ -852,23 +707,14 @@ static int tegra_nvec_probe(struct platform_device
> *pdev) INIT_WORK(&nvec->rx_work, nvec_dispatch);
>   INIT_WORK(&nvec->tx_work, nvec_request_master);
> 
> - err = devm_gpio_request_one(&pdev->dev, nvec->gpio, GPIOF_OUT_INIT_HIGH,
> - "nvec gpio");
> - if (err < 0) {
> + ret = devm_gpio_request_one(&client->dev, nvec->gpio,
> + GPIOF_OUT_INIT_HIGH,
> + "nvec gpio");
> + if (ret < 0) {
>   dev_err(nvec->dev, "couldn't request gpio\n");
>   return -ENODEV;
>   }
> 
> - err = devm_request_irq(&pdev->dev, nvec->irq, nvec_interrupt, 0,
> - "nvec", nvec);
> - if (err) {
> - dev_err(nvec->dev, "couldn't request irq\n");
> - return -ENODEV;
> - }
> - disable_irq(nvec->irq);
> -
> - tegra_init_i2c_slave(nvec);
> -
>   /* enable event reporting */
>   nvec_toggle_global_events(nvec, true);
> 
> @@ -907,12 +753,13 @@ static int tegra_nvec_probe(struct platform_device
> *pdev) return 0;
>  }
> 
> -static int tegra_nvec_remove(struct platform_device *pdev)
> +
> +static int nvec_remove(struct i2c_client *client)
>  {
> - struct nvec_chip *nvec = platform_get_drvdata(pdev);
> + struct nvec_chip *nvec = i2c_get_clientdata(client);
> 
>   nvec_toggle_global_events(nvec, false);
> - mfd_remove_devices(nvec->dev);
> + /* TODO: mfd_remove_devices(nvec->dev); ??? */

why did you removed this?

>   nvec_unregister_notifier(nvec, &nvec->nvec_status_notifier);
>   cancel_work_sync(&nvec->rx_work);
>   cancel_work_sync(&nvec->tx_work);
> @@ -938,8 +785,6 @@ static int nvec_suspend(struct device *dev)
>   msg = nvec_write_sync(nvec, ap_suspend, sizeof(ap_suspend));
>   nvec_msg_free(nvec, msg);
> 
> - nvec_disable_i2c_slave(nvec);
> -
>   return 0;
>  }
> 
> @@ -949,7 +794,6 @@ static int nvec_resume(struct device *dev)
>   struct nvec_chip *nvec = platform_get_drvdata(pdev);
> 
>   dev_dbg(nvec->dev, "resuming\n");
> - tegra_init_i2c_slave(nvec);
>   nvec_toggle_global_events(nvec, true);
> 
>   return 0;
> @@ -965,9 +809,16 @@ static const struct of_device_id nvidia_nvec_of_match[]
> = { };
>  MODULE_DEVICE_TABLE(of, nvidia_nvec_of_match);
> 
> -static struct platform_driver nvec_device_driver = {
> - .probe   = tegra_nvec_probe,
> - .remove  = tegra_nvec_remove,
> +static const struct i2c_device_id nvidia_nvec_i2c_table[] = {
> + { "nvec", 0 },
> + {},
> +};
> +MODULE_DEVICE_TABLE(i2c, nvidia_nvec_i2c_table);
> +
> +static struct i2c_driver i2c_nvec_device_driver = {
> + .probe   = nvec_probe,
> + .remove  = nvec_remove,
> + .id_table = nvidia_nvec_i2c_table,
>   .driver  = {
>   .name = "nvec",
>   .pm = &nvec_pm_ops,
> @@ -975,9 +826,9 @@ static struct platform_driver nvec_device_driver = {
>   }
>  };
> 
> -module_platform_driver(nvec_device_driver);
> +module_i2c_driver(i2c_nvec_device_driver);
> 
> -MODULE_ALIAS("platform:nvec");
> +MODULE_ALIAS("i2c:nvec");
>  MODULE_DESCRIPTION("NVIDIA compliant embedded controller interface");
>  MODULE_AUTHOR("Marc Dietrich ");
>  MODULE_LICENSE("GPL");
> diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
> index e271375..5e7e17c 100644
> --- a/drivers/staging/nvec/nvec.h
> +++ b/drivers/staging/nvec/nvec.h
> @@ -56,6 +56,13 @@ enum nvec_event_size {
>   NVEC_VAR_SIZE,
>  };
> 
> +enum nvec_state {
> + ST_NONE,
> + ST_RX,
> + ST_TX,
> + ST_TRANS_START,
> +};
> +
>  /**
>   * enum nvec_msg_type - The type of a message
>   * @NVEC_SYS: A system request/response
> @@ -107,11 +114,6 @@ struct nvec_msg {
>   * struct nvec_chip - A single connection to an NVIDIA Embedded controller
>   * @dev: The device
>   * @gpio: The same as for &struct nvec_platform_data
> - * @irq: The IRQ of the I2C device
> - * @i2c_addr: The address of the I2C slave
> - * @base: The base of the memory mapped region of the I2C device
> - * @i2c_clk: The clock of the I2C device
> - * @rst: The reset of the I2C device
>   * @notifier_list: Notifiers to be called on received messages, see
>   * nvec_register_notifier()
>   * @rx_data: Received messages that have to be processed
> @@ -137,11 +139,6 @@ struct nvec_msg {
>  struct nvec_chip {
>   struct device *dev;
>   int gpio;
> - int irq;
> - int i2c_addr;
> - void __iomem *base;
> - struct clk *i2c_clk;
> - struct reset_control *rst;
>   struct atomic_notifier_head notifier_list;
>   struct list_head rx_data, tx_data;
>   struct notifier_block nvec_status_notifier;


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Warning that occured while compiling the nvec in3.19.0-rc5+ is fixed

2015-01-31 Thread Marc Dietrich
Am Samstag 31 Januar 2015, 20:11:29 schrieb Julian Andres Klode:
> On 31 January 2015 at 17:29, Greg KH  wrote:
> > On Sat, Jan 31, 2015 at 05:24:42PM +0530, varsharamt wrote:
> >> The task was to fix  a warning which was shown while compiling a driver
> >> called NVEC. I wrote a brief description about how to enable support for
> >> a nVidya complaint embedded controller.
> > 
> > This makes no sense, what "task"?
> > 
> >> Signed-off-by:Varsha Ram T
> > 
> > Please use proper spaces.
> > 
> > Also, this doesn't match your From: line.  And, is this the name you use
> > to sign legal documents?
> > 
> >> ---
> >> 
> >>  drivers/staging/nvec/Kconfig | 20 ++--
> >>  1 file changed, 10 insertions(+), 10 deletions(-)
> >> 
> >> diff --git a/drivers/staging/nvec/Kconfig b/drivers/staging/nvec/Kconfig
> >> index 9475e20..a65ad4c 100644
> >> --- a/drivers/staging/nvec/Kconfig
> >> +++ b/drivers/staging/nvec/Kconfig
> >> @@ -3,33 +3,33 @@ config MFD_NVEC
> >> 
> >>   depends on I2C && GPIOLIB && ARCH_TEGRA
> >>   select MFD_CORE
> >>   help
> >> 
> >> - Say Y here to enable support for a nVidia compliant embedded
> >> - controller.
> >> + Say Y to enable support for a nVidia complaint embedded controller.
> >> + nVidia complaint embedded controller is used to communicate with
> >> EC.
> >> + This is done through I2C bus.
> >> + The request to the EC can be initiated by triggering a gpio line.
> >> + The gpio line is a generic pin on integrated circuit whose input or
> >> output pin can be controlled by the user at run time.> 
> > There's no way this is correct, look at how long your line is.
> 
> I'm not even sure if this level of detail is needed. Why should anyone
> that reads the config option care how NVEC is enabled or communicated
> with?

I didn't received the original mail, but I think this is related to a 
checkpatch warning which demands at least *three* lines of help text (we only 
have two). While the sense of such requirement is discussable, blowing up
an already complete help text just to avoid a checkpatch warning doesn't make 
much sense to me.

Marc


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 00/20] power_supply: Allow safe usage of power supply

2015-02-02 Thread Marc Dietrich
Am Freitag, 30. Januar 2015, 15:47:38 schrieb Krzysztof Kozlowski:
> Hi,
> 
> The patchset changes power supply API and drivers implementing
> power supply class.
> 
> 
> TLDR for driver and subsystem maintainers
> =
> Two patches of patchset change power_supply_register() function so in
> the same time they touch all drivers. I am kindly asking for acks,
> review and help in testing.
> 
> Please look at:
>  - patch 2: power_supply: Move run-time configuration to separate structure
>  - patch 11: power_supply: Change ownership from driver to core
> 
> These are huge.

Patches 2 and 11 are Reviewed-By: Marc Dietrich  # for the 
nvec part.

Thanks!

Marc


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Revert "staging: nvec: ps2: change serio type to passthrough"

2016-10-25 Thread Marc Dietrich
Hi Paul, Greg,

Am Dienstag, 25. Oktober 2016, 15:10:55 CEST schrieb Paul Fertser:
> This reverts commit 36b30d6138f4677514aca35ab76c20c1604baaad.
> 
> This is necessary to detect paz00 (ac100) touchpad properly as one
> speaking ETPS/2 protocol. Without it X.org's synaptics driver doesn't
> work as the touchpad is detected as an ImPS/2 mouse instead.
> 
> Commit ec6184b1c717b8768122e25fe6d312f609cc1bb4 changed the way
> auto-detection is performed on ports marked as pass through and made the
> issue apparent.
> 
> A pass through port is an additional PS/2 port used to connect a slave
> device to a master device that is using PS/2 to communicate with the
> host (so slave's PS/2 communication is tunneled over master's PS/2
> link). "Synaptics PS/2 TouchPad Interfacing Guide" describes such a
> setup (PS/2 PASS-THROUGH OPTION section).
> 
> Since paz00's embedded controller is not connected to a PS/2 port
> itself, the PS/2 interface it exposes is not a pass-through one.
> 
> Acked-by: Marc Dietrich 
> Signed-off-by: Paul Fertser 

In fact I was a bit to fast to ack. Turns out I booted the wrong kernel. So 
please hold off this one, until some issues with this patch are fixed.

Marc


> ---
>  drivers/staging/nvec/nvec_ps2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/nvec/nvec_ps2.c
> b/drivers/staging/nvec/nvec_ps2.c index a324322..c83eeb4 100644
> --- a/drivers/staging/nvec/nvec_ps2.c
> +++ b/drivers/staging/nvec/nvec_ps2.c
> @@ -112,7 +112,7 @@ static int nvec_mouse_probe(struct platform_device
> *pdev) if (!ser_dev)
>   return -ENOMEM;
> 
> - ser_dev->id.type = SERIO_PS_PSTHRU;
> + ser_dev->id.type = SERIO_8042;
>   ser_dev->write = ps2_sendcommand;
>   ser_dev->start = ps2_startstreaming;
>   ser_dev->stop = ps2_stopstreaming;



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] drivers: staging: nvec: remove bogus reset command for PS/2 interface

2016-10-27 Thread Marc Dietrich
Hi Paul,

thanks for finding the issue!

Am Donnerstag, 27. Oktober 2016, 16:55:14 CEST schrieb Paul Fertser:
> This command was sent behind serio's back and the answer to it was
> confusing atkbd probe function which lead to the elantech touchpad
> getting detected as a keyboard.
> 
> To prevent this from happening just let every party do its part of the
> job.
> 
> Signed-off-by: Paul Fertser 

Please send a complete patch in a new thread (or titled with V2) with the 
serio type change included.

Thanks,

Marc

> ---
>  drivers/staging/nvec/nvec_ps2.c | 4 
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec_ps2.c
> b/drivers/staging/nvec/nvec_ps2.c index c83eeb4..910e87b 100644
> --- a/drivers/staging/nvec/nvec_ps2.c
> +++ b/drivers/staging/nvec/nvec_ps2.c
> @@ -106,7 +106,6 @@ static int nvec_mouse_probe(struct platform_device
> *pdev) {
>   struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent);
>   struct serio *ser_dev;
> - char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 };
> 
>   ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL);
>   if (!ser_dev)
> @@ -127,9 +126,6 @@ static int nvec_mouse_probe(struct platform_device
> *pdev)
> 
>   serio_register_port(ser_dev);
> 
> - /* mouse reset */
> - nvec_write_async(nvec, mouse_reset, sizeof(mouse_reset));
> -
>   return 0;
>  }



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 0/2] staging: nvec: ps2: fix touchpad operation

2016-10-27 Thread Marc Dietrich
Am Donnerstag, 27. Oktober 2016, 17:22:07 CEST schrieb Paul Fertser:
> Status quo on Toshiba ac100 (paz00) is that the integrated elantech touchpad
> is detected as an ImPS/2 mouse and so it's kind of functional but advanced
> synaptics configuration isn't available.
> 
> When only serio type is changed it leads to atkbd misdetecting the touchpad
> as a keyboard. So first goes the commit that fixes this bug, then the serio
> type change.
> 
> Paul Fertser (2):
>   drivers: staging: nvec: remove bogus reset command for PS/2 interface
>   Revert "staging: nvec: ps2: change serio type to passthrough"
> 
>  drivers/staging/nvec/nvec_ps2.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)

Works fine now. Thanks!

The series is 

Acked-by: Marc Dietrich 



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: nvec: remove managed resource from PS2 driver

2016-11-01 Thread Marc Dietrich
This basicly reverts commit e534f3e9 (staging:nvec: Introduce the use of
the managed version of kzalloc). Serio struct should never by managed
because it is refcounted. Doing so will lead to a double free oops on module
remove.

Signed-off-by: Marc Dietrich 
---
 drivers/staging/nvec/nvec_ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index a324322..7d71c56 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -108,7 +108,7 @@ static int nvec_mouse_probe(struct platform_device *pdev)
struct serio *ser_dev;
char mouse_reset[] = { NVEC_PS2, SEND_COMMAND, PSMOUSE_RST, 3 };
 
-   ser_dev = devm_kzalloc(&pdev->dev, sizeof(struct serio), GFP_KERNEL);
+   ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!ser_dev)
return -ENOMEM;
 
-- 
2.10.1

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


Re: [PATCH] staging: nvec: fixed few coding style warnings

2015-10-15 Thread Marc Dietrich
Am Mittwoch, 14. Oktober 2015, 21:12:36 schrieb Dan Carpenter:
> On Wed, Oct 14, 2015 at 07:38:22PM +0530, Sakshi Bansal wrote:
> > Fixed allignmnet issues and block comments usage
> 
> Split it apart by type of fix.
> 
> > @@ -617,7 +618,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
> > 
> > } else {
> > 
> > nvec->rx = nvec_msg_alloc(nvec, NVEC_MSG_RX);
> > /* Should not happen in a normal world */
> > 
> > -   if (unlikely(nvec->rx == NULL)) {
> > +   if (!unlikely(nvec->rx)) {
> 
> This isn't right.  You intented to say:
> 
>   if (unlikely(!nvec->rx)) {
> 
> But even better to just remove the unlikely entirely.
> 
>   if (!nvec->rx) {

why? the "unlikely" is there to optimize a critical interrupt path.


Marc


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: nvec: fixed few coding style warnings

2015-10-15 Thread Marc Dietrich
Am Donnerstag, 15. Oktober 2015, 11:48:12 schrieb Dan Carpenter:
> On Thu, Oct 15, 2015 at 10:39:02AM +0200, Marc Dietrich wrote:
> > > > -   if (unlikely(nvec->rx == NULL)) {
> > > > +   if (!unlikely(nvec->rx)) {
> > > 
> > > This isn't right.  You intented to say:
> > >   if (unlikely(!nvec->rx)) {
> > > 
> > > But even better to just remove the unlikely entirely.
> > > 
> > >   if (!nvec->rx) {
> > 
> > why? the "unlikely" is there to optimize a critical interrupt path.
> 
> The rule is that drivers should not use likely/unlikely() unless there
> is a difference in benchmark numbers. 

well, we know that additional cpu cycles in this path break transfer for 
unknown reasons. However, the unlikely here may be overkill. On the other 
hand, I prefer not to change something here until these timing effects are 
better understood.

> How critical can it be when it's
> always followed by a udelay(100)???

yes, this delay shouldn't be there at all. This is one of the timing mysteries 
we still have to resolve.

> There are more important optimizations needed here.

sure. We are currently trying to move all this out into the tegra-i2c driver, 
so this code block will get a major review/rewrite in the near future anyway.

Marc


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 21/31] staging: nvec: use reset framework

2013-11-16 Thread Marc Dietrich
On Friday 15 November 2013 13:54:16 Stephen Warren wrote:
> From: Stephen Warren 
> 
> Tegra's clock driver now provides an implementation of the common
> reset API (include/linux/reset.h). Use this instead of the old Tegra-
> specific API; that will soon be removed.
> 
> Cc: tred...@nvidia.com
> Cc: pdeschrij...@nvidia.com
> Cc: linux-te...@vger.kernel.org
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: Julian Andres Klode 
> Cc: Marc Dietrich 
> Cc: ac...@lists.launchpad.net
> Cc: Greg Kroah-Hartman 
> Cc: de...@driverdev.osuosl.org
> Signed-off-by: Stephen Warren 

Acked-by: Marc Dietrich 

> ---
> This patch is part of a series with strong internal depdendencies. I'm
> looking for an ack so that I can take the entire series through the Tegra
> and arm-soc trees. The series will be part of a stable branch that can be
> merged into other subsystems if needed to avoid/resolve dependencies.
> ---
>  drivers/staging/nvec/nvec.c | 11 ---
>  drivers/staging/nvec/nvec.h |  5 -
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 3066ee2e753b..9de4cd13d9ab 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -36,7 +36,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
> 
>  #include "nvec.h"
> 
> @@ -733,9 +732,9 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
> 
>   clk_prepare_enable(nvec->i2c_clk);
> 
> - tegra_periph_reset_assert(nvec->i2c_clk);
> + reset_control_assert(nvec->rst);
>   udelay(2);
> - tegra_periph_reset_deassert(nvec->i2c_clk);
> + reset_control_deassert(nvec->rst);
> 
>   val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN |
>   (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT);
> @@ -836,6 +835,12 @@ static int tegra_nvec_probe(struct platform_device
> *pdev) return -ENODEV;
>   }
> 
> + nvec->rst = devm_reset_control_get(&pdev->dev, "i2c");
> + if (IS_ERR(nvec->rst)) {
> + dev_err(nvec->dev, "failed to get controller reset\n");
> + return PTR_ERR(nvec->rst);
> + }
> +
>   nvec->base = base;
>   nvec->irq = res->start;
>   nvec->i2c_clk = i2c_clk;
> diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
> index e880518935fb..e271375053fa 100644
> --- a/drivers/staging/nvec/nvec.h
> +++ b/drivers/staging/nvec/nvec.h
> @@ -23,6 +23,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
> 
> @@ -109,7 +110,8 @@ struct nvec_msg {
>   * @irq: The IRQ of the I2C device
>   * @i2c_addr: The address of the I2C slave
>   * @base: The base of the memory mapped region of the I2C device
> - * @clk: The clock of the I2C device
> + * @i2c_clk: The clock of the I2C device
> + * @rst: The reset of the I2C device
>   * @notifier_list: Notifiers to be called on received messages, see
>   * nvec_register_notifier()
>   * @rx_data: Received messages that have to be processed
> @@ -139,6 +141,7 @@ struct nvec_chip {
>   int i2c_addr;
>   void __iomem *base;
>   struct clk *i2c_clk;
> + struct reset_control *rst;
>   struct atomic_notifier_head notifier_list;
>   struct list_head rx_data, tx_data;
>   struct notifier_block nvec_status_notifier;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: nvec: insert blank lines after declarations

2014-07-04 Thread Marc Dietrich
Am Donnerstag, 3. Juli 2014, 21:15:57 schrieb Pawel Lebioda:
> Hi,
> 
> This patch fixes coding style warnings reported by checkpatch.pl:
> "Missing a blank line after declarations".

thanks. Looking at the checkpatch output, its requirement of at
least 4 lines of help text looks like a bit overkill though.
 
> Signed-off-by: Pawel Lebioda 
>  drivers/staging/nvec/nvec_paz00.c | 1 +
>  drivers/staging/nvec/nvec_power.c | 1 +
>  drivers/staging/nvec/nvec_ps2.c   | 2 ++
>  3 files changed, 4 insertions(+)

Acked-by: Marc Dietrich 


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: nvec: remove unneccessary 'else' after 'return'statement

2014-07-05 Thread Marc Dietrich
On Fri, 4 Jul 2014 22:59:41 +0200
Julian Andres Klode  wrote:

> On Fri, Jul 04, 2014 at 09:57:50PM +0200, Pawel Lebioda wrote:
> > Hi,
> >
> > This patch fixes the following warning reported by checkpatch.pl:
> > 
> > WARNING: else is not generally useful after a break or return
> > #235: FILE: drivers/staging/nvec/nvec.c:235:
> > 
> > Regards
> > Pawel Lebioda
> > 
> > Signed-off-by: Pawel Lebioda 
> >  drivers/staging/nvec/nvec.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> Hi Pawel,
> 
> Please format your patches correctly. There should be no
> "Hi", no "Regards", etc. After the signed off should be a
> dashed line.
> 
> Use git format-patch to format patches and you can send
> them using git-send-email.

yes, this way you reduce some apply-burdon from Greg. Ideally,
you would combine all patches (one patch per checkpatch warning)
in a common thread like this:

git-format-patch --cover-letter --thread -s 

This way you could add some comments (if any) to the cover letter
and just keep the plain checkpatch message in the other patches. This
has also the advantage that the maintainers only have to ack the "cover
letter".

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


Re: [PATCH 0/2] staging: nvec: fix some coding style problems

2014-07-06 Thread Marc Dietrich
Hi Pawel,

Am Samstag, 5. Juli 2014, 22:30:54 schrieb Pawel Lebioda:
> The following patches fix some warnings reported by checkpatch.pl
> 
> Pawel Lebioda (2):
>   staging: nvec: remove unnecessary 'else' after 'return' statement
>   staging: nvec: remove unneccessary 'out of memory' message
> 
>  drivers/staging/nvec/nvec.c | 8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)

thanks for fixing, so for this series

Acked-by: Marc Dietrich 


signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 29/44] staging: nvec: Register with kernel poweroff handler

2014-10-08 Thread Marc Dietrich
Am Montag 06 Oktober 2014, 22:28:31 schrieb Guenter Roeck:
> Register with kernel poweroff handler instead of setting pm_power_off
> directly. Register with default priority value of 128 since we don't know
> any better.

I just tested this change and it seems to break power off. What the driver 
does it to queue the power off request and execute it sometime later. The 
command is send via i2c to an embedded controller (mfd device) which is 
responsible for removing the power.

I haven't analyzed further, but I guess this could be related with the atomic 
discussion brought up in some other thread of this patch series.

Marc

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


Re: [PATCH] staging:nvec: Fix several coding style warnings

2014-07-08 Thread Marc Dietrich
Hi Guillaume,

On Tue,  8 Jul 2014 00:31:32 +0200
Guillaume Clement  wrote:

> This fixes several warnings in the nvec staging driver.

Pawel Lebioda already sent a patch series to fix these issues
a few days ago. From a first look, your patch series looks identical.
Thanks anyway for taking your time.

Marc

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


Re: [PATCH] staging/nvec: Pass proper resource to mfd_add_devices()

2014-07-21 Thread Marc Dietrich
Hi Thierry,

On Mon, 21 Jul 2014 13:52:41 +0200
Thierry Reding  wrote:

> From: Thierry Reding 
> 
> The mfd_add_devices() parameter takes a struct resource * as fifth
> argument, but the nvec driver passes in a void __iomem *. The driver
> gets away with it because none of the subdevices ever directly access
> the registers.

you are right, this one looked bogus. 

> While at it, use platform_get_irq() instead of platform_get_resource()
> to get the device's interrupt. This makes it easier to pass in the
> register region since the variable is no longer reused.
> 
> Signed-off-by: Thierry Reding 
> ---
> Alternatively we could simply pass NULL into mfd_add_devices(), which
> might be a slightly more accurate representation of what's going on.
>
> Marc, Greg, any preferences?

I just tested with NULL as base and it seems to produce no harm. Even
if we may get rid of mfd_add_devices in the future, passing NULL is
cleaner for now and no children will ever make use of it. So please send
a new version with this change.

Otherwise, thanks for looking and cleaning up.

Marc

>  drivers/staging/nvec/nvec.c | 7 +++
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index d32504844896..11f9e1c3447c 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -821,8 +821,8 @@ static int tegra_nvec_probe(struct platform_device *pdev)
>   if (IS_ERR(base))
>   return PTR_ERR(base);
>  
> - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> - if (!res) {
> + nvec->irq = platform_get_irq(pdev, 0);
> + if (nvec->irq < 0) {
>   dev_err(&pdev->dev, "no irq resource?\n");
>   return -ENODEV;
>   }
> @@ -840,7 +840,6 @@ static int tegra_nvec_probe(struct platform_device *pdev)
>   }
>  
>   nvec->base = base;
> - nvec->irq = res->start;
>   nvec->i2c_clk = i2c_clk;
>   nvec->rx = &nvec->msg_pool[0];
>  
> @@ -893,7 +892,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
>   }
>  
>   ret = mfd_add_devices(nvec->dev, -1, nvec_devices,
> -   ARRAY_SIZE(nvec_devices), base, 0, NULL);
> +   ARRAY_SIZE(nvec_devices), res, 0, NULL);
>   if (ret)
>   dev_err(nvec->dev, "error adding subdevices\n");
>  
> -- 
> 2.0.1
> 


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


Re: [PATCH] staging/nvec: Remove double const qualifier

2014-07-21 Thread Marc Dietrich
On Mon, 21 Jul 2014 13:54:41 +0200
Thierry Reding  wrote:

> From: Thierry Reding 
> 
> The SIMPLE_DEV_PM_OPS macro already uses the const qualifier, so there's
> no need to repeat it.
> 
> Signed-off-by: Thierry Reding 

Acked-by: Marc Dietrich 

> ---
>  drivers/staging/nvec/nvec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 11f9e1c3447c..aef52306620a 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -959,7 +959,7 @@ static int nvec_resume(struct device *dev)
>  }
>  #endif
>  
> -static const SIMPLE_DEV_PM_OPS(nvec_pm_ops, nvec_suspend, nvec_resume);
> +static SIMPLE_DEV_PM_OPS(nvec_pm_ops, nvec_suspend, nvec_resume);
>  
>  /* Match table for of_platform binding */
>  static const struct of_device_id nvidia_nvec_of_match[] = {
> -- 
> 2.0.1
> 


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


Re: [PATCH 1/2] staging/nvec: Do not pass resource to mfd_add_devices()

2014-07-29 Thread Marc Dietrich
Am Dienstag 29 Juli 2014, 13:16:14 schrieb Thierry Reding:
> From: Thierry Reding 
> 
> The mfd_add_devices() function takes a struct resource * as fifth
> argument, but the nvec driver passes in a void __iomem *. The driver
> gets away with it because none of the subdevices ever directly access
> the registers.
> 
> Since subdevices never need to access the registers we can simply pass
> NULL instead.
> 
> Signed-off-by: Thierry Reding 

Acked-by: Marc Dietrich 

> ---
>  drivers/staging/nvec/nvec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 0a5c84ad3f41..815065837ce7 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -893,7 +893,7 @@ static int tegra_nvec_probe(struct platform_device
> *pdev) }
> 
>   ret = mfd_add_devices(nvec->dev, -1, nvec_devices,
> -   ARRAY_SIZE(nvec_devices), base, 0, NULL);
> +   ARRAY_SIZE(nvec_devices), NULL, 0, NULL);
>   if (ret)
>   dev_err(nvec->dev, "error adding subdevices\n");

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


Re: [PATCH 2/2] staging/nvec: Use platform_get_irq()

2014-07-29 Thread Marc Dietrich
Am Dienstag 29 Juli 2014, 13:16:15 schrieb Thierry Reding:
> From: Thierry Reding 
> 
> As opposed to platform_get_resource(), the platform_get_irq() function
> has special code to handle driver probe deferral when booting using DT
> and where an interrupt provider hasn't been registered yet. While this
> is unlikely to become an issue for nvec, platform_get_irq() is the
> recommended way to get at interrupts.
> 
> Signed-off-by: Thierry Reding 

Thanks again, Thierry!

Acked-by: Marc Dietrich 



> ---
>  drivers/staging/nvec/nvec.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
> index 815065837ce7..a93208adbfcf 100644
> --- a/drivers/staging/nvec/nvec.c
> +++ b/drivers/staging/nvec/nvec.c
> @@ -821,8 +821,8 @@ static int tegra_nvec_probe(struct platform_device
> *pdev) if (IS_ERR(base))
>   return PTR_ERR(base);
> 
> - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> - if (!res) {
> + nvec->irq = platform_get_irq(pdev, 0);
> + if (nvec->irq < 0) {
>   dev_err(&pdev->dev, "no irq resource?\n");
>   return -ENODEV;
>   }
> @@ -840,7 +840,6 @@ static int tegra_nvec_probe(struct platform_device
> *pdev) }
> 
>   nvec->base = base;
> - nvec->irq = res->start;
>   nvec->i2c_clk = i2c_clk;
>   nvec->rx = &nvec->msg_pool[0];

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


Re: [PATCH] staging: nvec: v3: add error checking to nvec_power_pollfunction

2018-03-05 Thread Marc Dietrich
Hello Thomas,

Am Freitag, 2. M?rz 2018, 20:05:25 CET schrieb Thomas Avery:
> This patch adds error checking to the nvec_power_poll function, which
> will allow for easier debugging if the driver has issues.
> 
> Signed-off-by: Thomas Avery 
> ---
>  drivers/staging/nvec/nvec_power.c | 13 ++---
>  1 file changed, 10 insertions(+), 3 deletions(-)

I dont think it makes sense to return an error from a worker. In the future, 
please also CC staging mailing list (de...@driverdev.osuosl.org).

Marc
 
> diff --git a/drivers/staging/nvec/nvec_power.c
> b/drivers/staging/nvec/nvec_power.c index 0e861c4bfcbf..c61e69f606c3 100644
> --- a/drivers/staging/nvec/nvec_power.c
> +++ b/drivers/staging/nvec/nvec_power.c
> @@ -345,8 +345,9 @@ static int const bat_iter[] = {
>  #endif
>  };
> 
> -static void nvec_power_poll(struct work_struct *work)
> +static int nvec_power_poll(struct work_struct *work)
>  {
> + int err;
>   char buf[] = { NVEC_SYS, GET_SYSTEM_STATUS };
>   struct nvec_power *power = container_of(work, struct nvec_power,
>   poller.work);
> @@ -355,7 +356,10 @@ static void nvec_power_poll(struct work_struct *work)
>   counter = 0;
> 
>   /* AC status via sys req */
> - nvec_write_async(power->nvec, buf, 2);
> + err = nvec_write_async(power->nvec, buf, 2);
> + if (err != 0)
> + return err;
> +
>   msleep(100);
> 
>   /*
> @@ -364,9 +368,12 @@ static void nvec_power_poll(struct work_struct *work)
>*/
>   buf[0] = NVEC_BAT;
>   buf[1] = bat_iter[counter++];
> - nvec_write_async(power->nvec, buf, 2);
> + err = nvec_write_async(power->nvec, buf, 2);
> + if (err != 0)
> + return err;
> 
>   schedule_delayed_work(to_delayed_work(work), msecs_to_jiffies(5000));
> + return 0;
>  };
> 
>  static int nvec_power_probe(struct platform_device *pdev)



signature.asc
Description: This is a digitally signed message part.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] staging: nvec: change usage of slave to secondary

2020-07-24 Thread Marc Dietrich

Hi Rohit,

On Fri, 24 Jul 2020, Rohit Bharadwaj wrote:


On 24/07/20 1:58 pm, Greg KH wrote:

On Fri, Jul 24, 2020 at 01:44:27PM +0530, Rohit Bharadwaj wrote:

On 24/07/20 10:06 am, Rohit K Bharadwaj wrote:

changed usage of slave (deprecated) to secondary

Signed-off-by: Rohit K Bharadwaj 
---
v3: change patch subject, add version history
v2: add changelog text in body of mail
v1: fix style issues by changing usage of slave to secondary

 drivers/staging/nvec/nvec.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 360ec0407740..5d7b66719a39 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
return IRQ_HANDLED;
 }

-static void tegra_init_i2c_slave(struct nvec_chip *nvec)
+static void tegra_init_i2c_secondary(struct nvec_chip *nvec)
 {
u32 val;

@@ -744,7 +744,7 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
 }

 #ifdef CONFIG_PM_SLEEP
-static void nvec_disable_i2c_slave(struct nvec_chip *nvec)
+static void nvec_disable_i2c_secondary(struct nvec_chip *nvec)
 {
disable_irq(nvec->irq);
writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG);
@@ -784,7 +784,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, nvec);
nvec->dev = dev;

-   if (of_property_read_u32(dev->of_node, "slave-addr", &nvec->i2c_addr)) {
+   if (of_property_read_u32(dev->of_node, "secondary-addr", 
&nvec->i2c_addr)) {
dev_err(dev, "no i2c address specified");
return -ENODEV;
}


as Christoph said, please don't change this line.


@@ -839,7 +839,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
}
disable_irq(nvec->irq);

-   tegra_init_i2c_slave(nvec);
+   tegra_init_i2c_secondary(nvec);

/* enable event reporting */
nvec_toggle_global_events(nvec, true);
@@ -913,7 +913,7 @@ static int nvec_suspend(struct device *dev)
if (!err)
nvec_msg_free(nvec, msg);

-   nvec_disable_i2c_slave(nvec);
+   nvec_disable_i2c_secondary(nvec);

return 0;
 }
@@ -923,7 +923,7 @@ static int nvec_resume(struct device *dev)
struct nvec_chip *nvec = dev_get_drvdata(dev);

dev_dbg(nvec->dev, "resuming\n");
-   tegra_init_i2c_slave(nvec);
+   tegra_init_i2c_secondary(nvec);
nvec_toggle_global_events(nvec, true);

return 0;


Dear All, this message was not delivered to marvi...@gmx.de, I'm getting that 
The response from the remote server was:
554 gmx.net (mxgmx016) Nemesis ESMTP Service not available No SMTP service 
Reject due to policy restrictions,


Not a big deal, email address atrophy over time.  That's why you always
cc: a public mailing list for patches.


yes, my mail provider introduces a bit too aggressive mail filtering 
recently, causing me being unsubscribed frequently. I just changed my subscriber 
address, which should fix the problem, sorry.


Marc

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


Re: [PATCH v3] staging: nvec: change usage of slave to secondary

2020-07-24 Thread Marc Dietrich




On Fri, 24 Jul 2020, Marc Dietrich wrote:


Hi Rohit,

On Fri, 24 Jul 2020, Rohit Bharadwaj wrote:


On 24/07/20 1:58 pm, Greg KH wrote:

On Fri, Jul 24, 2020 at 01:44:27PM +0530, Rohit Bharadwaj wrote:

On 24/07/20 10:06 am, Rohit K Bharadwaj wrote:

changed usage of slave (deprecated) to secondary

Signed-off-by: Rohit K Bharadwaj 
---
v3: change patch subject, add version history
v2: add changelog text in body of mail
v1: fix style issues by changing usage of slave to secondary

 drivers/staging/nvec/nvec.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 360ec0407740..5d7b66719a39 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void 
*dev)

return IRQ_HANDLED;
 }

-static void tegra_init_i2c_slave(struct nvec_chip *nvec)
+static void tegra_init_i2c_secondary(struct nvec_chip *nvec)
 {
u32 val;

@@ -744,7 +744,7 @@ static void tegra_init_i2c_slave(struct nvec_chip 
*nvec)

 }

 #ifdef CONFIG_PM_SLEEP
-static void nvec_disable_i2c_slave(struct nvec_chip *nvec)
+static void nvec_disable_i2c_secondary(struct nvec_chip *nvec)
 {
disable_irq(nvec->irq);
writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG);
@@ -784,7 +784,7 @@ static int tegra_nvec_probe(struct platform_device 
*pdev)

platform_set_drvdata(pdev, nvec);
nvec->dev = dev;

-	if (of_property_read_u32(dev->of_node, "slave-addr", 
&nvec->i2c_addr)) {
+	if (of_property_read_u32(dev->of_node, "secondary-addr", 
&nvec->i2c_addr)) {

dev_err(dev, "no i2c address specified");
return -ENODEV;
}


as Christoph said, please don't change this line.


arr, I meant Dan of course ;-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] staging: nvec: change usage of slave to secondary

2020-07-24 Thread Marc Dietrich


Hi Rohit,

On Fri, 24 Jul 2020, Rohit K Bharadwaj wrote:


On 24/07/20 10:06 pm, Marc Dietrich wrote:



On Fri, 24 Jul 2020, Marc Dietrich wrote:


Hi Rohit,

On Fri, 24 Jul 2020, Rohit Bharadwaj wrote:


On 24/07/20 1:58 pm, Greg KH wrote:

On Fri, Jul 24, 2020 at 01:44:27PM +0530, Rohit Bharadwaj wrote:

On 24/07/20 10:06 am, Rohit K Bharadwaj wrote:

changed usage of slave (deprecated) to secondary

Signed-off-by: Rohit K Bharadwaj 
---
v3: change patch subject, add version history
v2: add changelog text in body of mail
v1: fix style issues by changing usage of slave to secondary

 drivers/staging/nvec/nvec.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 360ec0407740..5d7b66719a39 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
 return IRQ_HANDLED;
 }

-static void tegra_init_i2c_slave(struct nvec_chip *nvec)
+static void tegra_init_i2c_secondary(struct nvec_chip *nvec)
 {
 u32 val;

@@ -744,7 +744,7 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
 }

 #ifdef CONFIG_PM_SLEEP
-static void nvec_disable_i2c_slave(struct nvec_chip *nvec)
+static void nvec_disable_i2c_secondary(struct nvec_chip *nvec)
 {
 disable_irq(nvec->irq);
 writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG);
@@ -784,7 +784,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
 platform_set_drvdata(pdev, nvec);
 nvec->dev = dev;

-    if (of_property_read_u32(dev->of_node, "slave-addr", &nvec->i2c_addr)) {
+    if (of_property_read_u32(dev->of_node, "secondary-addr", &nvec->i2c_addr)) 
{
 dev_err(dev, "no i2c address specified");
 return -ENODEV;
 }


as Christoph said, please don't change this line.


arr, I meant Dan of course ;-)

Dear all, thank you so much for your inputs, I will try to make some other 
patch which will not break the driver (hopefully :p), or if you give me 
permission to submit this patch itself by just keeping this one line


if (of_property_read_u32(dev->of_node, "slave-addr", &nvec->i2c_addr))


unchanged, and provided it does not break the driver by doing so, I would 
gladly make the changes and submit v4 of the patch.


please resend the patch with the line above unchanged as v4. Don't forget 
to to update the changelog to the commit message. I tested your patch 
(without the dt property change) and it does not change behavoir - as expected,

so you will recevice my Ack.

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


Re: [PATCH v4] staging: nvec: change usage of slave to secondary

2020-08-02 Thread Marc Dietrich

Hi,

On Sat, 25 Jul 2020, Michał Mirosław wrote:


On Sat, Jul 25, 2020 at 06:01:19PM +0530, Rohit K Bharadwaj wrote:

On 25/07/20 5:31 pm, Michał Mirosław wrote:

On Sat, Jul 25, 2020 at 11:59:39AM +0530, Rohit K Bharadwaj wrote:

changed usage of slave (which is deprecated) to secondary without breaking the 
driver


The relevant I2C and SMBus standards use master/slave terminology. Why are
you changing the names to something unfamiliar?

If the reason are the recent coding-style changes, then please note they
are about avoiding introducing *NEW* uses of the specific words and not
about blindly replacing existing occurrences.


I'm really sorry sir, I didn't knew about this, yes the reason for my change is 
according to the script checkpatch.pl to suit the coding style, I would try to 
fix some other coding style related issues if this patch seems to be a bad idea.


I didn't know checkpatch does this (it doesn't in current Linus' master
tree).  I can see there is a commit in next adding this, but seems that
it uses a test far from the original coding-style wording...


given the discussion here [1] and also looking at the coding style patch 
here [2], I think this patch should not be applied. The slave term here 
comes from the I2C protocol (which we can't change) which is listed as an 
exception in [2], see below:


"+Exceptions for introducing new usage is to maintain a userspace ABI/API,
+or when updating code for an existing (as of 2020) hardware or protocol
+specification that mandates those terms. For new specifications
+translate specification usage of the terminology to the kernel coding
+standard where possible.
"

Marc

[1] https://lkml.org/lkml/2020/6/11/60
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/Documentation/process/coding-style.rst?id=a5f526ec


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


Re: [PATCH v4] staging: nvec: change usage of slave to secondary

2020-08-02 Thread Marc Dietrich

Hello Rohit,

On Sat, 25 Jul 2020, Rohit K Bharadwaj wrote:


changed usage of slave (which is deprecated) to secondary without breaking the 
driver

Tested-by: Dan Carpenter 
Acked-by: Marc Dietrich 
Signed-off-by: Rohit K Bharadwaj 


please don't add "*-by"'s by yourself when you send a new patch version.
These will be added "automatically" during the patch handling. I just 
said, I *will* ack your patch, when you resent it, not that I did it 
already.


Thanks!

Marc


---
v4: undo the changes (which broke the driver) to this line: if 
(of_property_read_u32(dev->of_node, "slave-addr", &nvec->i2c_addr))
v3: change patch subject, add version history
v2: add changelog text in body of mail
v1: fix style issues by changing usage of slave to secondary

drivers/staging/nvec/nvec.c | 10 +-
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 360ec0407740..a7e995bfe989 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -718,7 +718,7 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
return IRQ_HANDLED;
}

-static void tegra_init_i2c_slave(struct nvec_chip *nvec)
+static void tegra_init_i2c_secondary(struct nvec_chip *nvec)
{
u32 val;

@@ -744,7 +744,7 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
}

#ifdef CONFIG_PM_SLEEP
-static void nvec_disable_i2c_slave(struct nvec_chip *nvec)
+static void nvec_disable_i2c_secondary(struct nvec_chip *nvec)
{
disable_irq(nvec->irq);
writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG);
@@ -839,7 +839,7 @@ static int tegra_nvec_probe(struct platform_device *pdev)
}
disable_irq(nvec->irq);

-   tegra_init_i2c_slave(nvec);
+   tegra_init_i2c_secondary(nvec);

/* enable event reporting */
nvec_toggle_global_events(nvec, true);
@@ -913,7 +913,7 @@ static int nvec_suspend(struct device *dev)
if (!err)
nvec_msg_free(nvec, msg);

-   nvec_disable_i2c_slave(nvec);
+   nvec_disable_i2c_secondary(nvec);

return 0;
}
@@ -923,7 +923,7 @@ static int nvec_resume(struct device *dev)
struct nvec_chip *nvec = dev_get_drvdata(dev);

dev_dbg(nvec->dev, "resuming\n");
-   tegra_init_i2c_slave(nvec);
+   tegra_init_i2c_secondary(nvec);
nvec_toggle_global_events(nvec, true);

return 0;
--
2.25.1



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


[PATCH] staging: nvec: re-enable the clock on resume

2013-07-27 Thread Marc Dietrich
On resume the slave controller is reinitialized. The tegra i2c master
controller disables the clock at the end of the initialiation, propably
to save some power, and enables it again on each transfer. We don't
do this yet and also forgot to enable the clock on resume. Fix this
copy-paste error by not disabling the clock after initialization.

This didn't striked us yet because suspend/resume hasn't landed in mainline
yet, but will soon.

Signed-off-by: Marc Dietrich 
---
 drivers/staging/nvec/nvec.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 10393da..5a5c639 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -750,8 +750,6 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
writel(0, nvec->base + I2C_SL_ADDR2);
 
enable_irq(nvec->irq);
-
-   clk_disable_unprepare(nvec->i2c_clk);
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -872,9 +870,6 @@ static int tegra_nvec_probe(struct platform_device *pdev)
 
tegra_init_i2c_slave(nvec);
 
-   clk_prepare_enable(i2c_clk);
-
-
/* enable event reporting */
nvec_toggle_global_events(nvec, true);
 
-- 
1.7.9.5

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