* [PATCH v2 1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one
@ 2021-04-02 17:49 Andy Shevchenko
2021-04-02 17:49 ` [PATCH v2 2/2] iio: trigger: Fix strange (ladder-type) indentation Andy Shevchenko
2021-04-04 17:57 ` [PATCH v2 1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one Jonathan Cameron
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-04-02 17:49 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, linux-kernel
Cc: Jonathan Cameron, Lars-Peter Clausen, Andy Shevchenko
By unknown reason device name is set with an index casted from int
to unsigned long while at the same time with "%ld" specifier. Both parts
seems wrong to me, thus replace replace explicit casting and wrong specifier
with proper one, i.e. "%d".
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: used %d which is really correct one
drivers/iio/industrialio-trigger.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index 32ac1bec25e3..78e30f0f915c 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -75,8 +75,7 @@ int __iio_trigger_register(struct iio_trigger *trig_info,
return trig_info->id;
/* Set the name used for the sysfs directory etc */
- dev_set_name(&trig_info->dev, "trigger%ld",
- (unsigned long) trig_info->id);
+ dev_set_name(&trig_info->dev, "trigger%d", trig_info->id);
ret = device_add(&trig_info->dev);
if (ret)
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] iio: trigger: Fix strange (ladder-type) indentation
2021-04-02 17:49 [PATCH v2 1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one Andy Shevchenko
@ 2021-04-02 17:49 ` Andy Shevchenko
2021-04-04 17:57 ` [PATCH v2 1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one Jonathan Cameron
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-04-02 17:49 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio, linux-kernel
Cc: Jonathan Cameron, Lars-Peter Clausen, Andy Shevchenko
In some cases indentation looks a bit weird with starting from = sign
and being in a ladder-type style. Unify it across the module.
While at it, add blank line after definition block where it needed,
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: fixed typo in the commit message (tupe->type)
drivers/iio/industrialio-trigger.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index 78e30f0f915c..ec72ff04b38d 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -211,6 +211,7 @@ EXPORT_SYMBOL(iio_trigger_notify_done);
static int iio_trigger_get_irq(struct iio_trigger *trig)
{
int ret;
+
mutex_lock(&trig->pool_lock);
ret = bitmap_find_free_region(trig->pool,
CONFIG_IIO_CONSUMERS_PER_TRIGGER,
@@ -239,9 +240,9 @@ static void iio_trigger_put_irq(struct iio_trigger *trig, int irq)
int iio_trigger_attach_poll_func(struct iio_trigger *trig,
struct iio_poll_func *pf)
{
+ bool notinuse =
+ bitmap_empty(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
int ret = 0;
- bool notinuse
- = bitmap_empty(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER);
/* Prevent the module from being removed whilst attached to a trigger */
__module_get(pf->indio_dev->driver_module);
@@ -290,11 +291,10 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig,
int iio_trigger_detach_poll_func(struct iio_trigger *trig,
struct iio_poll_func *pf)
{
+ bool no_other_users =
+ bitmap_weight(trig->pool, CONFIG_IIO_CONSUMERS_PER_TRIGGER) == 1;
int ret = 0;
- bool no_other_users
- = (bitmap_weight(trig->pool,
- CONFIG_IIO_CONSUMERS_PER_TRIGGER)
- == 1);
+
if (trig->ops && trig->ops->set_trigger_state && no_other_users) {
ret = trig->ops->set_trigger_state(trig, false);
if (ret)
@@ -312,6 +312,7 @@ int iio_trigger_detach_poll_func(struct iio_trigger *trig,
irqreturn_t iio_pollfunc_store_time(int irq, void *p)
{
struct iio_poll_func *pf = p;
+
pf->timestamp = iio_get_time_ns(pf->indio_dev);
return IRQ_WAKE_THREAD;
}
@@ -498,18 +499,16 @@ static const struct device_type iio_trig_type = {
static void iio_trig_subirqmask(struct irq_data *d)
{
struct irq_chip *chip = irq_data_get_irq_chip(d);
- struct iio_trigger *trig
- = container_of(chip,
- struct iio_trigger, subirq_chip);
+ struct iio_trigger *trig = container_of(chip, struct iio_trigger, subirq_chip);
+
trig->subirqs[d->irq - trig->subirq_base].enabled = false;
}
static void iio_trig_subirqunmask(struct irq_data *d)
{
struct irq_chip *chip = irq_data_get_irq_chip(d);
- struct iio_trigger *trig
- = container_of(chip,
- struct iio_trigger, subirq_chip);
+ struct iio_trigger *trig = container_of(chip, struct iio_trigger, subirq_chip);
+
trig->subirqs[d->irq - trig->subirq_base].enabled = true;
}
@@ -695,7 +694,7 @@ EXPORT_SYMBOL(iio_trigger_using_own);
* device, -EINVAL otherwise.
*/
int iio_trigger_validate_own_device(struct iio_trigger *trig,
- struct iio_dev *indio_dev)
+ struct iio_dev *indio_dev)
{
if (indio_dev->dev.parent != trig->dev.parent)
return -EINVAL;
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one
2021-04-02 17:49 [PATCH v2 1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one Andy Shevchenko
2021-04-02 17:49 ` [PATCH v2 2/2] iio: trigger: Fix strange (ladder-type) indentation Andy Shevchenko
@ 2021-04-04 17:57 ` Jonathan Cameron
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2021-04-04 17:57 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, linux-iio, linux-kernel, Lars-Peter Clausen
On Fri, 2 Apr 2021 20:49:10 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> By unknown reason device name is set with an index casted from int
> to unsigned long while at the same time with "%ld" specifier. Both parts
> seems wrong to me, thus replace replace explicit casting and wrong specifier
> with proper one, i.e. "%d".
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Series applied to the togreg branch of iio.git.
thanks,
Jonathan
> ---
> v2: used %d which is really correct one
> drivers/iio/industrialio-trigger.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> index 32ac1bec25e3..78e30f0f915c 100644
> --- a/drivers/iio/industrialio-trigger.c
> +++ b/drivers/iio/industrialio-trigger.c
> @@ -75,8 +75,7 @@ int __iio_trigger_register(struct iio_trigger *trig_info,
> return trig_info->id;
>
> /* Set the name used for the sysfs directory etc */
> - dev_set_name(&trig_info->dev, "trigger%ld",
> - (unsigned long) trig_info->id);
> + dev_set_name(&trig_info->dev, "trigger%d", trig_info->id);
>
> ret = device_add(&trig_info->dev);
> if (ret)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-04 17:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 17:49 [PATCH v2 1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one Andy Shevchenko
2021-04-02 17:49 ` [PATCH v2 2/2] iio: trigger: Fix strange (ladder-type) indentation Andy Shevchenko
2021-04-04 17:57 ` [PATCH v2 1/2] iio: trigger: Replace explicit casting and wrong specifier with proper one Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).