From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Jimmy Assarsson <extja@kvaser.com>
Cc: linux-can@vger.kernel.org,
Jimmy Assarsson <jimmyassarsson@gmail.com>,
stable@vger.kernel.org
Subject: Re: [PATCH 1/2] can: kvaser_usb: kvaser_usb_leaf: Fix CAN clock frequency regression
Date: Thu, 2 Jun 2022 11:54:09 +0200 [thread overview]
Message-ID: <20220602095409.2ytxs4y6o7ctbcp7@pengutronix.de> (raw)
In-Reply-To: <a4866c5a-5516-06cb-fa1a-83e5014f6d36@kvaser.com>
[-- Attachment #1: Type: text/plain, Size: 2659 bytes --]
On 02.06.2022 11:22:31, Jimmy Assarsson wrote:
> > > diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
> > > index e67658b53d02..5880e9719c9d 100644
> > > --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
> > > +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
> > > @@ -94,10 +94,14 @@
> > > static inline bool kvaser_is_leaf(const struct usb_device_id *id)
> > > {
> > > - return (id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID &&
> > > - id->idProduct <= USB_CAN_R_PRODUCT_ID) ||
> > > - (id->idProduct >= USB_LEAF_LITE_V2_PRODUCT_ID &&
> > > - id->idProduct <= USB_LEAF_PRODUCT_ID_END);
> > > + return id->idProduct >= USB_LEAF_DEVEL_PRODUCT_ID &&
> > > + id->idProduct <= USB_CAN_R_PRODUCT_ID;
> > > +}
> > > +
> > > +static inline bool kvaser_is_leafimx(const struct usb_device_id *id)
> > > +{
> > > + return id->idProduct >= USB_LEAF_LITE_V2_PRODUCT_ID &&
> > > + id->idProduct <= USB_LEAF_PRODUCT_ID_END;
> > > }
> >
> > Is this getting a bit complicated now?
> > In this driver we have:
> >
> > 1) struct usb_device_id::driver_info
> > 2) kvaser_is_*()
> >
> > which is used to set
> >
> > 3) dev->card_data.leaf.family
> > 4) dev->ops
> >
> > and now you're adding:
> >
> > 5) dev->card_data.quirks
> >
> > which then affects
> >
> > 6) dev->cfg
> >
> > The straight forward way would be to define a struct that describes the
> > a device completely:
> >
> > struct kvaser_driver_info {
> > u32 quirks; /* KVASER_USB_HAS_ */
> > enum kvaser_usb_leaf_family;
> > const struct kvaser_usb_dev_*ops;
> > const struct kvaser_usb_dev_*cfg;
> > };
> >
> > and then assign that to every device listed in the kvaser_usb_table.
>
> Thanks for the feedback!
> I agree, but I prefer if we can keep assigning dev->cfg based on the
> information that we get from the device.
Ok, if you cannot tell from the USB product ID.
> So we get:
> struct kvaser_driver_info {
> u32 quirks; /* KVASER_USB_HAS_ */
That holds the existing quirks and the new one.
> enum kvaser_usb_leaf_family;
> const struct kvaser_usb_dev_*ops;
> };
> And quirks and family still affect dev->cfg.
...as is depends on sw_options read from the device?
regards,
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 --]
next prev parent reply other threads:[~2022-06-02 9:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 6:30 [PATCH 0/2] can: kvaser_usb: CAN clock frequency regression Jimmy Assarsson
2022-06-02 6:30 ` [PATCH 1/2] can: kvaser_usb: kvaser_usb_leaf: Fix " Jimmy Assarsson
2022-06-02 8:02 ` Marc Kleine-Budde
2022-06-02 9:22 ` Jimmy Assarsson
2022-06-02 9:54 ` Marc Kleine-Budde [this message]
2022-06-02 10:07 ` Jimmy Assarsson
2022-06-02 6:30 ` [PATCH 2/2] can: kvaser_usb: kvaser_usb_leaf: Fix bittiming limits Jimmy Assarsson
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=20220602095409.2ytxs4y6o7ctbcp7@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=extja@kvaser.com \
--cc=jimmyassarsson@gmail.com \
--cc=linux-can@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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).