Message ID | 20201022155858.20867-6-nsaenzjulienne@suse.de |
---|---|
State | New |
Headers | show |
Series | Raspberry Pi PoE HAT fan support | expand |
On Thu, 2020-10-22 at 17:58 +0200, Nicolas Saenz Julienne wrote: > Upon unbinding the device make sure we release RPi's firmware interface. > > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> > --- > drivers/soc/bcm/raspberrypi-power.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/soc/bcm/raspberrypi-power.c b/drivers/soc/bcm/raspberrypi-power.c > index 5d1aacdd84ef..a0b38db5886c 100644 > --- a/drivers/soc/bcm/raspberrypi-power.c > +++ b/drivers/soc/bcm/raspberrypi-power.c > @@ -225,6 +225,20 @@ static int rpi_power_probe(struct platform_device *pdev) > return 0; > } > > +static int rpi_power_remove(struct platform_device *pdev) > +{ > + struct rpi_power_domains *rpi_domains = platform_get_drvdata(pdev); > + > + of_genpd_del_provider(dev->of_node); > + > + for (i = 0; i < RPI_POWER_DOMAIN_COUNT; i++) > + pm_genpd_remove(&rpi_domains->domains[i].base); > + > + rpi_firmware_put(rpi_domaina->fw); I Just realised I failed to squash a fix for this patch, so this will not build. Sorry for that. Regards, Nicolas > + > + return 0; > +} > + > static const struct of_device_id rpi_power_of_match[] = { > { .compatible = "raspberrypi,bcm2835-power", }, > {}, > @@ -237,6 +251,7 @@ static struct platform_driver rpi_power_driver = { > .of_match_table = rpi_power_of_match, > }, > .probe = rpi_power_probe, > + .remove = rpi_power_remove, > }; > builtin_platform_driver(rpi_power_driver); >
diff --git a/drivers/soc/bcm/raspberrypi-power.c b/drivers/soc/bcm/raspberrypi-power.c index 5d1aacdd84ef..a0b38db5886c 100644 --- a/drivers/soc/bcm/raspberrypi-power.c +++ b/drivers/soc/bcm/raspberrypi-power.c @@ -225,6 +225,20 @@ static int rpi_power_probe(struct platform_device *pdev) return 0; } +static int rpi_power_remove(struct platform_device *pdev) +{ + struct rpi_power_domains *rpi_domains = platform_get_drvdata(pdev); + + of_genpd_del_provider(dev->of_node); + + for (i = 0; i < RPI_POWER_DOMAIN_COUNT; i++) + pm_genpd_remove(&rpi_domains->domains[i].base); + + rpi_firmware_put(rpi_domaina->fw); + + return 0; +} + static const struct of_device_id rpi_power_of_match[] = { { .compatible = "raspberrypi,bcm2835-power", }, {}, @@ -237,6 +251,7 @@ static struct platform_driver rpi_power_driver = { .of_match_table = rpi_power_of_match, }, .probe = rpi_power_probe, + .remove = rpi_power_remove, }; builtin_platform_driver(rpi_power_driver);
Upon unbinding the device make sure we release RPi's firmware interface. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> --- drivers/soc/bcm/raspberrypi-power.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)