lkml.org 
[lkml]   [2024]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] clock, reset: microchip: move all mpfs reset code to the reset subsystem
On Wed, Apr 24, 2024 at 11:33:32AM -0700, Stephen Boyd wrote:
> Quoting Conor Dooley (2024-04-24 01:42:08)
> > diff --git a/drivers/reset/reset-mpfs.c b/drivers/reset/reset-mpfs.c
> > index 7f3fb2d472f4..710f9c1676f9 100644
> > --- a/drivers/reset/reset-mpfs.c
> > +++ b/drivers/reset/reset-mpfs.c
> > @@ -121,11 +135,15 @@ static int mpfs_reset_probe(struct auxiliary_device *adev,
> > {
> > struct device *dev = &adev->dev;
> > struct reset_controller_dev *rcdev;
> > + struct mpfs_reset *rst;
> >
> > - rcdev = devm_kzalloc(dev, sizeof(*rcdev), GFP_KERNEL);
> > - if (!rcdev)
> > + rst = devm_kzalloc(dev, sizeof(*rst), GFP_KERNEL);
> > + if (!rst)
> > return -ENOMEM;
> >
> > + rst->base = (void __iomem *)adev->dev.platform_data;
>
> Can use dev_get_platdata() here?
>
> rst->base = (void __iomem *)dev_get_platdata(dev);
>
> That's sad that a cast is necessary. Does it need __force as well? An
> alternative would be to make a container struct for auxiliary_device and
> put the pointer there.


Ye, I dunno if it was sparse that yelled at me, but either it or the
compiler didn't approve. I don't really like the casting in and out, but
the alternative I don't find elegant either, so I picked the one I deemed
simpler. I'm happy to go with whichever you prefer.

And re: __force, AFAIU that's only required while discarding the
__iomem, so the cast into the platform_data has one:
adev->dev.platform_data = (__force void *)base;

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2024-04-24 22:21    [W:0.075 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site