From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A34412170AB; Thu, 24 Oct 2024 19:12:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797128; cv=none; b=n2K4sttpjXg7lFqew2HgqLhxwV+rfZoZI3H8hZ2Gg7fI9XmJVSTHxl0WM/FrFwnEultWZH5uM6Lxsz2ZX6vCD0q2KP4YEgRJTR3pJCSZvCvELbO12Isk0IglOsvcCkFXEqo3oyuNru8jJhH8uNVeqb96YZHPuWn/3g1ZFOl0CxE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797128; c=relaxed/simple; bh=vsc6MrVXxXDuLAESj8xZHll4k7qRnzwifVhQvxdNI/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K6IdWoVECs5mGXzFFia/LiXZ/nYsG+TKiKqqgOhu9tDIS4+eU3QCAYsadXX9U8oK6RsIHs1Li4pmjVUl8IJBLhyUua8HmPuNwShecr6oK04uTj4IJ9KoE+EsPSJdnFvsMZkKYDfBR5kTrS1jMTloBLPHdqgBDnDwNFaylyOV80E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bwvql+L9; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bwvql+L9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797126; x=1761333126; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vsc6MrVXxXDuLAESj8xZHll4k7qRnzwifVhQvxdNI/U=; b=bwvql+L9CIAj0oFhIB9mSr7I8/HUN9vYCY+Go1T3+5p5xc1ElgP74Exk +1HzJyOPzaGliRDkoQe7FkGrS3pdpvk5aSPjo8luw3N12Ul/3Gm6DEDNt PDDoOJW1RH8F38EtkKL52aJ9btzy/nTbdx8wN/kKtMXvPj/WhPo5FtYKQ e3JPun/mLHGCvDYFfACn/u9wNQo3bir8/dPIQnxdG+UcJbaBgBPhMAThB zoiz22XcJK3wxI0qafGn0nYLG9iMaR93SuOO60hY/xYXS9JWp5Du4RURK kp1Hj4RzSziXBRAwYwyJwKAAChghUs6P+cVzP6nmbHCCPwhZByVw8b/Uc A==; X-CSE-ConnectionGUID: 9V7RnM5vQgSCUuTHHf9HNw== X-CSE-MsgGUID: vIJxjBIeTFuiSm4WE89VLw== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="29563163" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="29563163" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:05 -0700 X-CSE-ConnectionGUID: iMiqtcfNRsyurpJICUeIYw== X-CSE-MsgGUID: NQgD1t2mSXeXwFoO4infrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="85791718" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 24 Oct 2024 12:12:03 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1305913F; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 01/24] iio: magnetometer: bmc150: Drop dead code from the driver Date: Thu, 24 Oct 2024 22:04:50 +0300 Message-ID: <20241024191200.229894-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since there is no ACPI IDs for this driver to be served for, drop dead ACPI bits from it completely. Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/magnetometer/bmc150_magn.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetome= ter/bmc150_magn.c index 06d5a1ef1fbd..7de18c4a0ccb 100644 --- a/drivers/iio/magnetometer/bmc150_magn.c +++ b/drivers/iio/magnetometer/bmc150_magn.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -855,17 +854,6 @@ static const struct iio_buffer_setup_ops bmc150_magn_b= uffer_setup_ops =3D { .postdisable =3D bmc150_magn_buffer_postdisable, }; =20 -static const char *bmc150_magn_match_acpi_device(struct device *dev) -{ - const struct acpi_device_id *id; - - id =3D acpi_match_device(dev->driver->acpi_match_table, dev); - if (!id) - return NULL; - - return dev_name(dev); -} - int bmc150_magn_probe(struct device *dev, struct regmap *regmap, int irq, const char *name) { @@ -894,9 +882,6 @@ int bmc150_magn_probe(struct device *dev, struct regmap= *regmap, if (ret) return ret; =20 - if (!name && ACPI_HANDLE(dev)) - name =3D bmc150_magn_match_acpi_device(dev); - mutex_init(&data->mutex); =20 ret =3D bmc150_magn_init(data); --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B82F12178F3; Thu, 24 Oct 2024 19:12:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797129; cv=none; b=rbvzkJ34s3ooG4Mz/cbcxnpkXL9hWItIY0ir8b4L9kxa9RgiYtdQo69fedmKBTvtqbQe/edi/lBv/uI8Ftzb59ya+19Xd5Q/k+WyPZnrrVpzosNo5Gb09wfunyuPA579XypUsjPbRxEHV7B25W77tWWqwNk/y2qOEfy/1kK239o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797129; c=relaxed/simple; bh=FJZD8ym3u/Af6dcoDZY1FR7xEzBmn/SkkJlcKEIdmqI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BJMX0mSVXDBPn+rYIpAFU/HxOZ+YBzwFCCFQ8k43haqKdkXiyrqWuxCpRjD2ciChgY9yoD1g/p7PkJBr9uTYm2mudUvEth7QD6EewT3JqdpI2mg7gGjVrt5VMf0hvRdRveZJu/pl4xpbbk71XuiLsWvJTVRaoVnZHr0I1+E+I0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=gbe5QhkI; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gbe5QhkI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797128; x=1761333128; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FJZD8ym3u/Af6dcoDZY1FR7xEzBmn/SkkJlcKEIdmqI=; b=gbe5QhkI/iBVzUwUPUMyYFc/wNLKSnqoEIxsIfIOhVbentbme6KQ5fpB foOoC5ZKYrzuPMPOuqvbOv1BLM9MH5JeBbDZFpCFQWbq3CQIcQjNEj4o7 l0w5FQvFPp7tExVGioVzNzz2ER9hI1dqHaYbRPKzNPyNxDuITJCZMZKzf bbyezv44W2ReO821oFII1bJoIaByp0HJkMQYcT/HV4Z1vwWAb2Fez6V/C +cB8X9X1TpswqxntU36z6VO6eUHwK4d2oD01wZX0Rty/+BTCpxMfA/zD/ DltnR6oJxzKjjT+9RwFEFoWM4WFh6vCSbq/Il7HkMYnhqeiig2LEGxTBX A==; X-CSE-ConnectionGUID: mJdGolgdTz+aADUDv9dAsA== X-CSE-MsgGUID: llkOnS4tQqSfWb3GxQzsIw== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934391" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934391" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:04 -0700 X-CSE-ConnectionGUID: +FRckgYZScSFpy3jcaJhUA== X-CSE-MsgGUID: ZdRK2zxET3+oxv24nkj0mQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266647" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:02 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1DFCA331; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 02/24] iio: adc: pac1934: Replace strange way of checking type of enumeration Date: Thu, 24 Oct 2024 22:04:51 +0300 Message-ID: <20241024191200.229894-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When device is enumerated via ACPI the respective device node is of ACPI device type. Use that to check for ACPI enumeration, rather than calling for full match which is O(n) vs. O(1) for the regular check. Reviewed-by: Hans de Goede Reviewed-by: Marius Cristea Signed-off-by: Andy Shevchenko --- drivers/iio/adc/pac1934.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/pac1934.c b/drivers/iio/adc/pac1934.c index 7ef249d83286..20802b7f49ea 100644 --- a/drivers/iio/adc/pac1934.c +++ b/drivers/iio/adc/pac1934.c @@ -1507,7 +1507,7 @@ static int pac1934_probe(struct i2c_client *client) indio_dev->name =3D pac1934_chip_config[ret].name; } =20 - if (acpi_match_device(dev->driver->acpi_match_table, dev)) + if (is_acpi_device_node(dev_fwnode(dev))) ret =3D pac1934_acpi_parse_channel_config(client, info); else /* --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B6FB218301; Thu, 24 Oct 2024 19:12:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797130; cv=none; b=VZUDi8/XO/R+0j3DIgVgwpCBpCqLaDS5PGNyQvv8qIL+rLyEOclZ6hUrMFLkSMUYpgp+DOXaCSMXQhlUBlAHjtVWlavAiJ37aV5R9YE7sS0IFFxPj1IUeM9/gHLI+N6BmCSb238TT/MRm5e8k0XIfiZr5A+hLjNl1WL6eO/Sv7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797130; c=relaxed/simple; bh=8atlFWavefIc6+oxaGcsEV449zq2pd7xjIWLQwE6VyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ntP3Lr26DsD6pKLSzojfcMtmnFK+EVeT0FhXvcUWmL8afXgDmU2Tbq0ePYOAk/1+50hGwb5sggrPQ4I0ePH14u48i2pZiXAh+mPmyamkTgwiBH0e3XVxOay5GcdFO/b3x6wOWRLdq5/+CPSIYB7g9rQyRd7JMb1Fg/JCGai6Kxs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TFgqbloI; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TFgqbloI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797128; x=1761333128; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8atlFWavefIc6+oxaGcsEV449zq2pd7xjIWLQwE6VyU=; b=TFgqbloI8ErobvhVJuOkX2Y9gTD04eOYt0oz47O6g0d2RoPmOF7EbXcB JQZWUzPJPGMx1apti6v28xdfrpgfzDnlenql03l/duAtt0I3ZtvXt+Sax k1CW32w4c9uCDSFU7/PJvgrucvuEZumPgUGuKHGdz/8R8qOoIvuureaoT wyH7TTedRLVKF9OL8eJttAm3CNyuZVvKZuQ057Pcm5zydS428apKt2Ui/ LO0cxkxdZk8SYbx0WTLMADXtDIeF1h0XiTcsXgmD5i1Z7pbvLilJqrpyz 9Z/W94BJ4+5DadFs2EuXH2ORLbsKexi1Wu4zbYYoy2Ixpa2LVXVtuKKSu A==; X-CSE-ConnectionGUID: JbVAmeV0R/q/1nO3NZla0g== X-CSE-MsgGUID: q7EzYlxJQWKZmZrtwkmwZA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="29563172" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="29563172" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:05 -0700 X-CSE-ConnectionGUID: lFY+U7t9RsevBYCtLb7v9g== X-CSE-MsgGUID: eJLOipv+QUeDX4Ii50O6lA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="85791719" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 24 Oct 2024 12:12:03 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2D929386; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 03/24] iio: imu: inv_mpu6050: Replace strange way of checking type of enumeration Date: Thu, 24 Oct 2024 22:04:52 +0300 Message-ID: <20241024191200.229894-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When device is enumerated via ACPI the respective device node is of ACPI device type. Use that to check for ACPI enumeration, rather than calling for full match which is O(n) vs. O(1) for the regular check. Acked-by: Jean-Baptiste Maneyrol Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c b/drivers/iio/imu/i= nv_mpu6050/inv_mpu_acpi.c index b15d8c94cc11..373e59f6d91a 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c @@ -104,14 +104,11 @@ static int inv_mpu_process_acpi_config(struct i2c_cli= ent *client, unsigned short *secondary_addr) { struct acpi_device *adev =3D ACPI_COMPANION(&client->dev); - const struct acpi_device_id *id; u32 i2c_addr =3D 0; LIST_HEAD(resources); int ret; =20 - id =3D acpi_match_device(client->dev.driver->acpi_match_table, - &client->dev); - if (!id) + if (!is_acpi_device_node(dev_fwnode(&client->dev))) return -ENODEV; =20 ret =3D acpi_dev_get_resources(adev, &resources, --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 603662170D5; Thu, 24 Oct 2024 19:12:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797130; cv=none; b=SW4hmDA/zfU54MiXJ2Jb5+8jjU/02/gubiYjivdv8VpQwuYBsYEx042ynj/aeGG6Wnl/WAEEJNMHo/a0Lq3PgSq41g0N20WJXRIxK1U4i6Uqln9BWk8z5+S8DSIW76bCHsVLGOvyyUPr2UeXQf2mN9DwHkpsvW1dYI1rf79Fjl8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797130; c=relaxed/simple; bh=2NpSf0hOT+YNC2NtcTsGYEN7hUnqCBnO3iQXTMJmrUQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sr+76NGubLoTkLxQBiqrPCq6aEUvCphLYyMU9cd5g2EjUxRjbNpl2Q+R/6mxnNrAj5yRTvbzlkCJ+h+eO+zFB1lskABf4XadqMObpKbrlgCAqG+46+ib2pVrhGhXh0/XdztrqCFueL/Yk+T0Y8OWyZ8pwYL7MZTUDKVVolaA4mA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aR01xi6P; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aR01xi6P" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797128; x=1761333128; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2NpSf0hOT+YNC2NtcTsGYEN7hUnqCBnO3iQXTMJmrUQ=; b=aR01xi6PiEgkPmS/NP5qyblm1JMCia88rD67zDAMnE51ABhXD1a8m7qc SNdPL0N/y+NcXyzRPlTfsveP8z4EyjhG3X3Jb6NjF5D56k+0XoNvUVGvx CNqG2lA451HqFoR2UfxqAKy5l7lwUy4s3e/l+jUaV7vQuL2jPWrzKr9qa HhXhqTpaJEnIRKUbqt/XCtPqcu8XCV96XswT89AyNhbEAjaYcZOSHS09C NPmVpi6G+bTFP5O7/3rdz5+SUt46zBDykd5RIDMHkcckAoa01wXIeiFon 6XIFH/fyrG7GcWooOewcDIVFL/fo2IZ0JAS3HbbSjDlXIzC23MFK6gtkM A==; X-CSE-ConnectionGUID: A3bhE4yBQsKhwjXDXzt66Q== X-CSE-MsgGUID: 03IoktG6TJmCcsGT7byOWA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934407" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934407" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:05 -0700 X-CSE-ConnectionGUID: 9Lvooc3KQpmN6pvlR8lgxg== X-CSE-MsgGUID: u14i1OLMR6OK5ehArj3vuw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266646" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:02 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 37D6C2E9; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko Subject: [PATCH v3 04/24] iio: acpi: Improve iio_read_acpi_mount_matrix() Date: Thu, 24 Oct 2024 22:04:53 +0300 Message-ID: <20241024191200.229894-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko By using ACPI_HANDLE() the handler argument can be retrieved directly. Replace ACPI_COMPANION() + dereference with ACPI_HANDLE(). Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko Signed-off-by: Andy Shevchenko --- drivers/iio/industrialio-acpi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/iio/industrialio-acpi.c b/drivers/iio/industrialio-acp= i.c index 981b75d40780..1e46908f9534 100644 --- a/drivers/iio/industrialio-acpi.c +++ b/drivers/iio/industrialio-acpi.c @@ -28,17 +28,21 @@ bool iio_read_acpi_mount_matrix(struct device *dev, char *acpi_method) { struct acpi_buffer buffer =3D { ACPI_ALLOCATE_BUFFER, NULL }; - struct acpi_device *adev =3D ACPI_COMPANION(dev); char *str; union acpi_object *obj, *elements; + acpi_handle handle; acpi_status status; int i, j, val[3]; bool ret =3D false; =20 - if (!adev || !acpi_has_method(adev->handle, acpi_method)) + handle =3D ACPI_HANDLE(dev); + if (!handle) return false; =20 - status =3D acpi_evaluate_object(adev->handle, acpi_method, NULL, &buffer); + if (!acpi_has_method(handle, acpi_method)) + return false; + + status =3D acpi_evaluate_object(handle, acpi_method, NULL, &buffer); if (ACPI_FAILURE(status)) { dev_err(dev, "Failed to get ACPI mount matrix: %d\n", status); return false; --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EE7A218328; Thu, 24 Oct 2024 19:12:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797131; cv=none; b=TksZy355V+A8sDO2YEPPHLMZpsjyLqggZR8H2qe1hUGQUayEe4tIHgBwrcJw2YWUrBRkjCfhd/lq+V7urElq60u13pzzBz4EKZMr/xFCb2IKOBd1dzbok1WEHBor3umg5vquWvg2i8FlzIjinM7BaxXBa3+AmViPsxDVAII90dk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797131; c=relaxed/simple; bh=d3ZSLU8ibrc6Yan7aMm3T4jPhAakbMXjPcSvB3iW4f8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LKX6hnQ7iqlspTpOz2qciKzX6jiRn+Uqz0Zuakd9e7Yab7Kf1rOqc9CvMWPMy3pxEJj/C3bdCwyUGEls6RmyYMkAHzSHomc3JWg+5/MPe4k4LBwF3fLMA9Z6zIdgvTF3esVclp5jWMDNteegz10KJ7HbKvizJJCEwwuZLRYnU94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=BnkhNlPB; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BnkhNlPB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797129; x=1761333129; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d3ZSLU8ibrc6Yan7aMm3T4jPhAakbMXjPcSvB3iW4f8=; b=BnkhNlPB1tEa6iABdwRzaleFRXdjcoHDB1/tPhxOORdItT/ZvwZb0q2n ou1FR6V04PgZHjjDKt7y+fOHjpsnh+iCSY74NV4WyBbkIuVOin+ymbjV/ c+v5ED79ifjxZE9DncuAoT4v3JcJsq4piFPJ4Oza8aKaGZXmuiFknMPI+ mYN88ilf5hFMuZ0lzCdQgmSMCSeWB+CymQMGd80jyquPfH7TVML2Gf2SP rynOXwZNv0VH57PPwu7yfSx5NmFQr8SRwVDxXhOaDNzPT2MaLAtFTQrVK FBPoQ9i7Zym6wthXMbWVf5p/F0vk2NOGRbxGgZ+jOMCu6DdBxGlLei52Z g==; X-CSE-ConnectionGUID: e8eT4Sp0RS6DSZkHoHdUIw== X-CSE-MsgGUID: nZrrcGu2QVq0wnGPb6dxLg== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934420" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934420" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: ZpvnPiN2TpOa4eu64aephQ== X-CSE-MsgGUID: qEmkvdwpSaqurBkNbwQgug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266678" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:05 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 493224D5; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 05/24] iio: acpi: Add iio_get_acpi_device_name_and_data() helper function Date: Thu, 24 Oct 2024 22:04:54 +0300 Message-ID: <20241024191200.229894-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A few drivers duplicate the code to retrieve ACPI device instance name. Some of them want an associated driver data as well. In order of deduplication introduce the common helper functions. Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/industrialio-acpi.c | 38 ++++++++++++++++++++++++++++++++- include/linux/iio/iio.h | 10 +++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-acpi.c b/drivers/iio/industrialio-acp= i.c index 1e46908f9534..d67a43843799 100644 --- a/drivers/iio/industrialio-acpi.c +++ b/drivers/iio/industrialio-acpi.c @@ -2,7 +2,8 @@ /* IIO ACPI helper functions */ =20 #include -#include +#include +#include #include #include =20 @@ -87,3 +88,38 @@ bool iio_read_acpi_mount_matrix(struct device *dev, return ret; } EXPORT_SYMBOL_GPL(iio_read_acpi_mount_matrix); + +/** + * iio_get_acpi_device_name_and_data() - Return ACPI device instance name = and driver data + * @dev: Device structure + * @data: Optional pointer to return driver data + * + * When device was enumerated by ACPI ID matching, the user might + * want to set description for the physical chip. In such cases + * the ACPI device instance name might be used. This call may be + * performed to retrieve this information. + * + * NOTE: This helper function exists only for backward compatibility, + * do not use in a new code! + * + * Returns: ACPI device instance name or %NULL. + */ +const char *iio_get_acpi_device_name_and_data(struct device *dev, const vo= id **data) +{ + const struct acpi_device_id *id; + acpi_handle handle; + + handle =3D ACPI_HANDLE(dev); + if (!handle) + return NULL; + + id =3D acpi_match_device(dev->driver->acpi_match_table, dev); + if (!id) + return NULL; + + if (data) + *data =3D (const void *)id->driver_data; + + return dev_name(dev); +} +EXPORT_SYMBOL_GPL(iio_get_acpi_device_name_and_data); diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 3a9b57187a95..445d6666a291 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -831,6 +831,7 @@ int iio_device_resume_triggering(struct iio_dev *indio_= dev); bool iio_read_acpi_mount_matrix(struct device *dev, struct iio_mount_matrix *orientation, char *acpi_method); +const char *iio_get_acpi_device_name_and_data(struct device *dev, const vo= id **data); #else static inline bool iio_read_acpi_mount_matrix(struct device *dev, struct iio_mount_matrix *orientation, @@ -838,7 +839,16 @@ static inline bool iio_read_acpi_mount_matrix(struct d= evice *dev, { return false; } +static inline const char * +iio_get_acpi_device_name_and_data(struct device *dev, const void **data) +{ + return NULL; +} #endif +static inline const char *iio_get_acpi_device_name(struct device *dev) +{ + return iio_get_acpi_device_name_and_data(dev, NULL); +} =20 /** * iio_get_current_scan_type - Get the current scan type for a channel --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91E0A219C9D; Thu, 24 Oct 2024 19:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797132; cv=none; b=FUWU27QhbV+60tMlgi0qx7eQTpae5dKwJaPHN2z60o8jKu71INd5k48hZI3s4niFClFC+tOe7cCznv2yEORRajfcfFZWlwcl+YDRRUdhwJ0MlmIYNb2NSBJo24y99Ye7ux/4DN1LnhS1cqbydIB01fa80hfNgO4Kbmt+zdgK4zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797132; c=relaxed/simple; bh=qTxetLJkqg4g0jepIJZKrTX9ckYhdcAkQpxO6atHE9k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SB8fTse9178RVB8YFrPtbOuGscuQh4x1A1OwA3rqyyDZuk/2ZSfoYoS3rQZ1F7MqpYKboYaf32zzciumWTGzHfBMYQf+WKcmlwcZxsRT8P2hAJHRGvkT6fjb3HYqCHIWbd0nFVAvLEeklMFYHwEWBgcOXsG8Fnmp7Ub62V4yRMM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OoJJiXy8; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OoJJiXy8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797130; x=1761333130; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qTxetLJkqg4g0jepIJZKrTX9ckYhdcAkQpxO6atHE9k=; b=OoJJiXy8MyzW9BBibLXmq9sL3DFoCT4F6jD54Jb/nNRuCVj2K0b1b4Km FztoXdc2l9zZACjJuVFC8hsOi1VdBU5cPEmeuw8dD94I1ddbR99oeAS4G WrMUULI6nig193URir+32cQCOXtl87ry1Lss2R9WxDjSumic0jLeITh3y 14h3HryFjiIA8u6eNNU74Z+Z/+VAQQqRCMdSVqoazHlKTlIGDKeia85qO bNkMtSJV+CMhd+LKc3OWSxqN8qjURiiEYDjXTWXh5sfPyVamlV92xl8NB PV/KWJi/ol5d/UWd3cNCHwCtlv4qdoGbXC48wUTlykMlAly6+AmAaTu6o Q==; X-CSE-ConnectionGUID: X4+fngIUS7SB+amlRbn30A== X-CSE-MsgGUID: OQ3RH9W+Tx6VdcHt7f0NXQ== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934437" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934437" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: UlXj/410RWaLXF2qmfav2Q== X-CSE-MsgGUID: hZiWnDn4RzalinuyRWI2ag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266679" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:05 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4F3D541D; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 06/24] =?UTF-8?q?iio:=20accel:=20kxcjk-1013:=20Remove?= =?UTF-8?q?=20redundant=20I=C2=B2C=20ID?= Date: Thu, 24 Oct 2024 22:04:55 +0300 Message-ID: <20241024191200.229894-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The ACPI IDs are defined in the respective ID tables. Puting them to the I=C2=B2C ID legacy table has no meaning. Remove that ID. Fixes: 3bfa74f86006 ("iio:kxcjk-1013: Add support for SMO8500 device") Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index bbf65fc97b08..2eec95d8defb 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -1717,7 +1717,6 @@ static const struct i2c_device_id kxcjk1013_id[] =3D { {"kxtf9", KXTF9}, {"kx022-1020", KX0221020}, {"kx023-1025", KX0231025}, - {"SMO8500", KXCJ91008}, {} }; =20 --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD494219CB3; Thu, 24 Oct 2024 19:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797132; cv=none; b=Iv/2nTViSO6dnbmGPpB28ZwXJftgJ1fr5sAwIuolPVNEZzwC1GfC2+ivZZT8IWh0p0qrT2CCB2V6waTMJCW4W/e4rvXPNl4QHoMwvTf1SCADAjK+BSOLHLK68FX6DNPGO3MLvMvfyDrXikXS6oF68m7npBNLLvqt4g7rHT8fJII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797132; c=relaxed/simple; bh=LgM3SvYbfr5Xlwt6pPuUSCUbO7HgE47LVHzd9AaUCSo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JPTJbwal7nEX8T/nIeryuCL1imGegMvVc6bFg2C0IwJLaBfLmOmv3Ekx6HMC6tTksI75E/XWTtTJ8LbIhiTMnnQG0jxOBJYU22JvVaT0AiO0kdhCakfpm4jZF34+PQxr2EFJkhAdIHDfxpKTsZVFPIVdLXsBS8zfdLD5NkeMqi4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WoGjDKt5; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WoGjDKt5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797131; x=1761333131; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LgM3SvYbfr5Xlwt6pPuUSCUbO7HgE47LVHzd9AaUCSo=; b=WoGjDKt5ozaHAcWmidD/1mHVVivt+4XSPrdYukfsuXMBlUCxeDWIqekA pb85lUAFWIaJ1qfqccaFH5PdRBMNcDBH89S1FH8SJB8iCnUJ3SFGmXDuS sJWHWOrg+tYh5OzpfjTNgyuNfS2yOR8IlP7OedxhsnDH8GWoM8nows5pA qR8jT5s1AIVhRkzhiYUKMrLrd4pK7kTALA4i0BMle1v//i7UXlGXNbv5U PZHJBUnEiz+yj4J1QxJay8EcubIp49o/Pr+On9UX5qOrD5+AV5NvPxSm0 YvYztSqMoewtp8r3465wMfsGMDaE+Vl2pYLuC1TXDhIwcyKPhcW1CWLut g==; X-CSE-ConnectionGUID: y74fSJORQ6SEQUCZzdQUPw== X-CSE-MsgGUID: p98ZlRh9T8aGH1uE2xxl7g== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="29563194" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="29563194" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:09 -0700 X-CSE-ConnectionGUID: w40wNZ44QHKdBGDarpAXeQ== X-CSE-MsgGUID: ifDq+0BMTWunUmn2RU+N9g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="85791740" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 24 Oct 2024 12:12:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6C689550; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 07/24] iio: accel: kxcjk-1013: Revert "Add support for KX022-1020" Date: Thu, 24 Oct 2024 22:04:56 +0300 Message-ID: <20241024191200.229894-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The mentioned change effectively broke the ODR startup timeouts settungs for KX023-1025 case. Let's revert it for now and see how we can handle it with the better approach after switching the driver to use data structure instead of enum. This reverts commit d5cbe1502043124ff8af8136b80f93758c4a61e0. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 2eec95d8defb..208e701e1aed 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -174,7 +174,6 @@ enum kx_chipset { KXCJ91008, KXTJ21009, KXTF9, - KX0221020, KX0231025, KX_MAX_CHIPS /* this must be last */ }; @@ -582,8 +581,8 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) return ret; } =20 - /* On KX023 and KX022, route all used interrupts to INT1 for now */ - if ((data->chipset =3D=3D KX0231025 || data->chipset =3D=3D KX0221020) &&= data->client->irq > 0) { + /* On KX023, route all used interrupts to INT1 for now */ + if (data->chipset =3D=3D KX0231025 && data->client->irq > 0) { ret =3D i2c_smbus_write_byte_data(data->client, KX023_REG_INC4, KX023_REG_INC4_DRDY1 | KX023_REG_INC4_WUFI1); @@ -1509,7 +1508,6 @@ static int kxcjk1013_probe(struct i2c_client *client) case KXTF9: data->regs =3D &kxtf9_regs; break; - case KX0221020: case KX0231025: data->regs =3D &kx0231025_regs; break; @@ -1715,7 +1713,6 @@ static const struct i2c_device_id kxcjk1013_id[] =3D { {"kxcj91008", KXCJ91008}, {"kxtj21009", KXTJ21009}, {"kxtf9", KXTF9}, - {"kx022-1020", KX0221020}, {"kx023-1025", KX0231025}, {} }; @@ -1727,7 +1724,6 @@ static const struct of_device_id kxcjk1013_of_match[]= =3D { { .compatible =3D "kionix,kxcj91008", }, { .compatible =3D "kionix,kxtj21009", }, { .compatible =3D "kionix,kxtf9", }, - { .compatible =3D "kionix,kx022-1020", }, { .compatible =3D "kionix,kx023-1025", }, { } }; --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0778218D7F; Thu, 24 Oct 2024 19:12:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797132; cv=none; b=nSYlsfwLhAmY793vMWSJG4k6MzLznapyZMzqWfxUKWi8R/l7WrWsuhTFvEyuleO2Z1LoAbENV4suMkg9eTNLfBj8q4/b+iirAHJjhjkUd3VyB87rojQseFEdbgX1CzSQ77WHQcO11BKU1fBY1rGa7or1LbIoAUDg43SUP4SKbNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797132; c=relaxed/simple; bh=DVlqFP9iROUJk4knJhx6hQhmkQUUT8UOd38cVvmpDIY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TqDgDEdL1CWdRH2RQV3e9c2amLz/J8exMtv9hGvXuCzBIkuQIpGOVvTqpdY+u0Auh80KEnMqk2pX6Soh0ilOUMHijiDP0sTWhzN7CVUc50FoAh3lKEIcZ0Z+fA3ezABsf0cI1Flrk71hsRDp+rr8u1unCUG/Xp8Q4ofMl7DbT6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=FmMbmyfl; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FmMbmyfl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797130; x=1761333130; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DVlqFP9iROUJk4knJhx6hQhmkQUUT8UOd38cVvmpDIY=; b=FmMbmyflLYnlKFcvPuYfudNn8qahnHto0GEGNyYW4pUDDrY8m85dnrSX 75ck9pReD5oBddT/WD837CNtzN4z79JAO5cYUlZ4HJLsX9zp+4fFjbmRJ AMGHBIkYWRdNi9duShVw7FrzbRP4MgTsUvYJefcPyqoKiXYo2y7s4Bonv dv5q8mbVNqBP8ccnrg91nNjTyLCJPZBhha8T8+G9qkHlxEdip8j7qbMLu YKH/12u3RFwBINKVYa9tjiXjuySs3YnImLNSC5gR7C7a8Y/ZxmMFJjgGL QR/1d+E+G0R1Qu6cKeNqaYfmDtY2lS0gLGykV0SUKPd6zSbwvhLYnJFEo Q==; X-CSE-ConnectionGUID: vt/0wLKfQ2iU6vMhsAoTWA== X-CSE-MsgGUID: yibr+8RLQqSdnbQaYns2+w== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934433" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934433" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: 8aP7BYO9QCS8h6gBtU5ZVg== X-CSE-MsgGUID: g8pN/f6rS6+8l5ERb+xCfw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266682" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:05 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 74F91588; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 08/24] iio: accel: kxcjk-1013: Switch from CONFIG_PM guards to pm_ptr() etc Date: Thu, 24 Oct 2024 22:04:57 +0300 Message-ID: <20241024191200.229894-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards. Removing instances of this approach from IIO also stops them being copied into new drivers. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 208e701e1aed..0cc34e17a23f 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -315,7 +315,7 @@ static const char *const kxtf9_samp_freq_avail =3D "25 50 100 200 400 800"; =20 /* Refer to section 4 of the specification */ -static __maybe_unused const struct { +static const struct { int odr_bits; int usec; } odr_start_up_times[KX_MAX_CHIPS][12] =3D { @@ -601,7 +601,6 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) return 0; } =20 -#ifdef CONFIG_PM static int kxcjk1013_get_startup_times(struct kxcjk1013_data *data) { int i; @@ -614,7 +613,6 @@ static int kxcjk1013_get_startup_times(struct kxcjk1013= _data *data) =20 return KXCJK1013_MAX_STARTUP_TIME_US; } -#endif =20 static int kxcjk1013_set_power_state(struct kxcjk1013_data *data, bool on) { @@ -1636,7 +1634,6 @@ static void kxcjk1013_remove(struct i2c_client *clien= t) mutex_unlock(&data->mutex); } =20 -#ifdef CONFIG_PM_SLEEP static int kxcjk1013_suspend(struct device *dev) { struct iio_dev *indio_dev =3D i2c_get_clientdata(to_i2c_client(dev)); @@ -1664,9 +1661,7 @@ static int kxcjk1013_resume(struct device *dev) =20 return ret; } -#endif =20 -#ifdef CONFIG_PM static int kxcjk1013_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev =3D i2c_get_clientdata(to_i2c_client(dev)); @@ -1700,12 +1695,10 @@ static int kxcjk1013_runtime_resume(struct device *= dev) =20 return 0; } -#endif =20 static const struct dev_pm_ops kxcjk1013_pm_ops =3D { - SET_SYSTEM_SLEEP_PM_OPS(kxcjk1013_suspend, kxcjk1013_resume) - SET_RUNTIME_PM_OPS(kxcjk1013_runtime_suspend, - kxcjk1013_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(kxcjk1013_suspend, kxcjk1013_resume) + RUNTIME_PM_OPS(kxcjk1013_runtime_suspend, kxcjk1013_runtime_resume, NULL) }; =20 static const struct i2c_device_id kxcjk1013_id[] =3D { @@ -1734,7 +1727,7 @@ static struct i2c_driver kxcjk1013_driver =3D { .name =3D KXCJK1013_DRV_NAME, .acpi_match_table =3D ACPI_PTR(kx_acpi_match), .of_match_table =3D kxcjk1013_of_match, - .pm =3D &kxcjk1013_pm_ops, + .pm =3D pm_ptr(&kxcjk1013_pm_ops), }, .probe =3D kxcjk1013_probe, .remove =3D kxcjk1013_remove, --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56EF7219C8D; Thu, 24 Oct 2024 19:12:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797133; cv=none; b=NQM4miCPMAQrJKWv0wTt8zp3vhdlBKXiCqnhZEdQDWP73JC4/OyXW1ZjNrDTS23T7tnC9klXTchv6L2RkliC2HDiGH6CuXLFQhsJPtfw05vS1Len7NtM84kIZoHTsixee/NWI7EtftftdsYlRrC0mrjxPcWNNBEWrX8xrIo/SSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797133; c=relaxed/simple; bh=nnUYxTU6Qk+voFfM495gKZUOSvntg7CaVSFrf4/2QkM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L+DbWTswN+IdtaEvF/+HbDH14k8UMbVdBvQShOgKEqJH7IpIsCaOy0pyWTtpQPFlvibBC6IwuUF6KoP6VC0Y0l3H0n8RyrzwfsmGbYL88i3WU48d0nwVyEOUjmaPbb0ZYEi/1FAbRBlHa4IW3ZYDFRw9ZK/5kFmT76u/sy7RdIg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=K3w4qmfP; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="K3w4qmfP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797131; x=1761333131; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nnUYxTU6Qk+voFfM495gKZUOSvntg7CaVSFrf4/2QkM=; b=K3w4qmfP1zfbFMm68o33Mf8H0ZT/Dq6g9TEg5FjSWPDT7xoBJ0vhQN3X kz4t2RVpsWoPxdosD5/Yo0Y6qd172kjZcVu3isCqFyTps+eT4wr4LcUiW a2rCTVNob7X4c/ZnjUHy6G7Yx8yRAPPtWTzo9RlKBTQ+97jFaGxfH54Ye 132y8C7B/q0nOi4HOMmm0MR/UE7WPSRzTP+b6HOJE5tE2gFLug3FSgxCG 2eKpx/2fkAO03HugRe+b/1UTh8VHou2Tak/NDxPopOtNarVidRQnzhN1u 8gc6Rx2/Ha0sL6/mkX/PzbiBdk9je9wCkVY+eTEFKiYBSgsEnyrFeX8Y6 g==; X-CSE-ConnectionGUID: yeVKRQOBSXS6b/BJvVc9OQ== X-CSE-MsgGUID: JeBr6j+zQjSmixOHYExayA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="29563185" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="29563185" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: H++YmrIrRrGSaL1UxHbZsQ== X-CSE-MsgGUID: oYYXpd/RQuGMsOyWqcK6jg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="85791741" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 24 Oct 2024 12:12:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 860F25B8; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 09/24] iio: accel: kxcjk-1013: Use local variable for regs Date: Thu, 24 Oct 2024 22:04:58 +0300 Message-ID: <20241024191200.229894-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use local variable for regs in preparatory of further cleaning up changes. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 65 +++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 0cc34e17a23f..a5411d920025 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -445,9 +445,10 @@ MODULE_DEVICE_TABLE(acpi, kx_acpi_match); static int kxcjk1013_set_mode(struct kxcjk1013_data *data, enum kxcjk1013_mode mode) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -458,7 +459,7 @@ static int kxcjk1013_set_mode(struct kxcjk1013_data *da= ta, else ret |=3D KXCJK1013_REG_CTRL1_BIT_PC1; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl1\n"); return ret; @@ -470,9 +471,10 @@ static int kxcjk1013_set_mode(struct kxcjk1013_data *d= ata, static int kxcjk1013_get_mode(struct kxcjk1013_data *data, enum kxcjk1013_mode *mode) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -488,9 +490,10 @@ static int kxcjk1013_get_mode(struct kxcjk1013_data *d= ata, =20 static int kxcjk1013_set_range(struct kxcjk1013_data *data, int range_inde= x) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -501,7 +504,7 @@ static int kxcjk1013_set_range(struct kxcjk1013_data *d= ata, int range_index) ret |=3D (KXCJK1013_scale_table[range_index].gsel_0 << 3); ret |=3D (KXCJK1013_scale_table[range_index].gsel_1 << 4); =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl1\n"); return ret; @@ -514,6 +517,7 @@ static int kxcjk1013_set_range(struct kxcjk1013_data *d= ata, int range_index) =20 static int kxcjk1013_chip_init(struct kxcjk1013_data *data) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 #ifdef CONFIG_ACPI @@ -535,7 +539,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) if (ret < 0) return ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -544,7 +548,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) /* Set 12 bit mode */ ret |=3D KXCJK1013_REG_CTRL1_BIT_RES; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl\n"); return ret; @@ -555,7 +559,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) if (ret < 0) return ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->data_ctrl); + ret =3D i2c_smbus_read_byte_data(data->client, regs->data_ctrl); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_data_ctrl\n"); return ret; @@ -564,7 +568,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) data->odr_bits =3D ret; =20 /* Set up INT polarity */ - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_ctrl1\n"); return ret; @@ -575,7 +579,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) else ret &=3D ~KXCJK1013_REG_INT_CTRL1_BIT_IEA; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->int_ctrl1, re= t); + ret =3D i2c_smbus_write_byte_data(data->client, regs->int_ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_int_ctrl1\n"); return ret; @@ -637,18 +641,17 @@ static int kxcjk1013_set_power_state(struct kxcjk1013= _data *data, bool on) =20 static int kxcjk1013_chip_update_thresholds(struct kxcjk1013_data *data) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->wake_timer, - data->wake_dur); + ret =3D i2c_smbus_write_byte_data(data->client, regs->wake_timer, data->w= ake_dur); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_wake_timer\n"); return ret; } =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->wake_thres, - data->wake_thres); + ret =3D i2c_smbus_write_byte_data(data->client, regs->wake_thres, data->w= ake_thres); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_wake_thres\n"); return ret; @@ -660,6 +663,7 @@ static int kxcjk1013_chip_update_thresholds(struct kxcj= k1013_data *data) static int kxcjk1013_setup_any_motion_interrupt(struct kxcjk1013_data *dat= a, bool status) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; enum kxcjk1013_mode store_mode; =20 @@ -676,7 +680,7 @@ static int kxcjk1013_setup_any_motion_interrupt(struct = kxcjk1013_data *data, if (ret < 0) return ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_ctrl1\n"); return ret; @@ -687,13 +691,13 @@ static int kxcjk1013_setup_any_motion_interrupt(struc= t kxcjk1013_data *data, else ret &=3D ~KXCJK1013_REG_INT_CTRL1_BIT_IEN; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->int_ctrl1, re= t); + ret =3D i2c_smbus_write_byte_data(data->client, regs->int_ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_int_ctrl1\n"); return ret; } =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -704,7 +708,7 @@ static int kxcjk1013_setup_any_motion_interrupt(struct = kxcjk1013_data *data, else ret &=3D ~KXCJK1013_REG_CTRL1_BIT_WUFE; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl1\n"); return ret; @@ -722,6 +726,7 @@ static int kxcjk1013_setup_any_motion_interrupt(struct = kxcjk1013_data *data, static int kxcjk1013_setup_new_data_interrupt(struct kxcjk1013_data *data, bool status) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; enum kxcjk1013_mode store_mode; =20 @@ -734,7 +739,7 @@ static int kxcjk1013_setup_new_data_interrupt(struct kx= cjk1013_data *data, if (ret < 0) return ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_ctrl1\n"); return ret; @@ -745,13 +750,13 @@ static int kxcjk1013_setup_new_data_interrupt(struct = kxcjk1013_data *data, else ret &=3D ~KXCJK1013_REG_INT_CTRL1_BIT_IEN; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->int_ctrl1, re= t); + ret =3D i2c_smbus_write_byte_data(data->client, regs->int_ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_int_ctrl1\n"); return ret; } =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->ctrl1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_ctrl1\n"); return ret; @@ -762,7 +767,7 @@ static int kxcjk1013_setup_new_data_interrupt(struct kx= cjk1013_data *data, else ret &=3D ~KXCJK1013_REG_CTRL1_BIT_DRDY; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->ctrl1, ret); + ret =3D i2c_smbus_write_byte_data(data->client, regs->ctrl1, ret); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl1\n"); return ret; @@ -809,6 +814,7 @@ static int kxcjk1013_convert_odr_value(const struct kx_= odr_map *map, =20 static int kxcjk1013_set_odr(struct kxcjk1013_data *data, int val, int val= 2) { + const struct kx_chipset_regs *regs =3D data->regs; int ret; enum kxcjk1013_mode store_mode; const struct kx_odr_map *odr_setting; @@ -834,7 +840,7 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *dat= a, int val, int val2) if (ret < 0) return ret; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->data_ctrl, + ret =3D i2c_smbus_write_byte_data(data->client, regs->data_ctrl, odr_setting->odr_bits); if (ret < 0) { dev_err(&data->client->dev, "Error writing data_ctrl\n"); @@ -843,7 +849,7 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *dat= a, int val, int val2) =20 data->odr_bits =3D odr_setting->odr_bits; =20 - ret =3D i2c_smbus_write_byte_data(data->client, data->regs->wuf_ctrl, + ret =3D i2c_smbus_write_byte_data(data->client, regs->wuf_ctrl, odr_setting->wuf_bits); if (ret < 0) { dev_err(&data->client->dev, "Error writing reg_ctrl2\n"); @@ -1245,9 +1251,10 @@ static void kxcjk1013_trig_reen(struct iio_trigger *= trig) { struct iio_dev *indio_dev =3D iio_trigger_get_drvdata(trig); struct kxcjk1013_data *data =3D iio_priv(indio_dev); + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_rel); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_rel); if (ret < 0) dev_err(&data->client->dev, "Error reading reg_int_rel\n"); } @@ -1299,8 +1306,9 @@ static const struct iio_trigger_ops kxcjk1013_trigger= _ops =3D { static void kxcjk1013_report_motion_event(struct iio_dev *indio_dev) { struct kxcjk1013_data *data =3D iio_priv(indio_dev); + const struct kx_chipset_regs *regs =3D data->regs; =20 - int ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_src2); + int ret =3D i2c_smbus_read_byte_data(data->client, regs->int_src2); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_src2\n"); return; @@ -1365,9 +1373,10 @@ static irqreturn_t kxcjk1013_event_handler(int irq, = void *private) { struct iio_dev *indio_dev =3D private; struct kxcjk1013_data *data =3D iio_priv(indio_dev); + const struct kx_chipset_regs *regs =3D data->regs; int ret; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_src1); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_src1); if (ret < 0) { dev_err(&data->client->dev, "Error reading reg_int_src1\n"); goto ack_intr; @@ -1390,7 +1399,7 @@ static irqreturn_t kxcjk1013_event_handler(int irq, v= oid *private) if (data->dready_trigger_on) return IRQ_HANDLED; =20 - ret =3D i2c_smbus_read_byte_data(data->client, data->regs->int_rel); + ret =3D i2c_smbus_read_byte_data(data->client, regs->int_rel); if (ret < 0) dev_err(&data->client->dev, "Error reading reg_int_rel\n"); =20 --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A87821BAFF; Thu, 24 Oct 2024 19:12:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797136; cv=none; b=Oz01LxjP8jTU022+qUS4UKPRldN5vLe5e1ER9K5WMmXQZp09DjcFC2OVoVawZVw5IH4dW5ul5TzzqOjh5e+4gl4oVPy3Xaa83IPsZRRgMOKdsc01IoqKLllP7I4O/0D9z+6disZD2ue2z+IeCFB6cyt/ZRLHBRIud4wdAGVZbEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797136; c=relaxed/simple; bh=AWgXQc8EDdykL8LmbZfim+vs8EntyMpDtukZzMtpKUs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F8SYKMoNEu+qKXCRBO7X+6UZ2M2HFY05I66xFDd/QCVmQXu0FB8Ttq722jd0684Isx52tm8r80Trpqx2fgq6Sqgjm6/Ip39lZczfunQs+Byv/ONnPyKrQdgx3tm6fcjFqMEMTa185g3Dcf10m2GTpTANkxzSFHkQ27q+nwXl+/s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ge+bvsQk; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ge+bvsQk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797134; x=1761333134; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AWgXQc8EDdykL8LmbZfim+vs8EntyMpDtukZzMtpKUs=; b=ge+bvsQklTFhf3j/FSRFabSF3GeT407JnPdLLjDFtDTFfKkBdhHV/Uxu DeJ55l56NkW6qyZmxjpGFpbEEwzgGLRcSKL3yjLgtJcYo7HIf0rL3V58M CUkHDr4YZ51MJxVIPBT9qhpOSezxCtYKreQpmmGgTlBuiBhSoTXgtZcLn w6IcUvPDGsIeBHYMg2x70jQJu/S9BZNFWgdIVjZve+rEBSRQ2ur4uZhf6 jYVVz1fGTm2QedWE7ugm4kjBohCoj9Pg0d1iXgqmjStWFw0/d6FqNssj6 NthP11V5F27NNjs/rqKzCPWYYqyCRTY+4LczfUyoGfKMJbtquuW8AHUFV g==; X-CSE-ConnectionGUID: D8HBJ4fnRTWK5DhhbpTjHQ== X-CSE-MsgGUID: W2iP/38OSWy/R8BWT9QtgA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934465" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934465" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: oFXVPg6NTP6TTs+xF3sKtg== X-CSE-MsgGUID: HC5mXl3uRXGZKHyJH5zRkQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266684" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 92294644; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 10/24] iio: accel: kxcjk-1013: Rename kxcjk1013_info Date: Thu, 24 Oct 2024 22:04:59 +0300 Message-ID: <20241024191200.229894-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Rename kxcjk1013_info to kxcjk1013_iio_info in preparatory of further cleaning up changes. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index a5411d920025..f97bdbbe71ed 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -1211,7 +1211,7 @@ static const struct iio_buffer_setup_ops kxcjk1013_bu= ffer_setup_ops =3D { .postdisable =3D kxcjk1013_buffer_postdisable, }; =20 -static const struct iio_info kxcjk1013_info =3D { +static const struct iio_info kxcjk1013_iio_info =3D { .attrs =3D &kxcjk1013_attrs_group, .read_raw =3D kxcjk1013_read_raw, .write_raw =3D kxcjk1013_write_raw, @@ -1533,7 +1533,7 @@ static int kxcjk1013_probe(struct i2c_client *client) indio_dev->available_scan_masks =3D kxcjk1013_scan_masks; indio_dev->name =3D name; indio_dev->modes =3D INDIO_DIRECT_MODE; - indio_dev->info =3D &kxcjk1013_info; + indio_dev->info =3D &kxcjk1013_iio_info; =20 if (client->irq > 0 && data->acpi_type !=3D ACPI_SMO8500) { ret =3D devm_request_threaded_irq(&client->dev, client->irq, --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F240121C178; Thu, 24 Oct 2024 19:12:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797138; cv=none; b=a4OFYGZd9H9vBfyz777vI67+2ibhOOCWNBpPwLhNLdSA8W8kugXCmIr9yxoCD5WqBzd65UJyE21bLvCAreB5UV5dBcF3vlyO5CWIAl7X4cL3R+FCTeizFzNM/knFG+XfdRoGwGtOysp6y9ptU3IXW2U0ALg+uFKlyHe/oOAx1J0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797138; c=relaxed/simple; bh=uT+ZwqlgTNNgVTqgPAMtmbOzjSABGu/ZcvrSOTZ429c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QQmozEJ7CvmJ1au3oHeNp3QvWGar2guMWbHwk3FLcZZowg0Mo8f3eCkj0HfWiHunG0emg3gOcdamaY4GsmYPtdBrGxlPllxWdCoBVghQGm/wh8/eIfxs2SfINIPB3HvqkuVVuhID5l1fUCjfC3ttDMUmEG0kH1xbRG3zCjXJGTY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=DZWfDlff; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DZWfDlff" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797135; x=1761333135; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uT+ZwqlgTNNgVTqgPAMtmbOzjSABGu/ZcvrSOTZ429c=; b=DZWfDlffMpoFwpkbXngBd1wbR/CZwxiMtVgNCZk9tqcqdcmlnT9NG9E9 mvnyYI2CTh8Jl+3WfijL5GTdSwyNg1WU80Wftw+4EebU8JKjeAZx9I9O6 GmCXtE5E/nc2tHS4ENDJdqTBv9AA07STvSRDF/bnPV7VEZhjkr04XF9CK TJnVWHDCPIhFogDV7BXljmPseX4uX6zQKgzUxF9YgpD6NpMUZmbOxd2xI Zm8KISdC/vWZyISf6Asn+u1rtLVxmeCnTuFHUE6jiN2MrG8UBJ38bVuH7 68uRxrR+LO0lR+cULrm90YTpe79ocpFW6H3ZklnEf3fSAsi8pu/YrpWrP A==; X-CSE-ConnectionGUID: Wa+vcPmvSUG1SyV9pTra/A== X-CSE-MsgGUID: mDKDWHq8T4CCeVZkFEOA4A== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934474" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934474" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: QsIQKEV2R7WqzuQSQRXJaw== X-CSE-MsgGUID: R+zOKOmWT9WBWY8p5qpJLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266685" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9B01B6A7; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 11/24] iio: accel: kxcjk-1013: Start using chip_info variables instead of enum Date: Thu, 24 Oct 2024 22:05:00 +0300 Message-ID: <20241024191200.229894-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having a enum and keeping IDs as driver data pointers, just have a chip_info struct per supported device. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 171 +++++++++++++++++++-------------- 1 file changed, 99 insertions(+), 72 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index f97bdbbe71ed..37c82fdf7c43 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -234,6 +234,55 @@ static const struct kx_chipset_regs kx0231025_regs =3D= { .wake_thres =3D KX023_REG_ATH, }; =20 +struct kx_chipset_info { + const struct kx_chipset_regs *regs; + enum kx_chipset chipset; + enum kx_acpi_type acpi_type; +}; + +static const struct kx_chipset_info kxcjk1013_info =3D { + .regs =3D &kxcjk1013_regs, + .chipset =3D KXCJK1013, +}; + +static const struct kx_chipset_info kxcj91008_info =3D { + .regs =3D &kxcjk1013_regs, + .chipset =3D KXCJ91008, +}; + +static const struct kx_chipset_info kxcj91008_kiox010a_info =3D { + .regs =3D &kxcjk1013_regs, + .chipset =3D KXCJ91008, + .acpi_type =3D ACPI_KIOX010A, +}; + +static const struct kx_chipset_info kxcj91008_kiox020a_info =3D { + .regs =3D &kxcjk1013_regs, + .chipset =3D KXCJ91008, + .acpi_type =3D ACPI_GENERIC, +}; + +static const struct kx_chipset_info kxcj91008_smo8500_info =3D { + .regs =3D &kxcjk1013_regs, + .chipset =3D KXCJ91008, + .acpi_type =3D ACPI_SMO8500, +}; + +static const struct kx_chipset_info kxtj21009_info =3D { + .regs =3D &kxcjk1013_regs, + .chipset =3D KXTJ21009, +}; + +static const struct kx_chipset_info kxtf9_info =3D { + .regs =3D &kxtf9_regs, + .chipset =3D KXTF9, +}; + +static const struct kx_chipset_info kx0231025_info =3D { + .regs =3D &kx0231025_regs, + .chipset =3D KX0231025, +}; + enum kxcjk1013_axis { AXIS_X, AXIS_Y, @@ -261,9 +310,7 @@ struct kxcjk1013_data { int ev_enable_state; bool motion_trigger_on; int64_t timestamp; - enum kx_chipset chipset; - enum kx_acpi_type acpi_type; - const struct kx_chipset_regs *regs; + const struct kx_chipset_info *info; }; =20 enum kxcjk1013_mode { @@ -425,27 +472,28 @@ static int kiox010a_dsm(struct device *dev, int fn_in= dex) } =20 static const struct acpi_device_id kx_acpi_match[] =3D { - {"KXCJ1013", KXCJK1013}, - {"KXCJ1008", KXCJ91008}, - {"KXCJ9000", KXCJ91008}, - {"KIOX0008", KXCJ91008}, - {"KIOX0009", KXTJ21009}, - {"KIOX000A", KXCJ91008}, - {"KIOX010A", KXCJ91008}, /* KXCJ91008 in the display of a yoga 2-in-1 */ - {"KIOX020A", KXCJ91008}, /* KXCJ91008 in the base of a yoga 2-in-1 */ - {"KXTJ1009", KXTJ21009}, - {"KXJ2109", KXTJ21009}, - {"SMO8500", KXCJ91008}, + {"KIOX0008", (kernel_ulong_t)&kxcj91008_info }, + {"KIOX0009", (kernel_ulong_t)&kxtj21009_info }, + {"KIOX000A", (kernel_ulong_t)&kxcj91008_info }, + /* KXCJ91008 in the display of a yoga 2-in-1 */ + {"KIOX010A", (kernel_ulong_t)&kxcj91008_kiox010a_info }, + /* KXCJ91008 in the base of a yoga 2-in-1 */ + {"KIOX020A", (kernel_ulong_t)&kxcj91008_kiox020a_info }, + {"KXCJ1008", (kernel_ulong_t)&kxcj91008_info }, + {"KXCJ1013", (kernel_ulong_t)&kxcjk1013_info }, + {"KXCJ9000", (kernel_ulong_t)&kxcj91008_info }, + {"KXJ2109", (kernel_ulong_t)&kxtj21009_info }, + {"KXTJ1009", (kernel_ulong_t)&kxtj21009_info }, + {"SMO8500", (kernel_ulong_t)&kxcj91008_smo8500_info }, { } }; MODULE_DEVICE_TABLE(acpi, kx_acpi_match); - #endif =20 static int kxcjk1013_set_mode(struct kxcjk1013_data *data, enum kxcjk1013_mode mode) { - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; =20 ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); @@ -471,7 +519,7 @@ static int kxcjk1013_set_mode(struct kxcjk1013_data *da= ta, static int kxcjk1013_get_mode(struct kxcjk1013_data *data, enum kxcjk1013_mode *mode) { - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; =20 ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); @@ -490,7 +538,7 @@ static int kxcjk1013_get_mode(struct kxcjk1013_data *da= ta, =20 static int kxcjk1013_set_range(struct kxcjk1013_data *data, int range_inde= x) { - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; =20 ret =3D i2c_smbus_read_byte_data(data->client, regs->ctrl1); @@ -517,11 +565,11 @@ static int kxcjk1013_set_range(struct kxcjk1013_data = *data, int range_index) =20 static int kxcjk1013_chip_init(struct kxcjk1013_data *data) { - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; =20 #ifdef CONFIG_ACPI - if (data->acpi_type =3D=3D ACPI_KIOX010A) { + if (data->info->acpi_type =3D=3D ACPI_KIOX010A) { /* Make sure the kbd and touchpad on 2-in-1s using 2 KXCJ91008-s work */ kiox010a_dsm(&data->client->dev, KIOX010A_SET_LAPTOP_MODE); } @@ -586,7 +634,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) } =20 /* On KX023, route all used interrupts to INT1 for now */ - if (data->chipset =3D=3D KX0231025 && data->client->irq > 0) { + if (data->info->chipset =3D=3D KX0231025 && data->client->irq > 0) { ret =3D i2c_smbus_write_byte_data(data->client, KX023_REG_INC4, KX023_REG_INC4_DRDY1 | KX023_REG_INC4_WUFI1); @@ -607,8 +655,8 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) =20 static int kxcjk1013_get_startup_times(struct kxcjk1013_data *data) { + int idx =3D data->info->chipset; int i; - int idx =3D data->chipset; =20 for (i =3D 0; i < ARRAY_SIZE(odr_start_up_times[idx]); ++i) { if (odr_start_up_times[idx][i].odr_bits =3D=3D data->odr_bits) @@ -641,7 +689,7 @@ static int kxcjk1013_set_power_state(struct kxcjk1013_d= ata *data, bool on) =20 static int kxcjk1013_chip_update_thresholds(struct kxcjk1013_data *data) { - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; =20 ret =3D i2c_smbus_write_byte_data(data->client, regs->wake_timer, data->w= ake_dur); @@ -663,7 +711,7 @@ static int kxcjk1013_chip_update_thresholds(struct kxcj= k1013_data *data) static int kxcjk1013_setup_any_motion_interrupt(struct kxcjk1013_data *dat= a, bool status) { - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; enum kxcjk1013_mode store_mode; =20 @@ -726,7 +774,7 @@ static int kxcjk1013_setup_any_motion_interrupt(struct = kxcjk1013_data *data, static int kxcjk1013_setup_new_data_interrupt(struct kxcjk1013_data *data, bool status) { - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; enum kxcjk1013_mode store_mode; =20 @@ -814,7 +862,7 @@ static int kxcjk1013_convert_odr_value(const struct kx_= odr_map *map, =20 static int kxcjk1013_set_odr(struct kxcjk1013_data *data, int val, int val= 2) { - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; enum kxcjk1013_mode store_mode; const struct kx_odr_map *odr_setting; @@ -823,7 +871,7 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *dat= a, int val, int val2) if (ret < 0) return ret; =20 - if (data->chipset =3D=3D KXTF9) + if (data->info->chipset =3D=3D KXTF9) odr_setting =3D kxcjk1013_find_odr_value(kxtf9_samp_freq_table, ARRAY_SIZE(kxtf9_samp_freq_table), val, val2); @@ -867,7 +915,7 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *dat= a, int val, int val2) =20 static int kxcjk1013_get_odr(struct kxcjk1013_data *data, int *val, int *v= al2) { - if (data->chipset =3D=3D KXTF9) + if (data->info->chipset =3D=3D KXTF9) return kxcjk1013_convert_odr_value(kxtf9_samp_freq_table, ARRAY_SIZE(kxtf9_samp_freq_table), data->odr_bits, val, val2); @@ -1134,7 +1182,7 @@ static ssize_t kxcjk1013_get_samp_freq_avail(struct d= evice *dev, struct kxcjk1013_data *data =3D iio_priv(indio_dev); const char *str; =20 - if (data->chipset =3D=3D KXTF9) + if (data->info->chipset =3D=3D KXTF9) str =3D kxtf9_samp_freq_avail; else str =3D kxcjk1013_samp_freq_avail; @@ -1251,7 +1299,7 @@ static void kxcjk1013_trig_reen(struct iio_trigger *t= rig) { struct iio_dev *indio_dev =3D iio_trigger_get_drvdata(trig); struct kxcjk1013_data *data =3D iio_priv(indio_dev); - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; =20 ret =3D i2c_smbus_read_byte_data(data->client, regs->int_rel); @@ -1306,7 +1354,7 @@ static const struct iio_trigger_ops kxcjk1013_trigger= _ops =3D { static void kxcjk1013_report_motion_event(struct iio_dev *indio_dev) { struct kxcjk1013_data *data =3D iio_priv(indio_dev); - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; =20 int ret =3D i2c_smbus_read_byte_data(data->client, regs->int_src2); if (ret < 0) { @@ -1373,7 +1421,7 @@ static irqreturn_t kxcjk1013_event_handler(int irq, v= oid *private) { struct iio_dev *indio_dev =3D private; struct kxcjk1013_data *data =3D iio_priv(indio_dev); - const struct kx_chipset_regs *regs =3D data->regs; + const struct kx_chipset_regs *regs =3D data->info->regs; int ret; =20 ret =3D i2c_smbus_read_byte_data(data->client, regs->int_src1); @@ -1383,7 +1431,7 @@ static irqreturn_t kxcjk1013_event_handler(int irq, v= oid *private) } =20 if (ret & KXCJK1013_REG_INT_SRC1_BIT_WUFS) { - if (data->chipset =3D=3D KXTF9) + if (data->info->chipset =3D=3D KXTF9) iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, @@ -1425,8 +1473,7 @@ static irqreturn_t kxcjk1013_data_rdy_trig_poll(int i= rq, void *private) } =20 static const char *kxcjk1013_match_acpi_device(struct device *dev, - enum kx_chipset *chipset, - enum kx_acpi_type *acpi_type, + const struct kx_chipset_info **info, const char **label) { const struct acpi_device_id *id; @@ -1435,16 +1482,12 @@ static const char *kxcjk1013_match_acpi_device(stru= ct device *dev, if (!id) return NULL; =20 - if (strcmp(id->id, "SMO8500") =3D=3D 0) { - *acpi_type =3D ACPI_SMO8500; - } else if (strcmp(id->id, "KIOX010A") =3D=3D 0) { - *acpi_type =3D ACPI_KIOX010A; + if (strcmp(id->id, "KIOX010A") =3D=3D 0) *label =3D "accel-display"; - } else if (strcmp(id->id, "KIOX020A") =3D=3D 0) { + else if (strcmp(id->id, "KIOX020A") =3D=3D 0) *label =3D "accel-base"; - } =20 - *chipset =3D (enum kx_chipset)id->driver_data; + *info =3D (const struct kx_chipset_info *)id->driver_data; =20 return dev_name(dev); } @@ -1496,31 +1539,16 @@ static int kxcjk1013_probe(struct i2c_client *clien= t) msleep(20); =20 if (id) { - data->chipset =3D (enum kx_chipset)(id->driver_data); name =3D id->name; + data->info =3D (const struct kx_chipset_info *)(id->driver_data); } else if (ACPI_HANDLE(&client->dev)) { - name =3D kxcjk1013_match_acpi_device(&client->dev, - &data->chipset, - &data->acpi_type, + name =3D kxcjk1013_match_acpi_device(&client->dev, &data->info, &indio_dev->label); } else return -ENODEV; =20 - switch (data->chipset) { - case KXCJK1013: - case KXCJ91008: - case KXTJ21009: - data->regs =3D &kxcjk1013_regs; - break; - case KXTF9: - data->regs =3D &kxtf9_regs; - break; - case KX0231025: - data->regs =3D &kx0231025_regs; - break; - default: + if (!data->info) return -EINVAL; - } =20 ret =3D kxcjk1013_chip_init(data); if (ret < 0) @@ -1535,7 +1563,7 @@ static int kxcjk1013_probe(struct i2c_client *client) indio_dev->modes =3D INDIO_DIRECT_MODE; indio_dev->info =3D &kxcjk1013_iio_info; =20 - if (client->irq > 0 && data->acpi_type !=3D ACPI_SMO8500) { + if (client->irq > 0 && data->info->acpi_type !=3D ACPI_SMO8500) { ret =3D devm_request_threaded_irq(&client->dev, client->irq, kxcjk1013_data_rdy_trig_poll, kxcjk1013_event_handler, @@ -1711,22 +1739,21 @@ static const struct dev_pm_ops kxcjk1013_pm_ops =3D= { }; =20 static const struct i2c_device_id kxcjk1013_id[] =3D { - {"kxcjk1013", KXCJK1013}, - {"kxcj91008", KXCJ91008}, - {"kxtj21009", KXTJ21009}, - {"kxtf9", KXTF9}, - {"kx023-1025", KX0231025}, + {"kxcjk1013", (kernel_ulong_t)&kxcjk1013_info }, + {"kxcj91008", (kernel_ulong_t)&kxcj91008_info }, + {"kxtj21009", (kernel_ulong_t)&kxtj21009_info }, + {"kxtf9", (kernel_ulong_t)&kxtf9_info }, + {"kx023-1025", (kernel_ulong_t)&kx0231025_info }, {} }; - MODULE_DEVICE_TABLE(i2c, kxcjk1013_id); =20 static const struct of_device_id kxcjk1013_of_match[] =3D { - { .compatible =3D "kionix,kxcjk1013", }, - { .compatible =3D "kionix,kxcj91008", }, - { .compatible =3D "kionix,kxtj21009", }, - { .compatible =3D "kionix,kxtf9", }, - { .compatible =3D "kionix,kx023-1025", }, + { .compatible =3D "kionix,kxcjk1013", &kxcjk1013_info }, + { .compatible =3D "kionix,kxcj91008", &kxcj91008_info }, + { .compatible =3D "kionix,kxtj21009", &kxtj21009_info }, + { .compatible =3D "kionix,kxtf9", &kxtf9_info }, + { .compatible =3D "kionix,kx023-1025", &kx0231025_info }, { } }; MODULE_DEVICE_TABLE(of, kxcjk1013_of_match); --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B60ED21A6FB; Thu, 24 Oct 2024 19:12:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797134; cv=none; b=Zm9b+O89optTLflRSdk1DwhbU1kG9DzjkgMaQeh1mvl04FCrZtfSKZ6GCRzZmeWaQkFervxTpGT0UMbHfIndscwpkusQ9cessqireV8ArrkTcgR6oQBHfBrzEAj9oi8nEdWh8k/pnHHyvRRAPvlR1ana3EGCO+67HpDQLyO4T9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797134; c=relaxed/simple; bh=bTHjEgjwF7ziSPu2OTlI6hYQ0inmQWL2SPBud47igzQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=meA/njnjqVIA3g4IyJJX6eq4bU4m5EOb8ZAJm08Vbh+qhHLDD7FKt148+y4rwsEazzpeKV7OIQi8FejEZb4CGZnu3v1cI7/JqkDaCbi3A990qCHKqcfoqy0ZMHgVUKG2okB10H/jwSFWzdYCvdbxDzQWJqQT+0KR3/299o6vjEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kKWuizoa; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kKWuizoa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797132; x=1761333132; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bTHjEgjwF7ziSPu2OTlI6hYQ0inmQWL2SPBud47igzQ=; b=kKWuizoauO6zIHS0wxi4RRnsbU0KK7BKpInXK9CCu6RXuksE8FWPUD2S 4rwjLugobfZyV4uYbLpDEJ8brPj7aU3Tm+zh8CIbGVXZ/T2VD2Gtx9y3f smTfYlSRmGKyobVi/gHr3rsmDNVUWKUxFPm3HAyMFGTAUUSAdqmMCFFRd vwkXwESCkZg9XxyW2MMbxjvRMsVrz1lCo/enBgJFiZWYWaVZNmpuQ7Q/F vf6bt+6+f+Jch7eWblOGFPszoN2ySTZUIvNB9GVqVcEF9gx5Yfupp5Vk7 hnxdk3L2mYyFsGYXIcjW6OmjCyQEp9LPmx0CcbNY8Ns2iPM3c7YvwteJ1 Q==; X-CSE-ConnectionGUID: EnZW/ztwS7Cv4Ptl1COvIA== X-CSE-MsgGUID: ksu17oOtTT2mji9q/UfvMg== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934449" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934449" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: xztK5kVWT5m08OJRI5kwqw== X-CSE-MsgGUID: G1bb/SvzRbyhO4bdp9Edug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266683" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id A356374C; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 12/24] iio: accel: kxcjk-1013: Move odr_start_up_times up in the code Date: Thu, 24 Oct 2024 22:05:01 +0300 Message-ID: <20241024191200.229894-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move odr_start_up_times up in the code in a preparation of the further cleaning up changes. While at it, make it clear what values from enum are being used for the respective array entries. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 154 ++++++++++++++++----------------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 37c82fdf7c43..f384969a922d 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -178,6 +178,83 @@ enum kx_chipset { KX_MAX_CHIPS /* this must be last */ }; =20 +/* Refer to section 4 of the specification */ +static const struct { + int odr_bits; + int usec; +} odr_start_up_times[KX_MAX_CHIPS][12] =3D { + /* KXCJK-1013 */ + [KXCJK1013] =3D { + {0x08, 100000}, + {0x09, 100000}, + {0x0A, 100000}, + {0x0B, 100000}, + {0, 80000}, + {0x01, 41000}, + {0x02, 21000}, + {0x03, 11000}, + {0x04, 6400}, + {0x05, 3900}, + {0x06, 2700}, + {0x07, 2100}, + }, + /* KXCJ9-1008 */ + [KXCJ91008] =3D { + {0x08, 100000}, + {0x09, 100000}, + {0x0A, 100000}, + {0x0B, 100000}, + {0, 80000}, + {0x01, 41000}, + {0x02, 21000}, + {0x03, 11000}, + {0x04, 6400}, + {0x05, 3900}, + {0x06, 2700}, + {0x07, 2100}, + }, + /* KXCTJ2-1009 */ + [KXTJ21009] =3D { + {0x08, 1240000}, + {0x09, 621000}, + {0x0A, 309000}, + {0x0B, 151000}, + {0, 80000}, + {0x01, 41000}, + {0x02, 21000}, + {0x03, 11000}, + {0x04, 6000}, + {0x05, 4000}, + {0x06, 3000}, + {0x07, 2000}, + }, + /* KXTF9 */ + [KXTF9] =3D { + {0x01, 81000}, + {0x02, 41000}, + {0x03, 21000}, + {0x04, 11000}, + {0x05, 5100}, + {0x06, 2700}, + }, + /* KX023-1025 */ + [KX0231025] =3D { + /* First 4 are not in datasheet, taken from KXCTJ2-1009 */ + {0x08, 1240000}, + {0x09, 621000}, + {0x0A, 309000}, + {0x0B, 151000}, + {0, 81000}, + {0x01, 40000}, + {0x02, 22000}, + {0x03, 12000}, + {0x04, 7000}, + {0x05, 4400}, + {0x06, 3000}, + {0x07, 3000}, + }, +}; + enum kx_acpi_type { ACPI_GENERIC, ACPI_SMO8500, @@ -361,83 +438,6 @@ static const struct kx_odr_map kxtf9_samp_freq_table[]= =3D { static const char *const kxtf9_samp_freq_avail =3D "25 50 100 200 400 800"; =20 -/* Refer to section 4 of the specification */ -static const struct { - int odr_bits; - int usec; -} odr_start_up_times[KX_MAX_CHIPS][12] =3D { - /* KXCJK-1013 */ - { - {0x08, 100000}, - {0x09, 100000}, - {0x0A, 100000}, - {0x0B, 100000}, - {0, 80000}, - {0x01, 41000}, - {0x02, 21000}, - {0x03, 11000}, - {0x04, 6400}, - {0x05, 3900}, - {0x06, 2700}, - {0x07, 2100}, - }, - /* KXCJ9-1008 */ - { - {0x08, 100000}, - {0x09, 100000}, - {0x0A, 100000}, - {0x0B, 100000}, - {0, 80000}, - {0x01, 41000}, - {0x02, 21000}, - {0x03, 11000}, - {0x04, 6400}, - {0x05, 3900}, - {0x06, 2700}, - {0x07, 2100}, - }, - /* KXCTJ2-1009 */ - { - {0x08, 1240000}, - {0x09, 621000}, - {0x0A, 309000}, - {0x0B, 151000}, - {0, 80000}, - {0x01, 41000}, - {0x02, 21000}, - {0x03, 11000}, - {0x04, 6000}, - {0x05, 4000}, - {0x06, 3000}, - {0x07, 2000}, - }, - /* KXTF9 */ - { - {0x01, 81000}, - {0x02, 41000}, - {0x03, 21000}, - {0x04, 11000}, - {0x05, 5100}, - {0x06, 2700}, - }, - /* KX023-1025 */ - { - /* First 4 are not in datasheet, taken from KXCTJ2-1009 */ - {0x08, 1240000}, - {0x09, 621000}, - {0x0A, 309000}, - {0x0B, 151000}, - {0, 81000}, - {0x01, 40000}, - {0x02, 22000}, - {0x03, 12000}, - {0x04, 7000}, - {0x05, 4400}, - {0x06, 3000}, - {0x07, 3000}, - }, -}; - static const struct { u16 scale; u8 gsel_0; --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39EDE21A713; Thu, 24 Oct 2024 19:12:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797134; cv=none; b=enVu6lMao/HP125oLVjhaObM5dIN2Tzbf1Y39JJa6TaDVisyYU5PugniaqKHB2LfnyyHCsAIkbCq/P0W/rHW9IqZagOsl0R3iQzcq3W7i3uf8r0I5816W8SQZPZXw+QuctSvkpx3xIC7T9r88F1pr2aZ/wCWEdoIRF+9A0qPgxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797134; c=relaxed/simple; bh=Zm8+zqk41NUOu3UmS3GvGn8c3EpWUBfPhtq7naAdJ3I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r35n2eg71lF7wPdwAlv70FsV+2C9aoIslJcBOlcjzoM4xo7nQ9fk24Mxo/MjkPkDBRmcshjx2TqqMYmRZ0gMJ1SraAnuMAJqQ2S2ljecDQ2jDln/pAzw1vzV8csADIS3TzPivd9RZ5DQgJOA9J8b833BGEHVP9OdtrBo5TgpSKs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=V3js1TC7; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="V3js1TC7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797132; x=1761333132; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Zm8+zqk41NUOu3UmS3GvGn8c3EpWUBfPhtq7naAdJ3I=; b=V3js1TC7GKWRRuBERit+wZXa8k7rg0QwEojWIVRlqKPRN/WMCJRigSys iUhqx5i8tkRcMFOY/tQadAdfzBIFdRjgr8famy8XeNFfAgMFmGNl7/eWN mgDXld7qltpD4jDMroBMNfUugQgXojr6hwDrhlAZCePlqw6RLzHwlP5Gx 9+7EfJnGNBjWCoNzujoKR5zRQhxeYVMEWK+5m250ZRxF5YSrtnIv0P8tJ wgKaXajyYtCQTJkEh1uktpOYpcDhWt1IwTpL/ZOrIYJIjkvYbKvOXeYwE G1uVhiG4dziK9SGNvDK1XIy1N827/6WZ7MtiJbIHfcMtLLA4let5IpM5c g==; X-CSE-ConnectionGUID: 0YncX3iVRrq17T3y3+v8pQ== X-CSE-MsgGUID: 5SxT0jhDRoa8HSXbvF0j4g== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934456" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934456" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: /JFxhPxGT76Mc6uTll3N+g== X-CSE-MsgGUID: 71Nl+S2ATsK+ILCmUm0Hyw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266687" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B04A77A7; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 13/24] iio: accel: kxcjk-1013: Convert ODR times array to variable in chip_info Date: Thu, 24 Oct 2024 22:05:02 +0300 Message-ID: <20241024191200.229894-14-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Convert odr_start_up_times array to the variable in chip_info. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 166 ++++++++++++++++++--------------- 1 file changed, 89 insertions(+), 77 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index f384969a922d..91f890275a18 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -179,80 +179,84 @@ enum kx_chipset { }; =20 /* Refer to section 4 of the specification */ -static const struct { +struct kx_odr_start_up_time { int odr_bits; int usec; -} odr_start_up_times[KX_MAX_CHIPS][12] =3D { - /* KXCJK-1013 */ - [KXCJK1013] =3D { - {0x08, 100000}, - {0x09, 100000}, - {0x0A, 100000}, - {0x0B, 100000}, - {0, 80000}, - {0x01, 41000}, - {0x02, 21000}, - {0x03, 11000}, - {0x04, 6400}, - {0x05, 3900}, - {0x06, 2700}, - {0x07, 2100}, - }, - /* KXCJ9-1008 */ - [KXCJ91008] =3D { - {0x08, 100000}, - {0x09, 100000}, - {0x0A, 100000}, - {0x0B, 100000}, - {0, 80000}, - {0x01, 41000}, - {0x02, 21000}, - {0x03, 11000}, - {0x04, 6400}, - {0x05, 3900}, - {0x06, 2700}, - {0x07, 2100}, - }, - /* KXCTJ2-1009 */ - [KXTJ21009] =3D { - {0x08, 1240000}, - {0x09, 621000}, - {0x0A, 309000}, - {0x0B, 151000}, - {0, 80000}, - {0x01, 41000}, - {0x02, 21000}, - {0x03, 11000}, - {0x04, 6000}, - {0x05, 4000}, - {0x06, 3000}, - {0x07, 2000}, - }, - /* KXTF9 */ - [KXTF9] =3D { - {0x01, 81000}, - {0x02, 41000}, - {0x03, 21000}, - {0x04, 11000}, - {0x05, 5100}, - {0x06, 2700}, - }, - /* KX023-1025 */ - [KX0231025] =3D { - /* First 4 are not in datasheet, taken from KXCTJ2-1009 */ - {0x08, 1240000}, - {0x09, 621000}, - {0x0A, 309000}, - {0x0B, 151000}, - {0, 81000}, - {0x01, 40000}, - {0x02, 22000}, - {0x03, 12000}, - {0x04, 7000}, - {0x05, 4400}, - {0x06, 3000}, - {0x07, 3000}, - }, +}; + +/* KXCJK-1013 */ +static const struct kx_odr_start_up_time kxcjk1013_odr_start_up_times[] = =3D { + {0x08, 100000}, + {0x09, 100000}, + {0x0A, 100000}, + {0x0B, 100000}, + {0, 80000}, + {0x01, 41000}, + {0x02, 21000}, + {0x03, 11000}, + {0x04, 6400}, + {0x05, 3900}, + {0x06, 2700}, + {0x07, 2100}, +}; + +/* KXCJ9-1008 */ +static const struct kx_odr_start_up_time kxcj91008_odr_start_up_times[] = =3D { + {0x08, 100000}, + {0x09, 100000}, + {0x0A, 100000}, + {0x0B, 100000}, + {0, 80000}, + {0x01, 41000}, + {0x02, 21000}, + {0x03, 11000}, + {0x04, 6400}, + {0x05, 3900}, + {0x06, 2700}, + {0x07, 2100}, +}; + +/* KXCTJ2-1009 */ +static const struct kx_odr_start_up_time kxtj21009_odr_start_up_times[] = =3D { + {0x08, 1240000}, + {0x09, 621000}, + {0x0A, 309000}, + {0x0B, 151000}, + {0, 80000}, + {0x01, 41000}, + {0x02, 21000}, + {0x03, 11000}, + {0x04, 6000}, + {0x05, 4000}, + {0x06, 3000}, + {0x07, 2000}, +}; + +/* KXTF9 */ +static const struct kx_odr_start_up_time kxtf9_odr_start_up_times[] =3D { + {0x01, 81000}, + {0x02, 41000}, + {0x03, 21000}, + {0x04, 11000}, + {0x05, 5100}, + {0x06, 2700}, +}; + +/* KX023-1025 */ +static const struct kx_odr_start_up_time kx0231025_odr_start_up_times[] = =3D { + /* First 4 are not in datasheet, taken from KXCTJ2-1009 */ + {0x08, 1240000}, + {0x09, 621000}, + {0x0A, 309000}, + {0x0B, 151000}, + {0, 81000}, + {0x01, 40000}, + {0x02, 22000}, + {0x03, 12000}, + {0x04, 7000}, + {0x05, 4400}, + {0x06, 3000}, + {0x07, 3000}, }; =20 enum kx_acpi_type { @@ -313,50 +317,59 @@ static const struct kx_chipset_regs kx0231025_regs = =3D { =20 struct kx_chipset_info { const struct kx_chipset_regs *regs; + const struct kx_odr_start_up_time *times; enum kx_chipset chipset; enum kx_acpi_type acpi_type; }; =20 static const struct kx_chipset_info kxcjk1013_info =3D { .regs =3D &kxcjk1013_regs, + .times =3D pm_ptr(kxcjk1013_odr_start_up_times), .chipset =3D KXCJK1013, }; =20 static const struct kx_chipset_info kxcj91008_info =3D { .regs =3D &kxcjk1013_regs, + .times =3D pm_ptr(kxcj91008_odr_start_up_times), .chipset =3D KXCJ91008, }; =20 static const struct kx_chipset_info kxcj91008_kiox010a_info =3D { .regs =3D &kxcjk1013_regs, + .times =3D pm_ptr(kxcj91008_odr_start_up_times), .chipset =3D KXCJ91008, .acpi_type =3D ACPI_KIOX010A, }; =20 static const struct kx_chipset_info kxcj91008_kiox020a_info =3D { .regs =3D &kxcjk1013_regs, + .times =3D pm_ptr(kxcj91008_odr_start_up_times), .chipset =3D KXCJ91008, .acpi_type =3D ACPI_GENERIC, }; =20 static const struct kx_chipset_info kxcj91008_smo8500_info =3D { .regs =3D &kxcjk1013_regs, + .times =3D pm_ptr(kxcj91008_odr_start_up_times), .chipset =3D KXCJ91008, .acpi_type =3D ACPI_SMO8500, }; =20 static const struct kx_chipset_info kxtj21009_info =3D { .regs =3D &kxcjk1013_regs, + .times =3D pm_ptr(kxtj21009_odr_start_up_times), .chipset =3D KXTJ21009, }; =20 static const struct kx_chipset_info kxtf9_info =3D { .regs =3D &kxtf9_regs, + .times =3D pm_ptr(kxtf9_odr_start_up_times), .chipset =3D KXTF9, }; =20 static const struct kx_chipset_info kx0231025_info =3D { .regs =3D &kx0231025_regs, + .times =3D pm_ptr(kx0231025_odr_start_up_times), .chipset =3D KX0231025, }; =20 @@ -655,12 +668,11 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data = *data) =20 static int kxcjk1013_get_startup_times(struct kxcjk1013_data *data) { - int idx =3D data->info->chipset; - int i; + const struct kx_odr_start_up_time *times; =20 - for (i =3D 0; i < ARRAY_SIZE(odr_start_up_times[idx]); ++i) { - if (odr_start_up_times[idx][i].odr_bits =3D=3D data->odr_bits) - return odr_start_up_times[idx][i].usec; + for (times =3D data->info->times; times->usec; times++) { + if (times->odr_bits =3D=3D data->odr_bits) + return times->usec; } =20 return KXCJK1013_MAX_STARTUP_TIME_US; --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB13221B42E; Thu, 24 Oct 2024 19:12:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797135; cv=none; b=sNvxI6dEddmxAAR92VoDTemdImUf97TZfWlCQioER8PpIrBLVC6Er3pVzw3bDOQM3YrK0lF1BF4+pHDqSZz9UDFDXUMyUwiLcTioCSIHDvHmpSP47HZDWcmeePayVxYrFbf+ln/gz4pmL7z79bjTMkwi6dmgidykz7aBh8Nywrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797135; c=relaxed/simple; bh=lQsVcIQwAn8KhzDOMnY7WmBQepBX8sbl0BQBGSWimoU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uyJdqM/jThaYxdEWUYmgv/sqw1HzXOJRL/XpYAZx2e5D30tFrnq6jWyt6ebwijlpm+YN6FqPm3uWGQKjA0OvOVqjy5l7TwT9zdaDS06jgV7VRGHHB3051aSkZJMt+GV8768gilJIOdaNpN0P76dSLCo3G9aaZLg3WOoHqfP1mtw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mkc1j1oi; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mkc1j1oi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797133; x=1761333133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lQsVcIQwAn8KhzDOMnY7WmBQepBX8sbl0BQBGSWimoU=; b=mkc1j1oiz3mWYnoVg9lRrpyYKz0RCx7WjDbxsrOMQzQOKgIzYO6N7mOq KvmSyEPCE1+WvWPMLtinoJRBDbuCGxXZcjTRqiGgRfHEgvlryFc8TAOhJ /+BbzeqPsNtIwR13LN3ldUxQNuWGE36gF0J0DEzDZgn5fyyj0KrvxF8k2 Ucr3/BwgqNI0Pg1TZQsXGlFqqOaICzDsWrk+J/L7aj8svQt23XwQIpy5M Pfc44QiyzQLFlK9hrq+tvi52wlL3fJz7E8U9aChmWhZsj4e9TzOsTPuJg 1qrFBTHz2BODFfcOf9a1dLUwo/0cP5vPWCCDSL9ISWV+mQuzPorK3f2DD g==; X-CSE-ConnectionGUID: 5J83zkmQRuGu7tLs6VtvqQ== X-CSE-MsgGUID: QqBzVvzXRtSUT6HbjVOicA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934473" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934473" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:08 -0700 X-CSE-ConnectionGUID: 6sZhBLgJQzCLw8OwzjoGUA== X-CSE-MsgGUID: MlFM+kzHS6mqaiPNcF+WpQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266688" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:06 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id B827B7B8; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 14/24] iio: accel: kxcjk-1013: Get rid of enum kx_chipset Date: Thu, 24 Oct 2024 22:05:03 +0300 Message-ID: <20241024191200.229894-15-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of using enum, out of which only a couple of values are being actully used, make a comparisons against pointer to the respective chip_info structures. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 91f890275a18..a8c73e401f95 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -169,15 +169,6 @@ =20 #define KXCJK1013_DEFAULT_WAKE_THRES 1 =20 -enum kx_chipset { - KXCJK1013, - KXCJ91008, - KXTJ21009, - KXTF9, - KX0231025, - KX_MAX_CHIPS /* this must be last */ -}; - /* Refer to section 4 of the specification */ struct kx_odr_start_up_time { int odr_bits; @@ -318,59 +309,50 @@ static const struct kx_chipset_regs kx0231025_regs = =3D { struct kx_chipset_info { const struct kx_chipset_regs *regs; const struct kx_odr_start_up_time *times; - enum kx_chipset chipset; enum kx_acpi_type acpi_type; }; =20 static const struct kx_chipset_info kxcjk1013_info =3D { .regs =3D &kxcjk1013_regs, .times =3D pm_ptr(kxcjk1013_odr_start_up_times), - .chipset =3D KXCJK1013, }; =20 static const struct kx_chipset_info kxcj91008_info =3D { .regs =3D &kxcjk1013_regs, .times =3D pm_ptr(kxcj91008_odr_start_up_times), - .chipset =3D KXCJ91008, }; =20 static const struct kx_chipset_info kxcj91008_kiox010a_info =3D { .regs =3D &kxcjk1013_regs, .times =3D pm_ptr(kxcj91008_odr_start_up_times), - .chipset =3D KXCJ91008, .acpi_type =3D ACPI_KIOX010A, }; =20 static const struct kx_chipset_info kxcj91008_kiox020a_info =3D { .regs =3D &kxcjk1013_regs, .times =3D pm_ptr(kxcj91008_odr_start_up_times), - .chipset =3D KXCJ91008, .acpi_type =3D ACPI_GENERIC, }; =20 static const struct kx_chipset_info kxcj91008_smo8500_info =3D { .regs =3D &kxcjk1013_regs, .times =3D pm_ptr(kxcj91008_odr_start_up_times), - .chipset =3D KXCJ91008, .acpi_type =3D ACPI_SMO8500, }; =20 static const struct kx_chipset_info kxtj21009_info =3D { .regs =3D &kxcjk1013_regs, .times =3D pm_ptr(kxtj21009_odr_start_up_times), - .chipset =3D KXTJ21009, }; =20 static const struct kx_chipset_info kxtf9_info =3D { .regs =3D &kxtf9_regs, .times =3D pm_ptr(kxtf9_odr_start_up_times), - .chipset =3D KXTF9, }; =20 static const struct kx_chipset_info kx0231025_info =3D { .regs =3D &kx0231025_regs, .times =3D pm_ptr(kx0231025_odr_start_up_times), - .chipset =3D KX0231025, }; =20 enum kxcjk1013_axis { @@ -647,7 +629,7 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *d= ata) } =20 /* On KX023, route all used interrupts to INT1 for now */ - if (data->info->chipset =3D=3D KX0231025 && data->client->irq > 0) { + if (data->info =3D=3D &kx0231025_info && data->client->irq > 0) { ret =3D i2c_smbus_write_byte_data(data->client, KX023_REG_INC4, KX023_REG_INC4_DRDY1 | KX023_REG_INC4_WUFI1); @@ -883,7 +865,7 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *dat= a, int val, int val2) if (ret < 0) return ret; =20 - if (data->info->chipset =3D=3D KXTF9) + if (data->info =3D=3D &kxtf9_info) odr_setting =3D kxcjk1013_find_odr_value(kxtf9_samp_freq_table, ARRAY_SIZE(kxtf9_samp_freq_table), val, val2); @@ -927,7 +909,7 @@ static int kxcjk1013_set_odr(struct kxcjk1013_data *dat= a, int val, int val2) =20 static int kxcjk1013_get_odr(struct kxcjk1013_data *data, int *val, int *v= al2) { - if (data->info->chipset =3D=3D KXTF9) + if (data->info =3D=3D &kxtf9_info) return kxcjk1013_convert_odr_value(kxtf9_samp_freq_table, ARRAY_SIZE(kxtf9_samp_freq_table), data->odr_bits, val, val2); @@ -1194,7 +1176,7 @@ static ssize_t kxcjk1013_get_samp_freq_avail(struct d= evice *dev, struct kxcjk1013_data *data =3D iio_priv(indio_dev); const char *str; =20 - if (data->info->chipset =3D=3D KXTF9) + if (data->info =3D=3D &kxtf9_info) str =3D kxtf9_samp_freq_avail; else str =3D kxcjk1013_samp_freq_avail; @@ -1443,7 +1425,7 @@ static irqreturn_t kxcjk1013_event_handler(int irq, v= oid *private) } =20 if (ret & KXCJK1013_REG_INT_SRC1_BIT_WUFS) { - if (data->info->chipset =3D=3D KXTF9) + if (data->info =3D=3D &kxtf9_info) iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL, 0, --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C6C822626D; Thu, 24 Oct 2024 19:12:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797139; cv=none; b=iNNnvRqj5YsIcF+Sf5BikgV+5XCr8S1doa9Y52O7kpudCkTVdmstgvB2/l2oUMamOh9HT6URj20KEh4l/2bE/tAkQd+kXiOSW/ObLBuLhpDRxpEe2cX8ZOk7NmXkdBJIZTmmARKpPgf8yEBbaYFPGicoz5jjGYU67yGVmHKPVkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797139; c=relaxed/simple; bh=b8hIeNRtf3Ory07zi10pIZrzrMdfb+TK7D/5/ekkk3E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tYhGyysiepGsZj5V3pM8w8Nfb2Wy5A8uyS8olAjEaEAiRUz0Rg8JNb39yTYM++l4ax7n+x7k9knrx/Mjt1iRRWwG6nj+Xa4YMZKiVrC0I4HQVTPg5cG4yH5h2eADoQ9B4kZXnntwqzMEOmahTYdIUNwXPKznLY4e/K1Rp1hfBPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jXCIBLJ0; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jXCIBLJ0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797138; x=1761333138; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b8hIeNRtf3Ory07zi10pIZrzrMdfb+TK7D/5/ekkk3E=; b=jXCIBLJ0CprDrxPryRX4zvJGj1eHLAuShSX3A7bjXHq8YeJN+aixHcex AnEy0m9Qgj0ezl+BAPhAWkAms7OXyUq0eeRn64dV6N2PMyc1PMxL5k/ji I8ZHKrDyek169+qkdzBOxwCdDIuQDsjy1+Dl6wbVdnhARwrwgClw1U1mk Kil+uXJtO/8MZdmlqjruAZ7fg5dd1VZ2jYNKdtlUQIC15wWsALqCanwkh E+WkqkvvsYrsYDH9qPALLgx91Px3ND9ac883j3PuGKBNzl69lJ0SKaAq3 JS+gvbQ/Cbnyq7hDhTqrd4cF5nN4MyDQ+rdsW6g3hcA6c/Y0Agnzq369f Q==; X-CSE-ConnectionGUID: ptLVxmOnToqBcq5NrDzOpQ== X-CSE-MsgGUID: eD6FJokTTW+vKfnOUNtwmA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934529" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934529" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:11 -0700 X-CSE-ConnectionGUID: WSsAyPekQsOO8ffbemVkxQ== X-CSE-MsgGUID: 05Cn2qFhTC2p8CSp+gDplQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266713" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C61727F7; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 15/24] iio: accel: kxcjk-1013: Replace a variant of iio_get_acpi_device_name_and_data() Date: Thu, 24 Oct 2024 22:05:04 +0300 Message-ID: <20241024191200.229894-16-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" IIO core (ACPI part) provides a generic helper that may be used in the driver. Replace a variant of iio_get_acpi_device_name_and_data(). Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 38 ++++++++++------------------------ 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index a8c73e401f95..e8074e0c59a4 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -1466,26 +1466,6 @@ static irqreturn_t kxcjk1013_data_rdy_trig_poll(int = irq, void *private) return IRQ_HANDLED; } =20 -static const char *kxcjk1013_match_acpi_device(struct device *dev, - const struct kx_chipset_info **info, - const char **label) -{ - const struct acpi_device_id *id; - - id =3D acpi_match_device(dev->driver->acpi_match_table, dev); - if (!id) - return NULL; - - if (strcmp(id->id, "KIOX010A") =3D=3D 0) - *label =3D "accel-display"; - else if (strcmp(id->id, "KIOX020A") =3D=3D 0) - *label =3D "accel-base"; - - *info =3D (const struct kx_chipset_info *)id->driver_data; - - return dev_name(dev); -} - static int kxcjk1013_probe(struct i2c_client *client) { const struct i2c_device_id *id =3D i2c_client_get_device_id(client); @@ -1493,6 +1473,7 @@ static int kxcjk1013_probe(struct i2c_client *client) struct kxcjk1013_data *data; struct iio_dev *indio_dev; struct kxcjk_1013_platform_data *pdata; + const void *ddata; const char *name; int ret; =20 @@ -1535,15 +1516,18 @@ static int kxcjk1013_probe(struct i2c_client *clien= t) if (id) { name =3D id->name; data->info =3D (const struct kx_chipset_info *)(id->driver_data); - } else if (ACPI_HANDLE(&client->dev)) { - name =3D kxcjk1013_match_acpi_device(&client->dev, &data->info, - &indio_dev->label); - } else + } else { + name =3D iio_get_acpi_device_name_and_data(&client->dev, &ddata); + if (name) + data->info =3D ddata; + if (data->info =3D=3D &kxcj91008_kiox010a_info) + indio_dev->label =3D "accel-display"; + else if (data->info =3D=3D &kxcj91008_kiox020a_info) + indio_dev->label =3D "accel-base"; + } + if (!name) return -ENODEV; =20 - if (!data->info) - return -EINVAL; - ret =3D kxcjk1013_chip_init(data); if (ret < 0) return ret; --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78308218D7F; Thu, 24 Oct 2024 19:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797138; cv=none; b=FcEihCzcAzMjVjEuzPfcyNWZ+0MxbGmayRfm+P9lPaf7qa2fTKRuzGLyTMRmKRxIjdFat3LzQFlWV99/VadmKfcxaO/Hs4XB3Xv9JeUGfu41kiTgtITRujJgitUG6kt5P1K/JomoT3v0ozElMfGMro7FbfqhLP+6z6sKyDIF298= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797138; c=relaxed/simple; bh=zxQd+68Z1zPrrX9bNKxVFx6C4dGvd3tUJFvHEY8+Vz4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SmwhLTUGwIAcamcTCKzF91BbyjejcbgexxgoX5noUkHjLPMTprsB9qGH+vyy91ktqbfFBiHyXC7c4CtxeNvPIPeKag+U8DzO7o+XPWmQ/RggMciwmWOgC9gsI0OfVkWhENMJ0mpHf2JsAn99ZnxxXOds+yNalKeEBdRbDqY6H6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Y3wYR7EP; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Y3wYR7EP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797136; x=1761333136; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zxQd+68Z1zPrrX9bNKxVFx6C4dGvd3tUJFvHEY8+Vz4=; b=Y3wYR7EPqnDcRLveifZ5FWoqfWb+jamTAu9QfrmsUczcfPHMsQ8IY3Hw iIJPE82IB3NMRvu/OSRw5p61pGcMj0j5rmmhjBCV5gQcewR8apUcmaj6p IAuTPC4XeSYmrd4qwwyjjwc1qCNL75CIw3T4Y04EM38KDLi9fBV1jVUi/ iWWeD3XWnF3dlnNLcWfGSXNEUJG2+5GEouO+zUZTy8ZmEu7LTt52yMzCJ knA5Y+7qEStRzdsFJxkZF8S0CmG3lNCpckFwYTNqDUZ/ZSMTxrxOa/N98 DsVTk75AqOS6+vP8MFEc/RgO+gI0mUNKJe4hzoThcFNuavIBI5riRZzZf w==; X-CSE-ConnectionGUID: tkgAj+w4SzGMhnCZ6mlJow== X-CSE-MsgGUID: vnvODcQ/SgiOmFV2sZ4MNg== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934505" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934505" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:11 -0700 X-CSE-ConnectionGUID: 7+UF6+JeR8afNWZmZpDFqg== X-CSE-MsgGUID: ZFhJ9pZXTDup4dBV96Wl9w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266714" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CF6AC7F9; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 16/24] iio: accel: kxcjk-1013: drop ACPI_PTR() and move ID out of CONFIG_ACPI guards Date: Thu, 24 Oct 2024 22:05:05 +0300 Message-ID: <20241024191200.229894-17-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The complexity of config guards needed for ACPI_PTR() is not worthwhile for the small amount of saved data. This example was doing it correctly but I am proposing dropping this so as to reduce chance of cut and paste where it is done wrong. Also added linux/mod_devicetable.h for struct acpi_device_id definition. Signed-off-by: Andy Shevchenko --- drivers/iio/accel/kxcjk-1013.c | 41 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index e8074e0c59a4..baa2674b93f0 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -4,11 +4,12 @@ * Copyright (c) 2014, Intel Corporation. */ =20 -#include #include #include #include #include +#include +#include #include #include #include @@ -465,24 +466,6 @@ static int kiox010a_dsm(struct device *dev, int fn_ind= ex) ACPI_FREE(obj); return 0; } - -static const struct acpi_device_id kx_acpi_match[] =3D { - {"KIOX0008", (kernel_ulong_t)&kxcj91008_info }, - {"KIOX0009", (kernel_ulong_t)&kxtj21009_info }, - {"KIOX000A", (kernel_ulong_t)&kxcj91008_info }, - /* KXCJ91008 in the display of a yoga 2-in-1 */ - {"KIOX010A", (kernel_ulong_t)&kxcj91008_kiox010a_info }, - /* KXCJ91008 in the base of a yoga 2-in-1 */ - {"KIOX020A", (kernel_ulong_t)&kxcj91008_kiox020a_info }, - {"KXCJ1008", (kernel_ulong_t)&kxcj91008_info }, - {"KXCJ1013", (kernel_ulong_t)&kxcjk1013_info }, - {"KXCJ9000", (kernel_ulong_t)&kxcj91008_info }, - {"KXJ2109", (kernel_ulong_t)&kxtj21009_info }, - {"KXTJ1009", (kernel_ulong_t)&kxtj21009_info }, - {"SMO8500", (kernel_ulong_t)&kxcj91008_smo8500_info }, - { } -}; -MODULE_DEVICE_TABLE(acpi, kx_acpi_match); #endif =20 static int kxcjk1013_set_mode(struct kxcjk1013_data *data, @@ -1736,10 +1719,28 @@ static const struct of_device_id kxcjk1013_of_match= [] =3D { }; MODULE_DEVICE_TABLE(of, kxcjk1013_of_match); =20 +static const struct acpi_device_id kx_acpi_match[] =3D { + {"KIOX0008", (kernel_ulong_t)&kxcj91008_info }, + {"KIOX0009", (kernel_ulong_t)&kxtj21009_info }, + {"KIOX000A", (kernel_ulong_t)&kxcj91008_info }, + /* KXCJ91008 in the display of a yoga 2-in-1 */ + {"KIOX010A", (kernel_ulong_t)&kxcj91008_kiox010a_info }, + /* KXCJ91008 in the base of a yoga 2-in-1 */ + {"KIOX020A", (kernel_ulong_t)&kxcj91008_kiox020a_info }, + {"KXCJ1008", (kernel_ulong_t)&kxcj91008_info }, + {"KXCJ1013", (kernel_ulong_t)&kxcjk1013_info }, + {"KXCJ9000", (kernel_ulong_t)&kxcj91008_info }, + {"KXJ2109", (kernel_ulong_t)&kxtj21009_info }, + {"KXTJ1009", (kernel_ulong_t)&kxtj21009_info }, + {"SMO8500", (kernel_ulong_t)&kxcj91008_smo8500_info }, + { } +}; +MODULE_DEVICE_TABLE(acpi, kx_acpi_match); + static struct i2c_driver kxcjk1013_driver =3D { .driver =3D { .name =3D KXCJK1013_DRV_NAME, - .acpi_match_table =3D ACPI_PTR(kx_acpi_match), + .acpi_match_table =3D kx_acpi_match, .of_match_table =3D kxcjk1013_of_match, .pm =3D pm_ptr(&kxcjk1013_pm_ops), }, --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F2E8228B62; Thu, 24 Oct 2024 19:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797142; cv=none; b=tqrDrkC/Tnw7q/93Kb7s02279AHC8KePD+41zr+jhMdVAkgl9xGRhLmZ+R1mou9QfO8+y1mx/skPR9l5KO3i1yDhY/xcrosxOt1AwiTPeWpQFLhcWcre9atKkpGvMzYt+2XAxb5sp6v6DCr6LmkL5c4oE/ASKK0t33+PJR2AwU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797142; c=relaxed/simple; bh=8sCpK1pd7nRUkCdMXWy4llb6XrvP6fxWrADB2+farzU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fsxga8KoU9zEzbtuHlLVA/VdqJQRV9gH1f9BIKArRQixejMWqkiAVEFfwbfNpRw0WFvhr6FB64Ky/n8ZvrzNzvrkkR/ywuDmCGIN38wk/HxjVZCL/JHCbL4Vxkv9Qlp5R+2ckHvY0rpMsBymypQurK+q0v8aG+XRK/B8bsZ8MG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=aLUd6vlC; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="aLUd6vlC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797140; x=1761333140; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8sCpK1pd7nRUkCdMXWy4llb6XrvP6fxWrADB2+farzU=; b=aLUd6vlCBWApooPx+k053YXnrK4vD7Z3YNGQ/zs9GkxX3FgnHzAMMOxx CfrOdjlrQa/k6xKe2/xdtWPXMDLQAAMQ0w6BbFcO8O+Jtck0qI4wviFiw ywX+LZGfG+eAsgJ+OJJWGW9IxJKs7ZhvQVUpNVOztq0X62MD4o1JQNufR Ea/zbgHW01ib5nza4GhhCA+BNh6/bnX0U13Cwjpm8nSrt0IybdAPSOJW0 9vz3US7gq/x68cr087zBisrqnst+ayvdTRru+PIzDmVZhYajyCHfm/emq dNzoZkXUyASC2DD9bb0xY+wOJOXGgqKmqted9F6eNMosUIFy70y95cDHB w==; X-CSE-ConnectionGUID: jcPN8I9FTNKDcW/9g6sc/w== X-CSE-MsgGUID: 8YzzzbdbR5SPMh8jNKcgYQ== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934542" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934542" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:12 -0700 X-CSE-ConnectionGUID: xEwNjSDTSG+s0b1HBxkeHw== X-CSE-MsgGUID: UgyuPlXuTk67rQddw1vj4A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266716" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DA01480A; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 17/24] iio: accel: mma9551: Replace custom implementation of iio_get_acpi_device_name() Date: Thu, 24 Oct 2024 22:05:06 +0300 Message-ID: <20241024191200.229894-18-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" IIO core (ACPI part) provides a generic helper that may be used in the driver. Replace custom implementation of iio_get_acpi_device_name(). Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/accel/mma9551.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c index fa1799b0b0df..a5d20d8d08b8 100644 --- a/drivers/iio/accel/mma9551.c +++ b/drivers/iio/accel/mma9551.c @@ -4,11 +4,11 @@ * Copyright (c) 2014, Intel Corporation. */ =20 -#include #include #include +#include +#include #include -#include #include #include #include @@ -435,17 +435,6 @@ static int mma9551_gpio_probe(struct iio_dev *indio_de= v) return 0; } =20 -static const char *mma9551_match_acpi_device(struct device *dev) -{ - const struct acpi_device_id *id; - - id =3D acpi_match_device(dev->driver->acpi_match_table, dev); - if (!id) - return NULL; - - return dev_name(dev); -} - static int mma9551_probe(struct i2c_client *client) { const struct i2c_device_id *id =3D i2c_client_get_device_id(client); @@ -464,8 +453,8 @@ static int mma9551_probe(struct i2c_client *client) =20 if (id) name =3D id->name; - else if (ACPI_HANDLE(&client->dev)) - name =3D mma9551_match_acpi_device(&client->dev); + else + name =3D iio_get_acpi_device_name(&client->dev); =20 ret =3D mma9551_init(data); if (ret < 0) --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42C9C21C18E; Thu, 24 Oct 2024 19:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797137; cv=none; b=Jf8p+7LPl+cFB5c3F+KL/gIyoYo9ypF9TaspEMwIUBoThkZ6NnrDVmFglGE3CYjlKloDB4K/F066oY+jpQWkxwZYFNkAOJTcTB5eeK3r2Nv9ck1GK+XHnn+rNedAoQYyHufF4vfoME3fP96BCTkAdY4MjPUHAqxtyba9cqcKEus= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797137; c=relaxed/simple; bh=QjdeYHP6bLRULSx5x70pbUZ1lUja1ExHACvu0ZrgtZU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FCZG0GvQJM/mzbAHPSWu/lcb/2oAvsL08+tfHaK2njUYg3itUbTz/yYVbJsOsii5i/uicsM+YChlEVN+abVklS+Qov4nqQLFtaf6Mx6oudqRqU1vu6j1i1c9Y/ZbHcPW5c9nHwROF3SJ/+mwDlbuha4ioLJMokf7BLltOOzpWHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Vr44tn3e; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Vr44tn3e" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797135; x=1761333135; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QjdeYHP6bLRULSx5x70pbUZ1lUja1ExHACvu0ZrgtZU=; b=Vr44tn3eu9Oo7UFU8+IgzbJRX/8DjaYXpww2ldDLdaThOI0yDkEm5Jii PFm6ezl/nMxautl37qZeerRkH0c4DQjNBA29cE/C1hkfA6k9hQRuRLF4T +Erq6x5XGAtlYu23Kh4sSlUR9IVLod704hOnU05x+Xjz/u0oRfn/o2lPH 5i4mB5vqcD8coJnFMquzFN4d6N/Ez22f5Rp8B/a5N4bvJlLeirqIbeDBd ezhCOERUVEpZXM0BxD+XkPjPtHCvmKCPPKRrR7h9peHEEUolYLb7La7sw HLuEnRfMwtxcjoZJcWmHIXjjQHWhslhR3Kq3OAnPgA63HErtQOKJ94LQs A==; X-CSE-ConnectionGUID: lMLDbmcnQh2/z2haF3oT0w== X-CSE-MsgGUID: OE362faTSsGNOxb8EUhLzg== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934488" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934488" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:11 -0700 X-CSE-ConnectionGUID: Q1Geg9EvQsaclO4Fg8BZUw== X-CSE-MsgGUID: vS83GRZtTge7vewKdGQD8g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266717" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DF6764E3; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 18/24] iio: accel: mma9553: Replace custom implementation of iio_get_acpi_device_name() Date: Thu, 24 Oct 2024 22:05:07 +0300 Message-ID: <20241024191200.229894-19-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" IIO core (ACPI part) provides a generic helper that may be used in the driver. Replace custom implementation of iio_get_acpi_device_name(). Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/accel/mma9553.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 86543f34ef17..1ea6aa007412 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -4,11 +4,11 @@ * Copyright (c) 2014, Intel Corporation. */ =20 -#include #include #include +#include +#include #include -#include #include #include #include @@ -1062,17 +1062,6 @@ static irqreturn_t mma9553_event_handler(int irq, vo= id *private) return IRQ_HANDLED; } =20 -static const char *mma9553_match_acpi_device(struct device *dev) -{ - const struct acpi_device_id *id; - - id =3D acpi_match_device(dev->driver->acpi_match_table, dev); - if (!id) - return NULL; - - return dev_name(dev); -} - static int mma9553_probe(struct i2c_client *client) { const struct i2c_device_id *id =3D i2c_client_get_device_id(client); @@ -1091,9 +1080,9 @@ static int mma9553_probe(struct i2c_client *client) =20 if (id) name =3D id->name; - else if (ACPI_HANDLE(&client->dev)) - name =3D mma9553_match_acpi_device(&client->dev); else + name =3D iio_get_acpi_device_name(&client->dev); + if (!name) return -ENOSYS; =20 mutex_init(&data->mutex); --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59FAC224B50; Thu, 24 Oct 2024 19:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797140; cv=none; b=UKhJk8FUBT3Kusqrb2JaDkOkEk7XDmB1l7x2OO+29uT4RLchU7n+h704o5MW+KsWbwPkMFPXoUrLkDKGSTknESzUy0pYDknpHbasHP7ouq+7EILOfiqNHkYTPGIRN5Urt6HSYSBoQV9pQ44wlBgLCPcrPLvZyY/Z+z5rknrMb0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797140; c=relaxed/simple; bh=7VD/YZ3dxyXfp5F1cccl2DO7mfRb7DzapOk2MWXOIuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AP73UnYn20oJL52iABsfEtC5oy7GG/hpU5r0clEPuOL3upzWNp2JmNQdxyQsngLgG/yw23jTXfZuM5ZW7SpzSO9krOz+aDYG1tabYAduyE/RPJFZ9toKNhHyLGzPM3ovF6u4X5u7gvwAv8j7s1CUnbuCR6Bb9g5T4iEgsRDahbU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=g//6B/qC; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="g//6B/qC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797138; x=1761333138; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7VD/YZ3dxyXfp5F1cccl2DO7mfRb7DzapOk2MWXOIuI=; b=g//6B/qC0FEdNpzuI6vMs4gfoWm+Rz2bLVHHVl+AgdTsl1b0aSmug/Dz O4usGf7RM36+8KseG3lVBkOXB+71NL+0RV2bVDEPeSu1NRSusLdjCPJ0H NEo7Pr5ZqBBcK5p4TGKQ7rj5YKoYgRlALBikQYzHAaadJ5GteBZ7vifpN qpTjM6DymS/Q8/ZW7E9eq6yHh7Pd1PROVk33RXMKxqgZhGxtAnh52Tg6G em0pspz0gV/CaDk1Y6On2rlLYA79sAu5N1aQKBiySnV8MrpdB/4WbdTrm CMEKPvnYRBc/Y7RluNAJEqnhIFnTTX7+sBjcbgvjhPSD/+VKBTfbcDOk4 g==; X-CSE-ConnectionGUID: NuxNraqOT/CvjZEiuqm/4w== X-CSE-MsgGUID: w8X8LHztQmK8HwdkOzV4bA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934537" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934537" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:11 -0700 X-CSE-ConnectionGUID: 4wmZuixmRzy1i2nqX7mz1g== X-CSE-MsgGUID: FGzQ+BlfSQCF8+sBwp8w7A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266718" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EE9DC8EC; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 19/24] iio: gyro: bmg160: Replace custom implementation of iio_get_acpi_device_name() Date: Thu, 24 Oct 2024 22:05:08 +0300 Message-ID: <20241024191200.229894-20-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" IIO core (ACPI part) provides a generic helper that may be used in the driver. Replace custom implementation of iio_get_acpi_device_name(). Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/gyro/bmg160_core.c | 15 --------------- drivers/iio/gyro/bmg160_i2c.c | 4 +++- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c index 10728d5ccae3..499078537fa4 100644 --- a/drivers/iio/gyro/bmg160_core.c +++ b/drivers/iio/gyro/bmg160_core.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -1055,17 +1054,6 @@ static const struct iio_buffer_setup_ops bmg160_buff= er_setup_ops =3D { .postdisable =3D bmg160_buffer_postdisable, }; =20 -static const char *bmg160_match_acpi_device(struct device *dev) -{ - const struct acpi_device_id *id; - - id =3D acpi_match_device(dev->driver->acpi_match_table, dev); - if (!id) - return NULL; - - return dev_name(dev); -} - int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq, const char *name) { @@ -1098,9 +1086,6 @@ int bmg160_core_probe(struct device *dev, struct regm= ap *regmap, int irq, =20 mutex_init(&data->mutex); =20 - if (ACPI_HANDLE(dev)) - name =3D bmg160_match_acpi_device(dev); - indio_dev->channels =3D bmg160_channels; indio_dev->num_channels =3D ARRAY_SIZE(bmg160_channels); indio_dev->name =3D name; diff --git a/drivers/iio/gyro/bmg160_i2c.c b/drivers/iio/gyro/bmg160_i2c.c index a81814df5205..9c5d7e8ee99c 100644 --- a/drivers/iio/gyro/bmg160_i2c.c +++ b/drivers/iio/gyro/bmg160_i2c.c @@ -17,7 +17,7 @@ static int bmg160_i2c_probe(struct i2c_client *client) { const struct i2c_device_id *id =3D i2c_client_get_device_id(client); struct regmap *regmap; - const char *name =3D NULL; + const char *name; =20 regmap =3D devm_regmap_init_i2c(client, &bmg160_regmap_i2c_conf); if (IS_ERR(regmap)) { @@ -28,6 +28,8 @@ static int bmg160_i2c_probe(struct i2c_client *client) =20 if (id) name =3D id->name; + else + name =3D iio_get_acpi_device_name(&client->dev); =20 return bmg160_core_probe(&client->dev, regmap, client->irq, name); } --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 093CE21A709; Thu, 24 Oct 2024 19:12:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797134; cv=none; b=Tw4CFpd44O1CNC4pzS8+wml8m0Fs2mxfOU8TRzvHiANjqunIZINFK2ooDSorYLSEcfzjDa1kXVfhiQRswySzd/nQArtx+W0EGAFT8F6zwn6/+nQKLU+t5vleiggCoKcC8PVtB5XDXnSZhcKwAaeZ2YMp37Jw/adIhTuAcIH3Gu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797134; c=relaxed/simple; bh=r1Ljs09ViP07Wgn+0g0azOe4A6vQASHH1I/FkFMyUOE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mva0DigjSYwg4XoHztfk3A2IL9RKwdO8plsOqXNWOcW+M4Ow63cGOpc9fonl7akdqWVWLB35xXN+g6MrkFipWVDcqbcbROh0HWfjFMjcbYmi6rtm23L9B5XW8Dube7OVI2ihttgsgxJ30cM3hMbjo294NS5Jm5UVBtEfvBxdReY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Ia9W3SkF; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ia9W3SkF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797132; x=1761333132; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r1Ljs09ViP07Wgn+0g0azOe4A6vQASHH1I/FkFMyUOE=; b=Ia9W3SkFmi02PO0nuv+YrqHA71s/00ztrsq5qu2wrCKasFHhbll09757 wTIeqOplKzhFDARObY2jZkVu/LBTq6v6PqOUT67QmFP2rNbrM8rJb48Fm GtpJjrhCF0embvxChxFZ8ZYjtCjZzO2ER9ahT4JiHP8MWSmm8JaryK9FM 9CP6n2rrLCAMsXVUj+Iksjsj0j/BOvsOXxXanrymdMW9kucnFSjKbwtfB H+WQDTsJPq0SKWHD85VQ/Kzh7QWgQk1CSGZcspBUNC3Jb5hRieZ5EcpDt 1oEodc9v+oYF/AmpuQs3nFsWyCTqePnP9auXp5NbRld4JaJtYX+q6lDtB w==; X-CSE-ConnectionGUID: 40TWDDFITki2DvSz+9IX3w== X-CSE-MsgGUID: Ev3GZAmdTaW0xabiLPIwCg== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="29563208" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="29563208" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:11 -0700 X-CSE-ConnectionGUID: gGrwEd3YTrqo+mgC4E+bJg== X-CSE-MsgGUID: odZb9DYjRqu7NhFuUgdgaQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="85791752" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 24 Oct 2024 12:12:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 036AC81D; Thu, 24 Oct 2024 22:12:01 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 20/24] iio: light: isl29018: Replace a variant of iio_get_acpi_device_name_and_data() Date: Thu, 24 Oct 2024 22:05:09 +0300 Message-ID: <20241024191200.229894-21-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" IIO core (ACPI part) provides a generic helper that may be used in the driver. Replace a variant of iio_get_acpi_device_name_and_data(). Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/light/isl29018.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c index 8dfc750e68c0..526ee5619d26 100644 --- a/drivers/iio/light/isl29018.c +++ b/drivers/iio/light/isl29018.c @@ -687,20 +687,6 @@ static const struct isl29018_chip_info isl29018_chip_i= nfo_tbl[] =3D { }, }; =20 -static const char *isl29018_match_acpi_device(struct device *dev, int *dat= a) -{ - const struct acpi_device_id *id; - - id =3D acpi_match_device(dev->driver->acpi_match_table, dev); - - if (!id) - return NULL; - - *data =3D (int)id->driver_data; - - return dev_name(dev); -} - static void isl29018_disable_regulator_action(void *_data) { struct isl29018_chip *chip =3D _data; @@ -716,9 +702,10 @@ static int isl29018_probe(struct i2c_client *client) const struct i2c_device_id *id =3D i2c_client_get_device_id(client); struct isl29018_chip *chip; struct iio_dev *indio_dev; + const void *ddata; + const char *name; + int dev_id; int err; - const char *name =3D NULL; - int dev_id =3D 0; =20 indio_dev =3D devm_iio_device_alloc(&client->dev, sizeof(*chip)); if (!indio_dev) @@ -731,11 +718,11 @@ static int isl29018_probe(struct i2c_client *client) if (id) { name =3D id->name; dev_id =3D id->driver_data; + } else { + name =3D iio_get_acpi_device_name_and_data(&client->dev, &ddata); + dev_id =3D (intptr_t)ddata; } =20 - if (ACPI_HANDLE(&client->dev)) - name =3D isl29018_match_acpi_device(&client->dev, &dev_id); - mutex_init(&chip->lock); =20 chip->type =3D dev_id; --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C60F228B7A; Thu, 24 Oct 2024 19:12:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797143; cv=none; b=i2XsCc/xQZ79qMlT4R8YsKtrcrXgOgl6zsX/9+uwqeQNnSzyQRfLP5DCa7OGQ2ct7FyL+VmHNT7HB80bik5S6+EuKlIFA1bGtrLqE+5z+HPmqeFs4LYrVyHPKjHeghQHcIK5vyWwDra0bz+QMj5UKz+QGdFIfIMBAzsXLv4+R3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797143; c=relaxed/simple; bh=ka5ttrTleL/Ct3ANbBPzaVEqvP9UA33xx6pJzKITIMA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p7s6eZVTouA/c9nm6HHaRQPFVMff7xe5xOgw7l0EDRr75NBwfpCSzOaTCVtatpqoYU4ivpZySiAU/Lqlsolyhb9ZFnuOAga3mIn1u+5NFpwuK2vZMlk3QFNObWZzr3UtuknoTC9MAfFxBu1+e/kivtN6N0NXe/UwoOOnd40qKhY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=MBBBeKZy; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="MBBBeKZy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797141; x=1761333141; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ka5ttrTleL/Ct3ANbBPzaVEqvP9UA33xx6pJzKITIMA=; b=MBBBeKZy37PQaxbJ3bFFEEekEgXzCNjgm0tJlj+8+v7x5557yj7biUnh lG/LARpG6s/TXsqywlzejAjZASMopQ5G6LbQkydinuUwgCEr8XrI5a+8k qTbe3vbj8f0Y59hFPwUflRliYADkN+L868BQoh7xOcxr7Ht1yozc2pH7R KnEdOtyOTCXfyND65WB3ZxECWIpOWFloZpUX/67JFgVpK5StvTcwIZVou MSKqqFN7mwqeDBwL1jL+YU1EO7CzOksizue9DQ2Syc5rgC28v+kr3zfBd t0QE6tmyXfyIGhxHF91ND1w3Qmt+uQtidbakwFbnWdLz3qYwPgHLyd23p Q==; X-CSE-ConnectionGUID: 1IjighxHS/iF0xlTyLHs8g== X-CSE-MsgGUID: RQdi2gPfRfyLsZrHohRRFA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934544" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934544" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:12 -0700 X-CSE-ConnectionGUID: emUAEGTES9+HXR84xMcPhw== X-CSE-MsgGUID: CSicA8C/SPqmeJZyxBPymA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266721" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 11888A9C; Thu, 24 Oct 2024 22:12:02 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 21/24] iio: light: isl29018: drop ACPI_PTR() and CONFIG_ACPI guards Date: Thu, 24 Oct 2024 22:05:10 +0300 Message-ID: <20241024191200.229894-22-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The complexity of config guards needed for ACPI_PTR() is not worthwhile for the small amount of saved data. This example was doing it correctly but I am proposing dropping this so as to reduce chance of cut and paste where it is done wrong. Also drop now unneeded linux/acpi.h include and added linux/mod_devicetable.h for struct acpi_device_id definition. Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/light/isl29018.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c index 526ee5619d26..56e1c915af64 100644 --- a/drivers/iio/light/isl29018.c +++ b/drivers/iio/light/isl29018.c @@ -8,17 +8,18 @@ * Copyright (c) 2010, NVIDIA Corporation. */ =20 -#include #include #include +#include +#include #include #include #include #include #include + #include #include -#include =20 #define ISL29018_CONV_TIME_MS 100 =20 @@ -819,15 +820,13 @@ static int isl29018_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, isl29018_resume); =20 -#ifdef CONFIG_ACPI static const struct acpi_device_id isl29018_acpi_match[] =3D { {"ISL29018", isl29018}, {"ISL29023", isl29023}, {"ISL29035", isl29035}, - {}, + {} }; MODULE_DEVICE_TABLE(acpi, isl29018_acpi_match); -#endif =20 static const struct i2c_device_id isl29018_id[] =3D { {"isl29018", isl29018}, @@ -841,14 +840,14 @@ static const struct of_device_id isl29018_of_match[] = =3D { { .compatible =3D "isil,isl29018", }, { .compatible =3D "isil,isl29023", }, { .compatible =3D "isil,isl29035", }, - { }, + {} }; MODULE_DEVICE_TABLE(of, isl29018_of_match); =20 static struct i2c_driver isl29018_driver =3D { .driver =3D { .name =3D "isl29018", - .acpi_match_table =3D ACPI_PTR(isl29018_acpi_match), + .acpi_match_table =3D isl29018_acpi_match, .pm =3D pm_sleep_ptr(&isl29018_pm_ops), .of_match_table =3D isl29018_of_match, }, --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C83C3224B68; Thu, 24 Oct 2024 19:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797140; cv=none; b=IuRRf7qKd+AhJyG/o1VXrfgSx6rOsLtRyMREK+liJ05+eJtxiab7wGGAYk+YJxFNn1zZG5qO4FsJEXdSnQ1mV9E2XFv4JGtuaK2ph/ScJ9zk8pgUZlLwbSxyxyLcqczfKbpR9ELQXFTMgbggG3zlgBZE000+Otr5P07fCZeNbJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797140; c=relaxed/simple; bh=Iocz/KVSforp7TWPBNMBSymCJu2I9Wm9f+hSS1P8ifo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BXs373SilWeEh1h1QoUNOh5mgqG29wut0c4z+P6ve9iXKco+5yGA+qv7t55ICYUKBL3LXfwxqUUj/cZZNYioykMO8oa7Eex80eieZVGd7Dg8+XxgtF6Eq4oPsIc5fR717JRgJ+2tb5uZxxU5VP/+DACHW3e/g++KQdA098eMKnE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TkfndoRx; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TkfndoRx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797139; x=1761333139; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Iocz/KVSforp7TWPBNMBSymCJu2I9Wm9f+hSS1P8ifo=; b=TkfndoRxlxQNFeQ/yOi6+PQv8MpaOeJwm/tQEm1NkRoFru8VqBNte3sV mDmTkxbzot+KqfPqBl2ovUnfOQtVCt2HEq2TOTrZC5UFqfSKF8XuNAt00 YQHDzWtfnPpQHf5ShMWOo6tr9LXwDou9/T0OLqaTC45+RZjh60xrihX7p 495kzRoZE9LNiPNzXQk5fvMqVxEEEjT9iOLem2p0f8ihQLDeFFP1G0Sj6 md1e1HApEkMrATs2Apwk0zm7m6qBCJbVUIjCOFcu62J36cFe5gvvLmBG8 fKgH6YUaDjogubu8NNLE0MlW/JP2PJuy4KZ/MnVk3TOW4lD35nYMvMEtD Q==; X-CSE-ConnectionGUID: a2U8nMMoT4erEV1J7dttAA== X-CSE-MsgGUID: q3jutD6CRb+D3OGVhPsX5A== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934540" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934540" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:11 -0700 X-CSE-ConnectionGUID: vbbQ2Q4FT2yD+eWOXpNK+g== X-CSE-MsgGUID: ZatQtDjqRRqcsokRUtAiTQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266719" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:08 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1C738ACF; Thu, 24 Oct 2024 22:12:02 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 22/24] iio: light: ltr501: Drop most likely fake ACPI IDs Date: Thu, 24 Oct 2024 22:05:11 +0300 Message-ID: <20241024191200.229894-23-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The commits in question do not proove that ACPI IDs exist. Quite likely it was a cargo cult addition while doing that for DT-based enumeration. Drop most likely fake ACPI IDs. The to be removed IDs has been checked against the following resources: 1) DuckDuckGo 2) Google 3) MS catalog: https://www.catalog.update.microsoft.com/Search.aspx This gives no useful results in regard to DSDT, moreover, the official vendor ID in the registry for Lite-On is LCI. Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/light/ltr501.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index 8c516ede9116..3fff5d58ba3c 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c @@ -1610,8 +1610,6 @@ static int ltr501_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resu= me); =20 static const struct acpi_device_id ltr_acpi_match[] =3D { - { "LTER0501", ltr501 }, - { "LTER0559", ltr559 }, { "LTER0301", ltr301 }, { }, }; --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3C42228B4F; Thu, 24 Oct 2024 19:12:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797142; cv=none; b=HPPrtuX499sz6ZPVOCEm4BCbbUPVotYjNnSMBZn9i+5MfvDOgFmAyK0V4V2VIQ3A/oE/+sUDWbuP9/KOdK59en3IZCH7UUQkOT1a+ZgNwhWFYItTR3GxcskT+/yFEpwU8cZ44EcJIjc6KSN1dIm98dxcGIpC1xyATcbgnTlVjfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797142; c=relaxed/simple; bh=fvNel6p61T3jK3xq1Ew/lp5LBDNzFIYblZQCIwx3ZuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cRrQj+93GOSWpLc7gUfMYCpTkjXYYoyNfRlRK/Al/knIlYjqG5xvGFJ3v4BeM5Urt6E9xxeFR5aa61PiRja3bMYq8HEeHuL2U7wi6zsMItETy/nMcCndsP9fJMRu8MPcEd0rwESTnkuyJctaDRQnhO/q7Z1MNFdoBwIibWPfHTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IoeKinhw; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IoeKinhw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797140; x=1761333140; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fvNel6p61T3jK3xq1Ew/lp5LBDNzFIYblZQCIwx3ZuI=; b=IoeKinhwKfsGsXZuoEuKRnRv90BqWb7tlXLXtTB8J7AnM8HE7s3IK2mt GsYGd515f/nZ/9Ax1r7VGzrXbFHUE+Nm5ENpPoUjsRYyj/eeECr2HWGaB cioT9THdxZZEBBS1zi3PYqQum2xJz4kfqv7C5li9s4k2lpLgQaVzbf7OQ rngx7HJqk4QkYioNfmPngqkCTS5xIP+LKeV468SQuAwfTh+tEIE3R0gSG XVruuu2hToZgwhTfYg0188gwaN0pUXhhS08PRxnINyDp0aPnD8Oo4/RxF ZHZ2eht5PgwWhGOJ3hZiGo4zB1v7vBbrL1CayGaiAFyFWw83VIuqegMbj g==; X-CSE-ConnectionGUID: IaNRBiwUTgeRwV8FU0oeHg== X-CSE-MsgGUID: 3fcLip4mQXWDGzLe72uPaA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="46934545" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="46934545" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:12 -0700 X-CSE-ConnectionGUID: tKdAPWXmSKSSXkQ6shuOJA== X-CSE-MsgGUID: qWQBQta4R9OiQpFdKa0iVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="80266723" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa006.fm.intel.com with ESMTP; 24 Oct 2024 12:12:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 22B3DA8F; Thu, 24 Oct 2024 22:12:02 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 23/24] iio: light: ltr501: Add LTER0303 to the supported devices Date: Thu, 24 Oct 2024 22:05:12 +0300 Message-ID: <20241024191200.229894-24-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It has been found that the (non-vendor issued) ACPI ID for Lite-On LTR303 is present in Microsoft catalog. Add it to the list of the supported devices. Link: https://www.catalog.update.microsoft.com/Search.aspx?q=3Dlter0303 Closes: https://lore.kernel.org/r/9cdda3e0-d56e-466f-911f-96ffd6f602c8@redh= at.com Reported-by: Hans de Goede Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/light/ltr501.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index 3fff5d58ba3c..4051d0d9e799 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c @@ -1611,6 +1611,8 @@ static DEFINE_SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501= _suspend, ltr501_resume); =20 static const struct acpi_device_id ltr_acpi_match[] =3D { { "LTER0301", ltr301 }, + /* https://www.catalog.update.microsoft.com/Search.aspx?q=3Dlter0303 */ + { "LTER0303", ltr303 }, { }, }; MODULE_DEVICE_TABLE(acpi, ltr_acpi_match); --=20 2.43.0.rc1.1336.g36b5255a03ac From nobody Mon Nov 25 20:38:39 2024 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08BB621B442; Thu, 24 Oct 2024 19:12:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797135; cv=none; b=b/QhiUBjLVQ9UB3JpejObkZgV0kidWS5I2+qGoOJ8a5eUrgi2bBZrsNPZgXZpPSj1Ki2mfYSeSsKkimPSBXbAqlN9F8vNVXlyvqXOY71mpcvjcJJNft3+fbdK4AkBEFZVDusC3QCY84qd8zbItY0m+4uG5JbJG7KotSjS+3xsIY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729797135; c=relaxed/simple; bh=uf9btLtoClCOjF/hTMc4aLgnXwHw0svLKzR/oE7cpbo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Uy1SOiYzuRXwX3RhJeoYU6qYGdYaMDervu4Lbi7BsqAUa8czSp7OK3QtIQqhkRKlJE5GH0kytaGWphbLGsq8m5vgZyYtNCHxcuml2GZ5idTmLI18DBW2Jh7nU9Q2T2SN2iEBBbIElKZBN3RYPu7RG9efqBZow4Lca1OlvYHkP5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=foHCzaEU; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="foHCzaEU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729797133; x=1761333133; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uf9btLtoClCOjF/hTMc4aLgnXwHw0svLKzR/oE7cpbo=; b=foHCzaEUo7xVmbOXRp4JKQzVhDc39GPQvEmiHaiIvblHyjcm5+G5M9JB lrth8VnaXz2QaILKgZn3kRiZWQ+BOQqh1WE25G9E7c4EWYli4ZNe17hsF AEOrhDYC5vxOAU/C4Awr68ExETQ92s+MGDzC5jeIPGdAtFsjYCHArJAyV D1SxVk0XfgkNbMXrFxleeytJAjJ1QiDd8/CBstNycePG9eRofU629YQmR yFWYrTutLsCuDoxkqTNzlVLmRfbAnG+K0ADhfr+UMrDAdpTk2bT9IjHrJ +FiCmo1eQRKkBmSxcz1vJAFR+F6SJHSzyKXz1ONLIjZBNmzoUQhYoBb4u Q==; X-CSE-ConnectionGUID: x/T/LtNgTFWFyFFHSUKFTg== X-CSE-MsgGUID: 2ILj3+zxRfaxKyZUkKhQDw== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="29563217" X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="29563217" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 12:12:12 -0700 X-CSE-ConnectionGUID: UV+BvQjWS8CEjhxzO9060Q== X-CSE-MsgGUID: lwvM5+r0RsmMQR/AnOV6IA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="85791754" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 24 Oct 2024 12:12:09 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3185BBD1; Thu, 24 Oct 2024 22:12:02 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Jonathan Cameron , Marius Cristea , Trevor Gamblin , Jean-Baptiste Maneyrol , Hans de Goede , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 24/24] iio: light: ltr501: Replace a variant of iio_get_acpi_device_name_and_data() Date: Thu, 24 Oct 2024 22:05:13 +0300 Message-ID: <20241024191200.229894-25-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> References: <20241024191200.229894-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" IIO core (ACPI part) provides a generic helper that may be used in the driver. Replace a variant of iio_get_acpi_device_name_and_data(). Reviewed-by: Hans de Goede Signed-off-by: Andy Shevchenko --- drivers/iio/light/ltr501.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index 4051d0d9e799..c389be6a106d 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c @@ -15,7 +15,6 @@ #include #include #include -#include #include =20 #include @@ -1422,17 +1421,6 @@ static int ltr501_powerdown(struct ltr501_data *data) data->ps_contr & ~LTR501_CONTR_ACTIVE); } =20 -static const char *ltr501_match_acpi_device(struct device *dev, int *chip_= idx) -{ - const struct acpi_device_id *id; - - id =3D acpi_match_device(dev->driver->acpi_match_table, dev); - if (!id) - return NULL; - *chip_idx =3D id->driver_data; - return dev_name(dev); -} - static int ltr501_probe(struct i2c_client *client) { const struct i2c_device_id *id =3D i2c_client_get_device_id(client); @@ -1440,8 +1428,10 @@ static int ltr501_probe(struct i2c_client *client) struct ltr501_data *data; struct iio_dev *indio_dev; struct regmap *regmap; - int ret, partid, chip_idx =3D 0; - const char *name =3D NULL; + int partid, chip_idx; + const void *ddata; + const char *name; + int ret; =20 indio_dev =3D devm_iio_device_alloc(&client->dev, sizeof(*data)); if (!indio_dev) @@ -1523,11 +1513,12 @@ static int ltr501_probe(struct i2c_client *client) if (id) { name =3D id->name; chip_idx =3D id->driver_data; - } else if (ACPI_HANDLE(&client->dev)) { - name =3D ltr501_match_acpi_device(&client->dev, &chip_idx); } else { - return -ENODEV; + name =3D iio_get_acpi_device_name_and_data(&client->dev, &ddata); + chip_idx =3D (intptr_t)ddata; } + if (!name) + return -ENODEV; =20 data->chip_info =3D <r501_chip_info_tbl[chip_idx]; =20 --=20 2.43.0.rc1.1336.g36b5255a03ac