LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Sven Van Asbroeck <thesven73@gmail.com>
Cc: devel@driverdev.osuosl.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] staging: fieldbus: anybuss: force address space conversion
Date: Tue, 21 May 2019 18:24:51 +0200 [thread overview]
Message-ID: <20190521162451.GA19139@kroah.com> (raw)
In-Reply-To: <CAGngYiU_iK5=swD_DA5PcOeYFT0zTrdQ+30Db0YrahuEukEP_A@mail.gmail.com>
On Tue, May 21, 2019 at 11:53:15AM -0400, Sven Van Asbroeck wrote:
> On Tue, May 21, 2019 at 11:42 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > Ick, if you are using __force, almost always something is wrong.
> >
>
> What if I create a separate structure for the regmap context ?
>
> struct anybus_regmap_context {
> void __iomem *base;
> };
>
> Then just store the base pointer inside the struct, and pass the struct
> as the regmap context:
>
> ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
> ctx->base = base;
> devm_regmap_init(..., ctx);
>
> static int write_reg_bus(void *context, unsigned int reg,
> unsigned int val)
> {
> struct anybus_regmap_context *ctx = context;
> <now access ctx->base>
> }
Ick, no.
> Penalty is an additional dynamic pointer-size
> allocation. Pro: it'll be formally correct ?
what is so odd about this code that makes you have to jump through
strange hoops that no other driver has to?
Just set your pointer types up properly to start with, and all should be
fine. Why are you trying to cast anything here?
thanks,
greg k-h
next prev parent reply other threads:[~2019-05-21 16:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-21 14:51 Sven Van Asbroeck
2019-05-21 15:10 ` Dan Carpenter
2019-05-21 15:19 ` Sven Van Asbroeck
2019-05-21 15:42 ` Greg KH
2019-05-21 15:53 ` Sven Van Asbroeck
2019-05-21 16:24 ` Greg KH [this message]
2019-05-21 16:53 ` Sven Van Asbroeck
2019-05-21 17:06 ` Sven Van Asbroeck
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=20190521162451.GA19139@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thesven73@gmail.com \
--subject='Re: [PATCH] staging: fieldbus: anybuss: force address space conversion' \
/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
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).