Skip to contentSkip to conversation

tpm/st33zp24: Switch to devm_acpi_dev_add_driver_gpios()

PATCH In review Andy Shevchenko 2 participants 2 messages Jun 12, 2017 – Jun 19, 2017 1 message not in the archive TPM device driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm/st33zp24: Switch to devm_acpi_dev_add_driver_gpios()

Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify error path and fix potentially wrong assignment if ->probe() fails.

---
 drivers/char/tpm/st33zp24/i2c.c | 3 +--
 drivers/char/tpm/st33zp24/spi.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/char/tpm/st33zp24/i2c.c +1 -2
index 1b10e38f214e..be5d1abd3e8e 100644
@@ -127,7 +127,7 @@ static int st33zp24_i2c_acpi_request_resources(struct i2c_client *client)
 	struct device *dev = &client->dev;
 	int ret;
 
-	ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_st33zp24_gpios);
+	ret = devm_acpi_dev_add_driver_gpios(dev, acpi_st33zp24_gpios);
 	if (ret)
 		return ret;
 
@@ -285,7 +285,6 @@ static int st33zp24_i2c_remove(struct i2c_client *client)
 	if (ret)
 		return ret;
 
-	acpi_dev_remove_driver_gpios(ACPI_COMPANION(&client->dev));
 	return 0;
 }
 
drivers/char/tpm/st33zp24/spi.c +1 -2
index c69d15198f84..0fc4f20b5f83 100644
@@ -246,7 +246,7 @@ static int st33zp24_spi_acpi_request_resources(struct spi_device *spi_dev)
 	struct device *dev = &spi_dev->dev;
 	int ret;
 
-	ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_st33zp24_gpios);
+	ret = devm_acpi_dev_add_driver_gpios(dev, acpi_st33zp24_gpios);
 	if (ret)
 		return ret;
 
@@ -402,7 +402,6 @@ static int st33zp24_spi_remove(struct spi_device *dev)
 	if (ret)
 		return ret;
 
-	acpi_dev_remove_driver_gpios(ACPI_COMPANION(&dev->dev));
 	return 0;
 }
 
Signature · 6 lines
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Reviewed-by Tested-by
#2 lore raw
In reply to a message not in the archive
Quoted 1 line · Andy Shevchenko

Switch to use managed variant of acpi_dev_add_driver_gpios() to

simplify

Quoted 3 lines

error path and fix potentially wrong assignment if ->probe() fails.

(compilation)

/Jarkko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tpmdd-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel