Skip to content

Commit 9d33595

Browse files
jbrun3tpH5
authored andcommitted
reset: mpfs: use the auxiliary device creation
The auxiliary device creation of this driver is simple enough to use the available auxiliary device creation helper. Use it and remove some boilerplate code. Acked-by: Conor Dooley <conor.dooley@microchip.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20250611-rst-mpfs-aux-v1-1-c86534b473c3@baylibre.com Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
1 parent fd4a06a commit 9d33595

1 file changed

Lines changed: 5 additions & 51 deletions

File tree

drivers/reset/reset-mpfs.c

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -155,62 +155,16 @@ static int mpfs_reset_probe(struct auxiliary_device *adev,
155155
return devm_reset_controller_register(dev, rcdev);
156156
}
157157

158-
static void mpfs_reset_unregister_adev(void *_adev)
159-
{
160-
struct auxiliary_device *adev = _adev;
161-
162-
auxiliary_device_delete(adev);
163-
auxiliary_device_uninit(adev);
164-
}
165-
166-
static void mpfs_reset_adev_release(struct device *dev)
167-
{
168-
struct auxiliary_device *adev = to_auxiliary_dev(dev);
169-
170-
kfree(adev);
171-
}
172-
173-
static struct auxiliary_device *mpfs_reset_adev_alloc(struct device *clk_dev)
174-
{
175-
struct auxiliary_device *adev;
176-
int ret;
177-
178-
adev = kzalloc(sizeof(*adev), GFP_KERNEL);
179-
if (!adev)
180-
return ERR_PTR(-ENOMEM);
181-
182-
adev->name = "reset-mpfs";
183-
adev->dev.parent = clk_dev;
184-
adev->dev.release = mpfs_reset_adev_release;
185-
adev->id = 666u;
186-
187-
ret = auxiliary_device_init(adev);
188-
if (ret) {
189-
kfree(adev);
190-
return ERR_PTR(ret);
191-
}
192-
193-
return adev;
194-
}
195-
196158
int mpfs_reset_controller_register(struct device *clk_dev, void __iomem *base)
197159
{
198160
struct auxiliary_device *adev;
199-
int ret;
200161

201-
adev = mpfs_reset_adev_alloc(clk_dev);
202-
if (IS_ERR(adev))
203-
return PTR_ERR(adev);
204-
205-
ret = auxiliary_device_add(adev);
206-
if (ret) {
207-
auxiliary_device_uninit(adev);
208-
return ret;
209-
}
210-
211-
adev->dev.platform_data = (__force void *)base;
162+
adev = devm_auxiliary_device_create(clk_dev, "reset-mpfs",
163+
(__force void *)base);
164+
if (!adev)
165+
return -ENODEV;
212166

213-
return devm_add_action_or_reset(clk_dev, mpfs_reset_unregister_adev, adev);
167+
return 0;
214168
}
215169
EXPORT_SYMBOL_NS_GPL(mpfs_reset_controller_register, "MCHP_CLK_MPFS");
216170

0 commit comments

Comments
 (0)