[PATCH v2] clock, reset: microchip: move all mpfs reset code to the reset subsystem

Stephen Boyd sboyd at kernel.org
Wed Apr 24 14:09:44 PDT 2024


Quoting Conor Dooley (2024-04-24 13:19:04)
> 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.

I don't really care. Am I supposed to pick this patch up?

> 
> 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;
> 

Ah, ok. Thanks for the remind.



More information about the linux-riscv mailing list