[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGngYiU_iK5=swD_DA5PcOeYFT0zTrdQ+30Db0YrahuEukEP_A@mail.gmail.com>
Date: Tue, 21 May 2019 11:53:15 -0400
From: Sven Van Asbroeck <thesven73@...il.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
devel@...verdev.osuosl.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] staging: fieldbus: anybuss: force address space conversion
On Tue, May 21, 2019 at 11:42 AM Greg KH <gregkh@...uxfoundation.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>
}
Penalty is an additional dynamic pointer-size
allocation. Pro: it'll be formally correct ?
Powered by blists - more mailing lists