Re: [PATCH v12 1/1] can: usb: etas_es58X: add support for ETAS ES58X CAN USB interfaces

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

 



On 10.03.2021 03:26:12, Vincent MAILHOL wrote:
> > > > @@ -136,3 +136,11 @@ void dql_init(struct dql *dql, unsigned int hold_time)
> > > >       dql_reset(dql);
> > > >  }
> > > >  EXPORT_SYMBOL(dql_init);
> > > > +
> > > > +void dql_set_min_limit(struct dql *dql, unsigned int min_limit)
> > > > +{
> > > > +#ifdef CONFIG_BQL
> > >
> > > remove this ifdef
> > >
> > > > +     dql->min_limit = min_limit;
> > > > +#endif
> > > > +}
> > > > +EXPORT_SYMBOL(dql_set_min_limit);

Just for completeness. If it would be a real function, the kernel way
would be:

#ifdef CONFIG_BQL
void dql_set_min_limit(struct dql *dql, unsigned int min_limit)
{
     dql->min_limit = min_limit;
}

EXPORT_SYMBOL(dql_set_min_limit);
#endif

...and have a static inline no-op in the header file.

> >
> > Actually, after doing a few more tests, this is a bit more complicated
> > than anticipated.
> > The dql member of struct netdev_queue is also guarded by a #ifdef CONFIG_BQL:
> > https://elixir.bootlin.com/linux/latest/source/include/linux/netdevice.h#L629
> >
> > This means that under the current idea, we would also need to guard
> > the call to dql_set_min_limit():
> > #ifdef CONFIG_BQL
> >     dql_set_min_limit(&netdev_get_tx_queue(netdev, 0)->dql,
> >               es58x_dev->param->dql_limit_min);
> > #ifdef CONFIG_BQL
> >
> > This kills the initial intent of not using the #ifdef CONFIG_BQL to
> > set the value.
> >
> > This leads to the need to do:
> > void netdev_queue_set_dql_min_limit(struct netdev_queue *q, unsigned int min_limit)
> 
> Of course, I meant:
> static inline void netdev_queue_set_dql_min_limit(struct netdev_queue
> *q, unsigned int min_limit)
> 
> > {
> > #ifdef CONFIG_BQL
> >     q->dql.min_limit = min_limit;
> > #endif
> > }
> > which would probably be inside /include/linux/netdevice.h.
> >
> > Does it make sense?

Yes, or the other way in illustrated above, if someone doesn't like
static inlines with ifdefs inside the function.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux