diff mbox series

[2/2] char: tpm: cr50_i2c: convert to new probe interface

Message ID 20210723184150.2596604-2-adrian.ratiu@collabora.com (mailing list archive)
State New, archived
Headers show
Series [1/2] char: tpm: Kconfig: remove bad i2c cr50 select | expand

Commit Message

Adrian Ratiu July 23, 2021, 6:41 p.m. UTC
Way back when this driver was written the i2c framework
used to insist an ID table be defined even if the driver
did not use it in favor of ACPI/OF matching, so it was
added just to placate the hard i2c framework requirement.

This is no longer the case so we can drop the table and
also convert the driver to the new probe interface.

Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
---
 drivers/char/tpm/tpm_tis_i2c_cr50.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

jarkko@kernel.org July 27, 2021, 3:08 a.m. UTC | #1
On Fri, Jul 23, 2021 at 09:41:50PM +0300, Adrian Ratiu wrote:
> Way back when this driver was written the i2c framework

Nit: I2C (not i2c)

> used to insist an ID table be defined even if the driver
> did not use it in favor of ACPI/OF matching, so it was
> added just to placate the hard i2c framework requirement.

Ditto.

> This is no longer the case so we can drop the table and
> also convert the driver to the new probe interface.
> 
> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
> ---
>  drivers/char/tpm/tpm_tis_i2c_cr50.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis_i2c_cr50.c
> index 44dde2fbe2fb..c89278103703 100644
> --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c
> +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c
> @@ -639,12 +639,6 @@ static const struct tpm_class_ops cr50_i2c = {
>  	.req_canceled = &tpm_cr50_i2c_req_canceled,
>  };
>  
> -static const struct i2c_device_id cr50_i2c_table[] = {
> -	{"cr50_i2c", 0},
> -	{}
> -};
> -MODULE_DEVICE_TABLE(i2c, cr50_i2c_table);
> -
>  #ifdef CONFIG_ACPI
>  static const struct acpi_device_id cr50_i2c_acpi_id[] = {
>  	{ "GOOG0005", 0 },
> @@ -670,8 +664,7 @@ MODULE_DEVICE_TABLE(of, of_cr50_i2c_match);
>   * - 0:		Success.
>   * - -errno:	A POSIX error code.
>   */
> -static int tpm_cr50_i2c_probe(struct i2c_client *client,
> -			      const struct i2c_device_id *id)
> +static int tpm_cr50_i2c_probe(struct i2c_client *client)
>  {
>  	struct tpm_i2c_cr50_priv_data *priv;
>  	struct device *dev = &client->dev;
> @@ -774,8 +767,7 @@ static int tpm_cr50_i2c_remove(struct i2c_client *client)
>  static SIMPLE_DEV_PM_OPS(cr50_i2c_pm, tpm_pm_suspend, tpm_pm_resume);
>  
>  static struct i2c_driver cr50_i2c_driver = {
> -	.id_table = cr50_i2c_table,
> -	.probe = tpm_cr50_i2c_probe,
> +	.probe_new = tpm_cr50_i2c_probe,
>  	.remove = tpm_cr50_i2c_remove,
>  	.driver = {
>  		.name = "cr50_i2c",
> -- 
> 2.32.0
> 
> 

Otherwise, LGTM

/Jarkko
diff mbox series

Patch

diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis_i2c_cr50.c
index 44dde2fbe2fb..c89278103703 100644
--- a/drivers/char/tpm/tpm_tis_i2c_cr50.c
+++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c
@@ -639,12 +639,6 @@  static const struct tpm_class_ops cr50_i2c = {
 	.req_canceled = &tpm_cr50_i2c_req_canceled,
 };
 
-static const struct i2c_device_id cr50_i2c_table[] = {
-	{"cr50_i2c", 0},
-	{}
-};
-MODULE_DEVICE_TABLE(i2c, cr50_i2c_table);
-
 #ifdef CONFIG_ACPI
 static const struct acpi_device_id cr50_i2c_acpi_id[] = {
 	{ "GOOG0005", 0 },
@@ -670,8 +664,7 @@  MODULE_DEVICE_TABLE(of, of_cr50_i2c_match);
  * - 0:		Success.
  * - -errno:	A POSIX error code.
  */
-static int tpm_cr50_i2c_probe(struct i2c_client *client,
-			      const struct i2c_device_id *id)
+static int tpm_cr50_i2c_probe(struct i2c_client *client)
 {
 	struct tpm_i2c_cr50_priv_data *priv;
 	struct device *dev = &client->dev;
@@ -774,8 +767,7 @@  static int tpm_cr50_i2c_remove(struct i2c_client *client)
 static SIMPLE_DEV_PM_OPS(cr50_i2c_pm, tpm_pm_suspend, tpm_pm_resume);
 
 static struct i2c_driver cr50_i2c_driver = {
-	.id_table = cr50_i2c_table,
-	.probe = tpm_cr50_i2c_probe,
+	.probe_new = tpm_cr50_i2c_probe,
 	.remove = tpm_cr50_i2c_remove,
 	.driver = {
 		.name = "cr50_i2c",