[<prev] [next>] [day] [month] [year] [list]
Message-ID:
<ZQ2PR01MB13076C761C45F2D5834DA718E64F2@ZQ2PR01MB1307.CHNPR01.prod.partner.outlook.cn>
Date: Fri, 25 Oct 2024 02:11:09 +0000
From: Hal Feng <hal.feng@...rfivetech.com>
To: Andrew Lunn <andrew@...n.ch>
CC: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Marc Kleine-Budde <mkl@...gutronix.de>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>, "David S . Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Philipp Zabel
<p.zabel@...gutronix.de>, Palmer Dabbelt <palmer@...belt.com>, Paul Walmsley
<paul.walmsley@...ive.com>, Albert Ou <aou@...s.berkeley.edu>, Emil Renner
Berthing <emil.renner.berthing@...onical.com>, William Qiu
<william.qiu@...rfivetech.com>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, "linux-can@...r.kernel.org"
<linux-can@...r.kernel.org>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "linux-riscv@...ts.infradead.org"
<linux-riscv@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 3/4] can: Add driver for CAST CAN Bus Controller
> On 23.9.24 20:13, Andrew Lunn wrote:
> > > > + reset_test = ccan_read_reg_8bit(priv, CCAN_CFG_STAT);
> > > > +
> > > > + if (!(reset_test & CCAN_RST_MASK)) {
> > > > + netdev_alert(ndev, "Not in reset mode, cannot set bit
> > > timing\n");
> > > > + return -EPERM;
> > > > + }
> > >
> > >
> > > You don't see nedev_alert() used very often. If this is fatal then
> netdev_err().
> > >
> > > Also, EPERM? man 3 errno say:
> > >
> > > EPERM Operation not permitted (POSIX.1-2001).
> > >
> > > Why is this a permission issue?
> >
> > Will use netdev_err() and return -EWOULDBLOCK instead.
>
> I'm not sure that is any better.
>
> EAGAIN Resource temporarily unavailable (may be the same value
> as EWOULDBLOCK) (POSIX.1-2001).
>
> This is generally used when the kernel expects user space to try a system call
> again, and it might then work. Is that what you expect here?
The bit timing should only be set when the module is in reset mode.
So we return an error here if the module is not in the correct mode.
Could you give me some suggestions about the return value here?
>
> > > > +static irqreturn_t ccan_interrupt(int irq, void *dev_id) {
> > > > + struct net_device *ndev = (struct net_device *)dev_id;
> > >
> > > dev_id is a void *, so you don't need the cast.
> >
> > OK, drop it.
>
> Please look at the whole patch. There might be other instances where a void *
> is used with a cast, which can be removed. This was just the first i spotted.
OK. Will modify for the whole patch.
Best regards,
Hal
Powered by blists - more mailing lists