linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>
Cc: linux-can <linux-can@vger.kernel.org>,
	Arunachalam Santhanam <arunachalam.santhanam@in.bosch.com>
Subject: Re: [PATCH v12 1/1] can: usb: etas_es58X: add support for ETAS ES58X CAN USB interfaces
Date: Tue, 9 Mar 2021 21:26:37 +0100	[thread overview]
Message-ID: <20210309202637.mmenugxlsscvhdtx@pengutronix.de> (raw)
In-Reply-To: <CAMZ6RqKR3HYrJvc+=rXK40Yq=L3pgvTWwgC=reYWSN9XdQ4ksg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2298 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2021-03-09 20:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 16:34 [PATCH v12 0/1] Introducing ETAS ES58X CAN USB interfaces Vincent Mailhol
2021-03-09  8:30 ` Jimmy Assarsson
2021-03-09 12:18   ` Vincent MAILHOL
2021-03-09 12:21     ` Jimmy Assarsson
     [not found] ` <20210308163445.103636-2-mailhol.vincent@wanadoo.fr>
2021-03-09 10:27   ` [PATCH v12 1/1] can: usb: etas_es58X: add support for " Marc Kleine-Budde
2021-03-09 12:45     ` Vincent MAILHOL
2021-03-09 12:57       ` Marc Kleine-Budde
2021-03-09 13:10         ` Vincent MAILHOL
2021-03-09 15:35           ` Marc Kleine-Budde
2021-03-09 17:54             ` Vincent MAILHOL
2021-03-09 18:26               ` Vincent MAILHOL
2021-03-09 20:26                 ` Marc Kleine-Budde [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210309202637.mmenugxlsscvhdtx@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=arunachalam.santhanam@in.bosch.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).