diff mbox series

[v3,07/11] input: raspberrypi-ts: Release firmware handle when not needed

Message ID 20201104103938.1286-8-nsaenzjulienne@suse.de
State New
Headers show
Series Raspberry Pi PoE HAT fan support | expand

Commit Message

Nicolas Saenz Julienne Nov. 4, 2020, 10:39 a.m. UTC
Use devm_rpi_firmware_get() so as to make sure we release RPi's firmware
interface when unbinding the device.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

---

Changes since v2:
 - Use devm_rpi_firmware_get(), instead of remove function

 drivers/input/touchscreen/raspberrypi-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dmitry Torokhov Nov. 12, 2020, 1:45 a.m. UTC | #1
Hi Nicolas,

On Wed, Nov 04, 2020 at 11:39:33AM +0100, Nicolas Saenz Julienne wrote:
> Use devm_rpi_firmware_get() so as to make sure we release RPi's firmware

> interface when unbinding the device.


Unless I am mistaken this driver does not really need the firmware
structure past rpi_ts_probe(), and will be fine if it disappears earlier
than unbind time.

Thanks.

> 

> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

> 

> ---

> 

> Changes since v2:

>  - Use devm_rpi_firmware_get(), instead of remove function

> 

>  drivers/input/touchscreen/raspberrypi-ts.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/input/touchscreen/raspberrypi-ts.c b/drivers/input/touchscreen/raspberrypi-ts.c

> index ef6aaed217cf..efed0efa91d9 100644

> --- a/drivers/input/touchscreen/raspberrypi-ts.c

> +++ b/drivers/input/touchscreen/raspberrypi-ts.c

> @@ -134,7 +134,7 @@ static int rpi_ts_probe(struct platform_device *pdev)

>  		return -ENOENT;

>  	}

>  

> -	fw = rpi_firmware_get(fw_node);

> +	fw = devm_rpi_firmware_get(&pdev->dev, fw_node);

>  	of_node_put(fw_node);

>  	if (!fw)

>  		return -EPROBE_DEFER;

> -- 

> 2.29.1

> 


-- 
Dmitry
Nicolas Saenz Julienne Nov. 12, 2020, 9:06 a.m. UTC | #2
On Wed, 2020-11-11 at 17:45 -0800, Dmitry Torokhov wrote:
> Hi Nicolas,

> 

> On Wed, Nov 04, 2020 at 11:39:33AM +0100, Nicolas Saenz Julienne wrote:

> > Use devm_rpi_firmware_get() so as to make sure we release RPi's firmware

> > interface when unbinding the device.

> 

> Unless I am mistaken this driver does not really need the firmware

> structure past rpi_ts_probe(), and will be fine if it disappears earlier

> than unbind time.


Yes, I missed that. Will update it.

Regards,
Nicolas
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/raspberrypi-ts.c b/drivers/input/touchscreen/raspberrypi-ts.c
index ef6aaed217cf..efed0efa91d9 100644
--- a/drivers/input/touchscreen/raspberrypi-ts.c
+++ b/drivers/input/touchscreen/raspberrypi-ts.c
@@ -134,7 +134,7 @@  static int rpi_ts_probe(struct platform_device *pdev)
 		return -ENOENT;
 	}
 
-	fw = rpi_firmware_get(fw_node);
+	fw = devm_rpi_firmware_get(&pdev->dev, fw_node);
 	of_node_put(fw_node);
 	if (!fw)
 		return -EPROBE_DEFER;