linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev
@ 2023-01-16 15:46 Andy Shevchenko
  2023-01-16 15:46 ` [PATCH v2 2/2] HID: i2c-hid: acpi: Unify ACPI ID tables format Andy Shevchenko
  2023-01-18  9:06 ` [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev Jiri Kosina
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2023-01-16 15:46 UTC (permalink / raw)
  To: Dmitry Torokhov, Raul E Rangel, Benjamin Tissoires, linux-input,
	linux-kernel
  Cc: Jiri Kosina, Andy Shevchenko

The driver is enumerated on ACPI platforms, so adev is valid.
Since there is no valid I²C ID table provided, there is no
possibility to bind a device to this driver via user space.
Hence, drop unneeded NULL check of adev.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 drivers/hid/i2c-hid/i2c-hid-acpi.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid-acpi.c b/drivers/hid/i2c-hid/i2c-hid-acpi.c
index 375c77c3db74..5e28da45e762 100644
--- a/drivers/hid/i2c-hid/i2c-hid-acpi.c
+++ b/drivers/hid/i2c-hid/i2c-hid-acpi.c
@@ -48,8 +48,9 @@ static guid_t i2c_hid_guid =
 	GUID_INIT(0x3CDFF6F7, 0x4267, 0x4555,
 		  0xAD, 0x05, 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE);
 
-static int i2c_hid_acpi_get_descriptor(struct acpi_device *adev)
+static int i2c_hid_acpi_get_descriptor(struct i2c_hid_acpi *ihid_acpi)
 {
+	struct acpi_device *adev = ihid_acpi->adev;
 	acpi_handle handle = acpi_device_handle(adev);
 	union acpi_object *obj;
 	u16 hid_descriptor_address;
@@ -81,29 +82,22 @@ static int i2c_hid_acpi_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
 	struct i2c_hid_acpi *ihid_acpi;
-	struct acpi_device *adev;
 	u16 hid_descriptor_address;
 	int ret;
 
-	adev = ACPI_COMPANION(dev);
-	if (!adev) {
-		dev_err(&client->dev, "Error could not get ACPI device\n");
-		return -ENODEV;
-	}
-
 	ihid_acpi = devm_kzalloc(&client->dev, sizeof(*ihid_acpi), GFP_KERNEL);
 	if (!ihid_acpi)
 		return -ENOMEM;
 
-	ihid_acpi->adev = adev;
+	ihid_acpi->adev = ACPI_COMPANION(dev);
 	ihid_acpi->ops.shutdown_tail = i2c_hid_acpi_shutdown_tail;
 
-	ret = i2c_hid_acpi_get_descriptor(adev);
+	ret = i2c_hid_acpi_get_descriptor(ihid_acpi);
 	if (ret < 0)
 		return ret;
 	hid_descriptor_address = ret;
 
-	acpi_device_fix_up_power(adev);
+	acpi_device_fix_up_power(ihid_acpi->adev);
 
 	return i2c_hid_core_probe(client, &ihid_acpi->ops,
 				  hid_descriptor_address, 0);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] HID: i2c-hid: acpi: Unify ACPI ID tables format
  2023-01-16 15:46 [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev Andy Shevchenko
@ 2023-01-16 15:46 ` Andy Shevchenko
  2023-01-18  9:06 ` [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev Jiri Kosina
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2023-01-16 15:46 UTC (permalink / raw)
  To: Dmitry Torokhov, Raul E Rangel, Benjamin Tissoires, linux-input,
	linux-kernel
  Cc: Jiri Kosina, Andy Shevchenko

Unify ACPI ID tables format by:
- surrounding HID by spaces
- dropping unnecessary driver_data assignment to 0
- dropping comma at the terminator entry

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: no changes
 drivers/hid/i2c-hid/i2c-hid-acpi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid-acpi.c b/drivers/hid/i2c-hid/i2c-hid-acpi.c
index 5e28da45e762..3a7e2bcb5412 100644
--- a/drivers/hid/i2c-hid/i2c-hid-acpi.c
+++ b/drivers/hid/i2c-hid/i2c-hid-acpi.c
@@ -39,8 +39,8 @@ static const struct acpi_device_id i2c_hid_acpi_blacklist[] = {
 	 * The CHPN0001 ACPI device, which is used to describe the Chipone
 	 * ICN8505 controller, has a _CID of PNP0C50 but is not HID compatible.
 	 */
-	{"CHPN0001", 0 },
-	{ },
+	{ "CHPN0001" },
+	{ }
 };
 
 /* HID I²C Device: 3cdff6f7-4267-4555-ad05-b30a3d8938de */
@@ -104,9 +104,9 @@ static int i2c_hid_acpi_probe(struct i2c_client *client)
 }
 
 static const struct acpi_device_id i2c_hid_acpi_match[] = {
-	{"ACPI0C50", 0 },
-	{"PNP0C50", 0 },
-	{ },
+	{ "ACPI0C50" },
+	{ "PNP0C50" },
+	{ }
 };
 MODULE_DEVICE_TABLE(acpi, i2c_hid_acpi_match);
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev
  2023-01-16 15:46 [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev Andy Shevchenko
  2023-01-16 15:46 ` [PATCH v2 2/2] HID: i2c-hid: acpi: Unify ACPI ID tables format Andy Shevchenko
@ 2023-01-18  9:06 ` Jiri Kosina
  2023-01-18 10:00   ` Andy Shevchenko
  1 sibling, 1 reply; 4+ messages in thread
From: Jiri Kosina @ 2023-01-18  9:06 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Torokhov, Raul E Rangel, Benjamin Tissoires, linux-input,
	linux-kernel

On Mon, 16 Jan 2023, Andy Shevchenko wrote:

> The driver is enumerated on ACPI platforms, so adev is valid.
> Since there is no valid I²C ID table provided, there is no
> possibility to bind a device to this driver via user space.
> Hence, drop unneeded NULL check of adev.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied both to hid.git#for-6.3/i2c-hid. Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev
  2023-01-18  9:06 ` [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev Jiri Kosina
@ 2023-01-18 10:00   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2023-01-18 10:00 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Dmitry Torokhov, Raul E Rangel, Benjamin Tissoires, linux-input,
	linux-kernel

On Wed, Jan 18, 2023 at 10:06:32AM +0100, Jiri Kosina wrote:
> On Mon, 16 Jan 2023, Andy Shevchenko wrote:
> 
> > The driver is enumerated on ACPI platforms, so adev is valid.
> > Since there is no valid I²C ID table provided, there is no
> > possibility to bind a device to this driver via user space.
> > Hence, drop unneeded NULL check of adev.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Applied both to hid.git#for-6.3/i2c-hid. Thanks,

Thank you and HNY!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-18 10:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 15:46 [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev Andy Shevchenko
2023-01-16 15:46 ` [PATCH v2 2/2] HID: i2c-hid: acpi: Unify ACPI ID tables format Andy Shevchenko
2023-01-18  9:06 ` [PATCH v2 1/2] HID: i2c-hid: acpi: Drop unneded NULL check of adev Jiri Kosina
2023-01-18 10:00   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).