From: Lucas Stach <l.stach@pengutronix.de>
To: Oleksij Rempel <o.rempel@pengutronix.de>,
Shawn Guo <shawnguo@kernel.org>,
Fabio Estevam <fabio.estevam@nxp.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
"A.s. Dong" <aisheng.dong@nxp.com>,
Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: kernel@pengutronix.de, devicetree@vger.kernel.org,
dl-linux-imx <linux-imx@nxp.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 5/5] mailbox: Add support for i.MX7D messaging unit
Date: Tue, 24 Jul 2018 11:06:54 +0200 [thread overview]
Message-ID: <1532423214.32306.1.camel@pengutronix.de> (raw)
In-Reply-To: <eebba930-b3d7-3670-3d96-35cc6c2a6bcb@pengutronix.de>
Am Dienstag, den 24.07.2018, 07:14 +0200 schrieb Oleksij Rempel:
> Hi Lucas,
>
> here is more detailed response:
>
> On 23.07.2018 19:19, Lucas Stach wrote:
[...]
> > > +};
> > > +
> > > +static struct imx_mu_priv *to_imx_mu_priv(struct mbox_controller *mbox)
> > > +{
> > > > + return container_of(mbox, struct imx_mu_priv, mbox);
> > >
> > > +}
> > > +
> > > +static void imx_mu_write(struct imx_mu_priv *priv, u32 val, u32 offs)
> > > +{
> > > + iowrite32(val, priv->base + offs);
> >
> > This driver is never going to be used on a device with port based IO,
> > so iowrite doesn't make much sense here, just use writel. Same comment
> > applies to the below read function.
>
> As before I don't really understand the difference. I took some time for
> learning and here are my findings:
> - historical background of ioread/iowrite functions. What I can find is
> > this LWN article: https://lwn.net/Articles/102232/ . The main point
> seems to be "The first of these is a new __iomem annotation used to mark
> pointers to I/O memory" ... " As with __user, the __iomem marker serves
> a documentation role in the kernel code;"
>
> In modern kernel the difference between ioread32 and readl seems to be
> completely disappeared.
> with this LWN article (2016):
> https://lwn.net/Articles/698014/
> the readl and reade32 are always in the same group..
Okay, as discussed offline this is more a thing of personal preference,
since this maps to the same thing internally when used on a
architecture without IO ports. I slightly dislike those as they don't
have a _relaxed counterpart, but other than that there should be no
difference. As we don't use any of the relaxed stuff in this driver
it's really about the color of the bikeshed, so feel free to keep it
your way.
> If there is some documentation which will say why I should use readl()
> instead of ioread32() i would really love to read it.
>
> > Also, given that those functions are not really shortening the code in
> > the user they may also be removed completely IMHO.
>
> Wrong assumption.. I use this functions for tracing. It is just to easy
> to add two trace points... From technical perspective I don't see any
> advantage or disadvantage of having this functions.
> If it is my personal preference, then I decide to keep it.
That IMHO implies that I'm perfectly fine with you ignoring this
comment. :)
[...]
> > > +static int imx_mu_startup(struct mbox_chan *chan)
> > > +{
> > > > > > > > + struct imx_mu_priv *priv = to_imx_mu_priv(chan->mbox);
> > > > > > > > + struct imx_mu_con_priv *cp = chan->con_priv;
> > > > + int ret;
> > >
> > > +
> > > > > > > > + cp->irq_desc = devm_kasprintf(priv->dev, GFP_KERNEL, "imx_mu_chan[%i]",
> > > > > > > > + cp->idx);
> > > > > > > > + if (!cp->irq_desc)
> > > > + return -ENOMEM;
> > >
> > > +
> > > > + ret = devm_request_irq(priv->dev, cp->irq, imx_mu_isr,
> > >
> > > + IRQF_SHARED, cp->irq_desc, chan);
> >
> > Using the devm_ variants of those functions doesn't make sense when the
> > resources aren't tied to the device lifetime. As you are tearing them
> > down manually in imx_mu_shutdown anyways, just use the raw variants of
> > those functions.
>
> I have nothing against it.
Thanks, as this is something I feel more strongly about. As the devm_
stuff is meant to tie the lifetime of an object to the device/driver
lifetime using them in a context where there is no relation at all is
kind of an API abuse to me.
Regards,
Lucas
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2018-07-24 9:06 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-22 6:39 [PATCH v6 0/5] add mailbox support for i.MX7D Oleksij Rempel
2018-07-22 6:39 ` [PATCH v6 1/5] dt-bindings: mailbox: allow mbox-cells to be equal to 0 Oleksij Rempel
2018-07-22 6:39 ` [PATCH v6 2/5] dt-bindings: arm: fsl: add mu binding doc Oleksij Rempel
2018-07-22 6:39 ` [PATCH v6 3/5] dt-bindings: mailbox: imx-mu: add generic MU channel support Oleksij Rempel
2018-07-24 23:19 ` Rob Herring
2018-07-22 6:39 ` [PATCH v6 4/5] ARM: dts: imx7s: add i.MX7 messaging unit support Oleksij Rempel
2018-07-23 16:57 ` Lucas Stach
2018-07-24 2:04 ` A.s. Dong
2018-07-22 6:39 ` [PATCH v6 5/5] mailbox: Add support for i.MX7D messaging unit Oleksij Rempel
2018-07-23 17:19 ` Lucas Stach
2018-07-23 19:11 ` Oleksij Rempel
2018-07-24 2:09 ` A.s. Dong
2018-07-24 5:14 ` Oleksij Rempel
2018-07-24 9:06 ` Lucas Stach [this message]
2018-07-23 23:31 ` Vladimir Zapolskiy
2018-07-24 2:13 ` A.s. Dong
2018-07-24 4:38 ` Oleksij Rempel
2018-07-22 10:44 ` [PATCH v6 0/5] add mailbox support for i.MX7D A.s. Dong
2018-07-23 15:33 ` Jassi Brar
2018-07-24 2:18 ` A.s. Dong
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=1532423214.32306.1.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=aisheng.dong@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=fabio.estevam@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=mark.rutland@arm.com \
--cc=o.rempel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=shawnguo@kernel.org \
--cc=vladimir_zapolskiy@mentor.com \
/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).