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 <tavery321@xxxxxxxxx> > --- > 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 (devel@xxxxxxxxxxxxxxxxxxxx). 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)
Attachment:
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel