Re: [PATCH 2/3] iio: Add __printf() attributes to various allocation functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 18 Sep 2020 16:25:05 +0300
Alexandru Ardelean <ardeleanalex@xxxxxxxxx> wrote:

> On Sun, Sep 13, 2020 at 4:24 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> >
> > A partial set of these was added to IIO a long time back.
> > This fills in some gaps in coverage highlighted by building
> > with W=1
> >  
> 
> Stylistically, it looks like plenty of these attributes are specified
> on a separate line before the function definition.
> Example:
> 
> __printf(1, 0)
> static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
> 
> It doesn't make much difference to me how it's placed.
> 
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>
Thanks. I've tweaked it wrt to both the feedback you gave and that
which Andy gave in the request to review thread.

So on this example we end up with
static printf(..)
struct

Thanks!

Jonathan

> 
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> > ---
> >  drivers/iio/industrialio-trigger.c   | 2 +-
> >  include/linux/iio/iio.h              | 4 ++--
> >  include/linux/iio/trigger_consumer.h | 2 +-
> >  3 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
> > index 6f16357fd732..adfe023cad48 100644
> > --- a/drivers/iio/industrialio-trigger.c
> > +++ b/drivers/iio/industrialio-trigger.c
> > @@ -516,7 +516,7 @@ static void iio_trig_subirqunmask(struct irq_data *d)
> >         trig->subirqs[d->irq - trig->subirq_base].enabled = true;
> >  }
> >
> > -static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
> > +__printf(1, 0) static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
> >  {
> >         struct iio_trigger *trig;
> >         int i;
> > diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
> > index e2df67a3b9ab..a02a3efad794 100644
> > --- a/include/linux/iio/iio.h
> > +++ b/include/linux/iio/iio.h
> > @@ -691,8 +691,8 @@ static inline void *iio_priv(const struct iio_dev *indio_dev)
> >
> >  void iio_device_free(struct iio_dev *indio_dev);
> >  struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
> > -struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
> > -                                               const char *fmt, ...);
> > +__printf(2, 3) struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
> > +                                                         const char *fmt, ...);
> >  /**
> >   * iio_buffer_enabled() - helper function to test if the buffer is enabled
> >   * @indio_dev:         IIO device structure for device
> > diff --git a/include/linux/iio/trigger_consumer.h b/include/linux/iio/trigger_consumer.h
> > index 3aa2f132dd67..2c05dfad88d7 100644
> > --- a/include/linux/iio/trigger_consumer.h
> > +++ b/include/linux/iio/trigger_consumer.h
> > @@ -38,7 +38,7 @@ struct iio_poll_func {
> >  };
> >
> >
> > -struct iio_poll_func
> > +__printf(5, 6) struct iio_poll_func
> >  *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
> >                     irqreturn_t (*thread)(int irq, void *p),
> >                     int type,
> > --
> > 2.28.0
> >  




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux