From patchwork Thu Oct 24 12:36:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848938 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 D7DC01D63FD; Thu, 24 Oct 2024 13:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775084; cv=none; b=umXtmZyebtC/tH55ad05R4l072MHqKrotPzC9MGet18wH/euMiQo8V5M/bSJAzG8xZQzk9P2+se0vp+fGG6udg5uwtL1bahk6y/15L56X6ubGyzmI49xgoCvAC9ZAlN6/ac3USL/OZQREBTyOzFgrrYR+mC8KbCDFrX3rBiBT/I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775084; c=relaxed/simple; bh=vsc6MrVXxXDuLAESj8xZHll4k7qRnzwifVhQvxdNI/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SRPiKKXNFTdpJEHLBYnEh+bNUwIAHtJAgZ1XaFMg+G7fbQ5vFTeD1XZpW4ctkn2WbEOmeg8wqoRpfl2qMx69y4YvUw/HjWAJbWhyDwL5N3A90szBp7HGUn/ULCjOpdTQJk2kRMdMrXnRFz/yBmJNG1uIgXLXeO3QPfKMWudcMRs= 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=KSZhojeL; arc=none smtp.client-ip=192.198.163.7 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="KSZhojeL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775083; x=1761311083; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vsc6MrVXxXDuLAESj8xZHll4k7qRnzwifVhQvxdNI/U=; b=KSZhojeLzy71GNMvylXgO1SDlZRoJUIWb8gCMzWWUGhJ11f+N/BR8xlV q2ILhmIx9W8+yimj/ZWC6KC/9hJ4J08307R2ACrL4dBhXCRSb5TP2KK6r WA0MWDLCT/nlD+sBvH32Pm6PQEVxyzfDWE70lsbHuctjF30ZCPuyCFIQm sU8Ko2+D7rOWGfPEJw/sqoJwZ/2SWDInlbCFmgiJ1CmHrEjhDlUuCCxUc W3Ae1SDyMXsE4ihhOR7TPXM7S6f7GRErf+KUIbfdI1Yn00crB4oWg1B8D TwGbsvA0upEXNUW35fvH8KHNakxaAhMtyFfESma7Fyjj8LOiOpbV7iHaG g==; X-CSE-ConnectionGUID: PbwH36PLRVGFgCiAIKTvJA== X-CSE-MsgGUID: CTWPtSNvTZiM40qqbwXRQg== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="54802777" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="54802777" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:28 -0700 X-CSE-ConnectionGUID: 2GyIuEzQSsOFNWIOEfiVVA== X-CSE-MsgGUID: 2zWxvJNvTJyArGYN4Yx8xQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="80238763" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa007.fm.intel.com with ESMTP; 24 Oct 2024 06:04:26 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C06B32E9; Thu, 24 Oct 2024 16:04:24 +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 v2 01/13] iio: magnetometer: bmc150: Drop dead code from the driver Date: Thu, 24 Oct 2024 15:36:06 +0300 Message-ID: <20241024130424.3818291-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/magnetometer/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_buffer_setup_ops = { .postdisable = bmc150_magn_buffer_postdisable, }; -static const char *bmc150_magn_match_acpi_device(struct device *dev) -{ - const struct acpi_device_id *id; - - id = 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; - if (!name && ACPI_HANDLE(dev)) - name = bmc150_magn_match_acpi_device(dev); - mutex_init(&data->mutex); ret = bmc150_magn_init(data); From patchwork Thu Oct 24 12:36:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848932 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 0940114A0AA; Thu, 24 Oct 2024 13:04:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775071; cv=none; b=Z0HznUnKke7L6eLwiWncbNWs8FhO0mOJZm6F6I+UUFBhE+rmuHRMe6M2JIdfKCYBSC7nPyAOY7sb9LPLQwUS87S4orb1MhHNqscaK/VBi12SxQQw8Gfr8/8axhbVR4YmO7Q+oXU+07pvMWejH5/z5iLbbyGIvam8dtJb5+b1L8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775071; c=relaxed/simple; bh=RXqBs1ZDcv8ZDhVWYR7M44eyFiTQlcvJ6ELtyY0S4yI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GQ7/qngB/pAqaclgQgknKs3/JyUNe8rYxSN0yAYvD9HjLLLa8LDckuFZJYApIc2e3NsUANurSbTVyAq8UdvxefY+CJgjl/3LpVFYzqv9HHrwhQ48kXqVQqBuhD2JVqavrKRhyDn6+PeHAk0WzPsLFvSqeDBOroD6EvFw/R1h/K8= 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=l/op8nph; arc=none smtp.client-ip=198.175.65.12 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="l/op8nph" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775069; x=1761311069; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RXqBs1ZDcv8ZDhVWYR7M44eyFiTQlcvJ6ELtyY0S4yI=; b=l/op8nphGCO3ymlKr/IWKADHcFtDaZpGzdJape6CG9XTOR8V4pVGK6X5 Ax6NGdfh6T3o85weJ6FJ/wmO6xNbnwZPHyvofXEnQehjPUoWM5ZNs0VpH 4h4JMr8IsiDIhi8sT4CgH+e6OniZ5P9MK+jK4TTnOKqxUJZaBlQC09o0L wK19xfmOwTXEp+EGhGy5pIrE+hdAdKJUwg9lLUbijtvXOpH9TUdjq8Li3 PTPzY29HuVNuzp7TIsfjdeXYBlWsvP0Ap29YI2HBQU9S0XSJUqD2ykTPa CegsgC4Yy+kFrbo6PByvHhf+dqu4JF1RYdEy+W+FE2x6sKfyESVuely0q w==; X-CSE-ConnectionGUID: HMmTbkokTzqmcMoSgwzhzg== X-CSE-MsgGUID: jLgiDtw4RHWq1x2ryauCag== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="40795211" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="40795211" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:28 -0700 X-CSE-ConnectionGUID: HtrfL2T/T/ulFparics6ZQ== X-CSE-MsgGUID: ZU0T93xIQEeDAcvXWIu/2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="103898624" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa002.fm.intel.com with ESMTP; 24 Oct 2024 06:04:26 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id CDB7A41D; Thu, 24 Oct 2024 16:04:24 +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 v2 02/13] iio: adc: pac1934: Replace strange way of checking type of enumeration Date: Thu, 24 Oct 2024 15:36:07 +0300 Message-ID: <20241024130424.3818291-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Signed-off-by: Andy Shevchenko Reviewed-by: Marius Cristea --- 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 = pac1934_chip_config[ret].name; } - if (acpi_match_device(dev->driver->acpi_match_table, dev)) + if (is_acpi_device_node(dev_fwnode(dev))) ret = pac1934_acpi_parse_channel_config(client, info); else /* From patchwork Thu Oct 24 12:36:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848939 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 4C7F71D86C0; Thu, 24 Oct 2024 13:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775085; cv=none; b=XnfZQOgKj2vCCj0HyvNxA8GZLlN8NSnqZ5/TMAMFuPEzrUjPa93dFzeDkWoYGmyRESZbkmH3nu3iLqIAE7jylg50rfAXq5Gi6o5RUjleVK2Yq5VIPaT/F7TWRznzLBWmVq+x6hnNB451FJBAOUIMLusQpBcxuPl01x1TDPWkEi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775085; c=relaxed/simple; bh=8atlFWavefIc6+oxaGcsEV449zq2pd7xjIWLQwE6VyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T40eoPrDP5gyp7ctqcKOX7eGRLYS0ct5jBB+LGPR7A4JAt9Rm5HgO5M1jRvOdw9Yp8DUIXApvvzbCyNs0whV2nbFTa+cKwnCMuAqAR145SdDgPM15j3saRhHQUNlZQeukrGhDK4ydSwKOX6ORCEyX8ugBV/rttQDcWSozd2+/wQ= 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=CcSDnVZQ; arc=none smtp.client-ip=192.198.163.7 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="CcSDnVZQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775083; x=1761311083; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8atlFWavefIc6+oxaGcsEV449zq2pd7xjIWLQwE6VyU=; b=CcSDnVZQmhnr1ML8pif/JlTDrchz1AfAPbIyMTYapIWEK30aE9EnbZo3 fu5aafxU2WrB8V02QRICUDhdI2WP0GCYiONGNF4z32TCIajBrZy9CDR/F 0aOtIlzYpIKJr4+O/Lhb79MlCMOCeG7lgUg4v7nzBekhPU+eGIAJWgnwW j1YAPqtqdzr06DXKEW6fBqixSLUtWXCOzhO49AfaT/rDod3G5gUyJ7vZ8 F19NPy9ARU1V+RR/VSp7hbncJ0qqErHRTp7qXtacLyqzTSFDz8MIhvs1j BsdK0OlNdPviS6Pz5qqdY8eGFGz7RrH5/hSZM5sYDljVk0tqSeyzy1ZQh w==; X-CSE-ConnectionGUID: Es3Di0FdRKKW4BFsIw3y2g== X-CSE-MsgGUID: t9r0dSWNRrq+S7Tw3fxAng== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="54802787" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="54802787" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:28 -0700 X-CSE-ConnectionGUID: FQ4as4GlRJqn4untf3bYZg== X-CSE-MsgGUID: vtN+1e2QQuC+3Mt6DtzzGQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="80238764" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa007.fm.intel.com with ESMTP; 24 Oct 2024 06:04:26 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id D6B1A4D5; Thu, 24 Oct 2024 16:04:24 +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 v2 03/13] iio: imu: inv_mpu6050: Replace strange way of checking type of enumeration Date: Thu, 24 Oct 2024 15:36:08 +0300 Message-ID: <20241024130424.3818291-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/inv_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_client *client, unsigned short *secondary_addr) { struct acpi_device *adev = ACPI_COMPANION(&client->dev); - const struct acpi_device_id *id; u32 i2c_addr = 0; LIST_HEAD(resources); int ret; - id = acpi_match_device(client->dev.driver->acpi_match_table, - &client->dev); - if (!id) + if (!is_acpi_device_node(dev_fwnode(&client->dev))) return -ENODEV; ret = acpi_dev_get_resources(adev, &resources, From patchwork Thu Oct 24 12:36:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848940 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 8B57B1DD86F; Thu, 24 Oct 2024 13:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775086; cv=none; b=mVhNrTRFmUvFPNTSOqspLuLl03csDmYpPu1IaUSYeRYeCtyKPQifTgR41cMqufkTBApz0Z21RwMsegw7r16GF3ZPj/KJTZU1uUN8FwbhoNBMjwBPectk8lepGBhxIrVRpU4ewaSWauEM2sZTh4S6JmgrkLRBMgCpz9u2RF7Ps7Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775086; c=relaxed/simple; bh=2NpSf0hOT+YNC2NtcTsGYEN7hUnqCBnO3iQXTMJmrUQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bbB4SPhmZvQc7DuRWH7n9dHbiWEMt939PpbFswngO3/hGrUq2VKD4tn0ObbU/jgkfKraLNTuZdT6cth1vI7npyz/BCHTOP+SPoe6W37GG2xLRQHwUD5wpEt4X7cccuPpDbh8odwdrrqpZerigMdtmdqar/w6CF9RHLLURDPTJK0= 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=hNO182yn; arc=none smtp.client-ip=192.198.163.7 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="hNO182yn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775085; x=1761311085; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2NpSf0hOT+YNC2NtcTsGYEN7hUnqCBnO3iQXTMJmrUQ=; b=hNO182yntKojIiVdE8u3SHiNkvoit4M+ayMMXFAZZjLM126DHF2LMdVR JGms9DDr7Nt2jYgGIz0y3//ocmnn50HLwpjtAMPwXRjwVN6THG++0tZXb swRi+Aoq7+7CLfYpj6Qeu3DuBeK1ocpOqRxCtUUSJ3MSqcuiDaSJsTFB0 xmATp4DOtcLOe+XY8F3yMuAB8Hx7FlHPTCRxTy2kZ7cvB1WjQ0wx/onVM 9KT3IzJoKnPaoRdh6bsnw3EeYcfNcr117H7mynKtAdGvvz0hBPO8ugHbd tmlHQeCbYLB34JFoFBcQXE/eZ919x0q7JuyHPsean2UU+StYJJ3sOqiwp Q==; X-CSE-ConnectionGUID: wf9wPQTfQMaoDUmG5tUBiA== X-CSE-MsgGUID: RrF6gzsCT16nY9joZleaaQ== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="54802797" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="54802797" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:28 -0700 X-CSE-ConnectionGUID: tM2rEMvxRwC7aDcKtoCdUg== X-CSE-MsgGUID: gxV/AsKjQLO+szkePiU7jw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="80238762" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa007.fm.intel.com with ESMTP; 24 Oct 2024 06:04:26 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DF2E14E3; Thu, 24 Oct 2024 16:04:24 +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 v2 04/13] iio: acpi: Improve iio_read_acpi_mount_matrix() Date: Thu, 24 Oct 2024 15:36:09 +0300 Message-ID: <20241024130424.3818291-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-acpi.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 = { ACPI_ALLOCATE_BUFFER, NULL }; - struct acpi_device *adev = ACPI_COMPANION(dev); char *str; union acpi_object *obj, *elements; + acpi_handle handle; acpi_status status; int i, j, val[3]; bool ret = false; - if (!adev || !acpi_has_method(adev->handle, acpi_method)) + handle = ACPI_HANDLE(dev); + if (!handle) return false; - status = acpi_evaluate_object(adev->handle, acpi_method, NULL, &buffer); + if (!acpi_has_method(handle, acpi_method)) + return false; + + status = 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; From patchwork Thu Oct 24 12:36:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848941 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 EAAE11DD88D; Thu, 24 Oct 2024 13:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775087; cv=none; b=Y9BEAjwZ0MKwIJNeXIaw4UhFlWwUDJW6NbKmem+tzHf4gvcHhh56n8PQd463fgGa6zukmNc62/hAw5Tg60lQc4NCxuB5v/JRaeow7t6qi6beTp8C3m8gkOcjA7Y5T9C5yWIy7IE7GVvkXZKyXGIa338/0dM7BYRMpxIwQVRAxIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775087; c=relaxed/simple; bh=qu1MeaORnimrsRm6+oZqb8X4YUWsFbVUZk6LP5Gff1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r2HW+wvkzYdyAYygvaqMAwoDra/V09zGpd62QJyATumyD4h17vP+iaOecxKAbpYsaMjWBmpQdFPpXxhhQKsRG46RZNOnWH+DNBhLTn2Lx4RbBTLhwYqgRkgvkiU1Sdw/h3PlPp7+AdPMFU9yTZMk5WvRqUqaV/QRL5AfY8vBxmI= 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=K6wisoWa; arc=none smtp.client-ip=192.198.163.7 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="K6wisoWa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775085; x=1761311085; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qu1MeaORnimrsRm6+oZqb8X4YUWsFbVUZk6LP5Gff1Q=; b=K6wisoWahYXGcYw8/Ijbgkw7kE44O5U+BGa665rmwpF7IGBbeRvVcJ3e zoccTIE1gehVFmv8CLoxCN4soyOlcuZWuWa4AR+34fSlIH7bWj5Xx/P6b DuEMzeKO2kO6RWNG6TgAbLjUm5OsAlEPblKpPl97n7EQgsLBvhWv9d7CI 9R6j9IzoqoMFV/cXuTXspJwZwoPdaIG9YHHEa9kq38ZkWTor2u5pV+mXA Fs0sBq2U33Asym2ArC2e9toO8YdFr/AU3Y6MIg9Tjf4vv+VTCsVGHj87R c30M/Hq7fMLG5FWyUkulHPeEKN/ccYXDQbwEzvn8W5P5z+P5owfNh77+i A==; X-CSE-ConnectionGUID: EH3rm8HyTgquMQRkdMdz8A== X-CSE-MsgGUID: 3Gj7wbZNQBmWhcp55WWnuA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="54802808" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="54802808" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:32 -0700 X-CSE-ConnectionGUID: wJu4Dzo0QRulCF7BRjf6lg== X-CSE-MsgGUID: sSzw4t0OQAeb5MubzOeuDg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="80238785" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa007.fm.intel.com with ESMTP; 24 Oct 2024 06:04:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EC360550; Thu, 24 Oct 2024 16:04:24 +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 v2 05/13] iio: acpi: Add iio_get_acpi_device_name_and_data() helper function Date: Thu, 24 Oct 2024 15:36:10 +0300 Message-ID: <20241024130424.3818291-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 | 35 ++++++++++++++++++++++++++++++++- include/linux/iio/iio.h | 10 ++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/iio/industrialio-acpi.c b/drivers/iio/industrialio-acpi.c index 1e46908f9534..0003f6c67580 100644 --- a/drivers/iio/industrialio-acpi.c +++ b/drivers/iio/industrialio-acpi.c @@ -2,7 +2,8 @@ /* IIO ACPI helper functions */ #include -#include +#include +#include #include #include @@ -87,3 +88,35 @@ 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. + * + * Returns: ACPI device instance name or %NULL. + */ +const char *iio_get_acpi_device_name_and_data(struct device *dev, const void **data) +{ + const struct acpi_device_id *id; + acpi_handle handle; + + handle = ACPI_HANDLE(dev); + if (!handle) + return NULL; + + id = acpi_match_device(dev->driver->acpi_match_table, dev); + if (!id) + return NULL; + + if (data) + *data = (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 void **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 device *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); +} /** * iio_get_current_scan_type - Get the current scan type for a channel From patchwork Thu Oct 24 12:36:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848933 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 AAECA1D517E; Thu, 24 Oct 2024 13:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775073; cv=none; b=tI5+E0nvAC6xJuguLsSmEIu4jzPekl4lUKhm7yxKilPlNqV77tRcUiJ3uJxU9V794ZztbI7V/ijsYL58Jojecx2EyvQ8uQIJd5uTO7puvHjWUCDn6xjetli5ujodmyzA4AfbsB1xZbD8DbyLwvx6hinDRtmsA1qXAZ1QbxaGi1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775073; c=relaxed/simple; bh=8sCpK1pd7nRUkCdMXWy4llb6XrvP6fxWrADB2+farzU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HkaweVk1cPtCAr+ewWIqnrnazznRWlIHn6D4y9KtDbC0KHMjELo8mHC2OEkVHK2MMKXyhun1cDIaU3w5ygHD6sTddAqn5SknepDIT+so25PMHmyNLrEktiLDUnqxtR13amWVF4JYjQe8L7u+wbWg+7BI84/VeDdBPTXxIF5n62E= 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=ijznIl2U; arc=none smtp.client-ip=198.175.65.12 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="ijznIl2U" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775072; x=1761311072; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8sCpK1pd7nRUkCdMXWy4llb6XrvP6fxWrADB2+farzU=; b=ijznIl2UHouY+xmTVfo8pTdcpyBX4VvSwYPLWtxwA8AgALP7n/7J79j+ tfRKTblJCeWehZWxjxiju1iFgEOVJPF30FwZV3pB+ODD7fRqsynIJtfDG ldKyHDKZb+h3R+MWbOX8KLocND/Uwibu05l2uTh49QcLl7fWVs+cNy0cS QPwqCQTQDRJcuRH+T2YygMKpUG7kEjKLawXoEzd736q1ucvL8vvEW2i2j QaJ3H/x83HgfnkWc58x2EpEEe3q6AZdLugoOK4jS0+FfZ5GxPo+aKZEzj Cq7VkUdachzvGmzrDWCkLo5BC+EH9JeIGV4cdqSZPJKDtCZGybFkB1sMS w==; X-CSE-ConnectionGUID: nTZPB2ZfSeuNGinXeZ2B5w== X-CSE-MsgGUID: nyvlDOsATk+hQX6PyhNGkA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="40795219" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="40795219" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:31 -0700 X-CSE-ConnectionGUID: H3UAmlKlSeOEb10z8s9tdQ== X-CSE-MsgGUID: 39JOBR2ZRxyZS9FSbZOeEw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="103898630" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa002.fm.intel.com with ESMTP; 24 Oct 2024 06:04:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0570A588; Thu, 24 Oct 2024 16:04:24 +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 v2 06/13] iio: accel: mma9551: Replace custom implementation of iio_get_acpi_device_name() Date: Thu, 24 Oct 2024 15:36:11 +0300 Message-ID: <20241024130424.3818291-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. */ -#include #include #include +#include +#include #include -#include #include #include #include @@ -435,17 +435,6 @@ static int mma9551_gpio_probe(struct iio_dev *indio_dev) return 0; } -static const char *mma9551_match_acpi_device(struct device *dev) -{ - const struct acpi_device_id *id; - - id = 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 = i2c_client_get_device_id(client); @@ -464,8 +453,8 @@ static int mma9551_probe(struct i2c_client *client) if (id) name = id->name; - else if (ACPI_HANDLE(&client->dev)) - name = mma9551_match_acpi_device(&client->dev); + else + name = iio_get_acpi_device_name(&client->dev); ret = mma9551_init(data); if (ret < 0) From patchwork Thu Oct 24 12:36:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848943 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 87B741E04BD; Thu, 24 Oct 2024 13:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775088; cv=none; b=quHyAxX/25x+MOFRvDcmA//fs7zzt8l+AoofUwP1hLED/fSbwSeF5ce0kJ2C2n3neBAwm+jOqTTR7/X2KFACzfjdj6ouPdHt8/dlFsMo3Wqxkh5+P2o7y3dg26C667+Wt3ELc0Vqyixke/yTrJI60o4YXMu0bWRdR34h90ABjoY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775088; c=relaxed/simple; bh=QjdeYHP6bLRULSx5x70pbUZ1lUja1ExHACvu0ZrgtZU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N1LKRCtfcLfGB2SzbJRQCuPEIl0Cq+ykFc3tG+HuWQxfkLELxKoR6Po8r5JEy8fnXOAJ/RVk64HzfuLJFQQRk8gHzLJT+9yoWLTk/9BnyVy+p24CJM3UNQwFYQlkcVypvy4vnQyKE03Ni42pgeKnDX8B4Oe8JqMTRUHFrMBq2Ao= 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=TsBq7bBt; arc=none smtp.client-ip=192.198.163.7 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="TsBq7bBt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775087; x=1761311087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QjdeYHP6bLRULSx5x70pbUZ1lUja1ExHACvu0ZrgtZU=; b=TsBq7bBtGy1MzYm6ny/Oqa+eFRbfKGFS7gTVjpVpzNFXMJQSEJjmceQg UpVN1/2Q2xbeu1UUjW3Vzxwg0AmoQKS00lHLMQLtGegmWUfVeVE7oQRdm 5gvqYB0dh4PFb8bLVkYWYsHnfqyUFm91Sqe7NdqrbUl7Or4E5iM5INKwa wq0nFst2xuluK2I1oPxE3bJrgT3Vncrr+a73BK8k95TdWt25C7QxGeI7g P5L/Y2YaPJiuKqpy4IU3NH1szjTrbZockmKIbLC7yQT6RQ5mXKjOVfQ5S oXThmP6y/FQyShtQJ+AZUnVBkt0cxtNIM1eKEMoqA4mEHN+2uIJ03yRmb g==; X-CSE-ConnectionGUID: HgVOSWSLRqOy0uRI6OYtXQ== X-CSE-MsgGUID: m/YINrzCRvmldf2VQKD+5g== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="54802822" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="54802822" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:32 -0700 X-CSE-ConnectionGUID: g/I8CVPbTnuHkQEMvsh7Kg== X-CSE-MsgGUID: hyUyQ+kmTH271EKuRYsdkw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="80238788" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa007.fm.intel.com with ESMTP; 24 Oct 2024 06:04:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 0DB7A5B8; Thu, 24 Oct 2024 16:04:25 +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 v2 07/13] iio: accel: mma9553: Replace custom implementation of iio_get_acpi_device_name() Date: Thu, 24 Oct 2024 15:36:12 +0300 Message-ID: <20241024130424.3818291-8-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. */ -#include #include #include +#include +#include #include -#include #include #include #include @@ -1062,17 +1062,6 @@ static irqreturn_t mma9553_event_handler(int irq, void *private) return IRQ_HANDLED; } -static const char *mma9553_match_acpi_device(struct device *dev) -{ - const struct acpi_device_id *id; - - id = 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 = i2c_client_get_device_id(client); @@ -1091,9 +1080,9 @@ static int mma9553_probe(struct i2c_client *client) if (id) name = id->name; - else if (ACPI_HANDLE(&client->dev)) - name = mma9553_match_acpi_device(&client->dev); else + name = iio_get_acpi_device_name(&client->dev); + if (!name) return -ENOSYS; mutex_init(&data->mutex); From patchwork Thu Oct 24 12:36:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848942 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 9096F1DE2AC; Thu, 24 Oct 2024 13:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775087; cv=none; b=eVeDhO0/PgxzR1frD0clB4jlbSmxeaBVBXhlTl08ZNassZgyII+Ja7lFeIT8pPaNTSwWFEcE2ipJFKniZn5KbMLziNu7deUNazt4UyYs6bt/U8dTlJsMHlus5PKOM/qwqvYwv5+NApL9atJKMRNK6LFXvxJ44bwDJOQutS6O2rY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775087; c=relaxed/simple; bh=7VD/YZ3dxyXfp5F1cccl2DO7mfRb7DzapOk2MWXOIuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dn0BbIFv0zZ82G89TMhy6iR3sTb7Ahb0CtEH1/7sSq29DYDjJdDRQqLjVliSbtpQAcVGImgTBmTmaKQP+QtLFx0iS42ANVrMqyfnC/y1p9jxZIgGW7/YNL91fD7LLqX8i9D9Y77LjqPg64GaVyUOX87bKxouP+u97TohgSRKo1k= 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=f6IJIrbG; arc=none smtp.client-ip=192.198.163.7 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="f6IJIrbG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775086; x=1761311086; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7VD/YZ3dxyXfp5F1cccl2DO7mfRb7DzapOk2MWXOIuI=; b=f6IJIrbG54uZNXsHs7a2aNlGs137jzo8Jydn0jitVx49NoNLoZOPuxAb v/mQU3BhQm3llEcmNNGYIOpqhedX7Wv2rnGFpFORsxZ5iyTAxi+st4WJx f4yvFSmI90lrWZZ9bWMi+mje9ngGj06ygzIlpWnT0iO0Ze+PFnjLHJWCC uIY30Rrsmz1BGVJyzooT9ySiTjUZgvDiQ6xcQNxXOyFFySrdGrprvEpFK iAPMnQuqxfkoSwdLOSAH4PWlTEy4e6c0KFlhY1sIEPsODR5oUV8ZHNeM9 0EonFCVIOxog7NErXJDAQ1OQv8Gj3iaR65SQj7bRYOriAlWFi+vSUB8Hz g==; X-CSE-ConnectionGUID: n2j918/1Tr2vPMwSJaqJCQ== X-CSE-MsgGUID: 8C7lo0T1RTyt3HevTjveVA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="54802816" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="54802816" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:32 -0700 X-CSE-ConnectionGUID: Z9saZD1/QsKLdNGplz/99Q== X-CSE-MsgGUID: TybJP+20ScefkZkLOo56Mw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="80238787" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa007.fm.intel.com with ESMTP; 24 Oct 2024 06:04:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1656C644; Thu, 24 Oct 2024 16:04:25 +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 v2 08/13] iio: gyro: bmg160: Replace custom implementation of iio_get_acpi_device_name() Date: Thu, 24 Oct 2024 15:36:13 +0300 Message-ID: <20241024130424.3818291-9-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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_buffer_setup_ops = { .postdisable = bmg160_buffer_postdisable, }; -static const char *bmg160_match_acpi_device(struct device *dev) -{ - const struct acpi_device_id *id; - - id = 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 regmap *regmap, int irq, mutex_init(&data->mutex); - if (ACPI_HANDLE(dev)) - name = bmg160_match_acpi_device(dev); - indio_dev->channels = bmg160_channels; indio_dev->num_channels = ARRAY_SIZE(bmg160_channels); indio_dev->name = 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 = i2c_client_get_device_id(client); struct regmap *regmap; - const char *name = NULL; + const char *name; regmap = 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) if (id) name = id->name; + else + name = iio_get_acpi_device_name(&client->dev); return bmg160_core_probe(&client->dev, regmap, client->irq, name); } From patchwork Thu Oct 24 12:36:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848936 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 3CC121D967F; Thu, 24 Oct 2024 13:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775076; cv=none; b=Zdubw3HMxBn4uMG6blnsEA+58ELIc0ijhvOLBNt6gv1GHVOGbq7ccgoOOhJg/JVWG/wUnO4LchHmXXKncslsZG0M+VsBlaS60N4KNtvohI+5YWnY5u2AVnSLlfmDI0bF2UK9ViLFVV3MrvA/wWFVicjG79mJHcK1OYbebcww65c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775076; c=relaxed/simple; bh=r1Ljs09ViP07Wgn+0g0azOe4A6vQASHH1I/FkFMyUOE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tICRq6ma8D4lTnLuwOP1ms1DE/x49bG3Z/frgfVMiCIpX0se17Jt11vEXJPJ42aIvN9LuRYZmWSs6EC0LtQmot0+gSXRw2uru9a3n2tke9ObWTPsS1qrkqikYvNTS34RFWbfpdAH0AjiMweChMpafyO4vjKSTFPWRmTPMvakQvU= 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=cN5Xmxli; arc=none smtp.client-ip=198.175.65.12 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="cN5Xmxli" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775074; x=1761311074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r1Ljs09ViP07Wgn+0g0azOe4A6vQASHH1I/FkFMyUOE=; b=cN5XmxliYi3MX3DcwN0TNs0UTb2SloURUMH66qf2+Ft6bOvmXZmkaLdJ 4XjQSCcwldtUE1ceJ/f1I29k8PP/HPHuZNgMdDKziH/+ZDWvnz76ZFmTn w49Ks1jKRotDo9vFszcp14JGknGgtAkPgt5Qh5O6EQMe5GW10Tim3ciPi Xw/9FQYMxwkO+OMk1+JvbcTfEQDhlTCxKX7ovif48qSIOYtZ3/5OJABhT 8rGZ/Zhx5bI+xpa2fZRMnKMuyLmh2W9+PDrkjrg2/UhONsv552pl9OzBv PpCJ+1UvDNpd3RCyVoRWXerjo7h/nzn1NwSU1/FZ80R7FaLJf09UQqsuA A==; X-CSE-ConnectionGUID: g31vzK/WTKC1+9qLTSuVmA== X-CSE-MsgGUID: nXBGM+JXSdSlo3w5W1f8RA== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="40795248" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="40795248" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:32 -0700 X-CSE-ConnectionGUID: XSs+pGdFSjSi4U3MWB2FEQ== X-CSE-MsgGUID: 9Cl0J33PSFq7huLLX0OMVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="103898633" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa002.fm.intel.com with ESMTP; 24 Oct 2024 06:04:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1E3A26A7; Thu, 24 Oct 2024 16:04:25 +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 v2 09/13] iio: light: isl29018: Replace a variant of iio_get_acpi_device_name_and_data() Date: Thu, 24 Oct 2024 15:36:14 +0300 Message-ID: <20241024130424.3818291-10-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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_info_tbl[] = { }, }; -static const char *isl29018_match_acpi_device(struct device *dev, int *data) -{ - const struct acpi_device_id *id; - - id = acpi_match_device(dev->driver->acpi_match_table, dev); - - if (!id) - return NULL; - - *data = (int)id->driver_data; - - return dev_name(dev); -} - static void isl29018_disable_regulator_action(void *_data) { struct isl29018_chip *chip = _data; @@ -716,9 +702,10 @@ static int isl29018_probe(struct i2c_client *client) const struct i2c_device_id *id = 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 = NULL; - int dev_id = 0; indio_dev = 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 = id->name; dev_id = id->driver_data; + } else { + name = iio_get_acpi_device_name_and_data(&client->dev, &ddata); + dev_id = (intptr_t)ddata; } - if (ACPI_HANDLE(&client->dev)) - name = isl29018_match_acpi_device(&client->dev, &dev_id); - mutex_init(&chip->lock); chip->type = dev_id; From patchwork Thu Oct 24 12:36:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848935 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 A2CF21D8E18; Thu, 24 Oct 2024 13:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775075; cv=none; b=RqocRDI2TG1idNnkiFUprz5VnM0dqUDeZLIP1WJ7pcCF+jAQEv0s2mDQU4XEdcGUTXjip+bygTphxjIo8+UNwnoCmI68YYix+AHyW8ZSrhXebkUsn2CoJ8OSKDqRz4oAm6MuN1jkw2EE7qwVfSWcaa9tDh5SO+NIR1d8hSlx5go= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775075; c=relaxed/simple; bh=ka5ttrTleL/Ct3ANbBPzaVEqvP9UA33xx6pJzKITIMA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LTVsQr9ls5VEV/OWN2KqoYh+U82SXaejHHZxK0yg+b1FlL2oXspt73laYPZGockKdILBBxW5mEQRQZaYQR4MnsGcvTrY3Dj4xVWrJRlpsN/pHDNBsEuyWnz197RyY70Xf7akW1RimaSMlGYkgYChSFURwuRmSwY32pNPEkf1uQ8= 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=jy6MG/l0; arc=none smtp.client-ip=198.175.65.12 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="jy6MG/l0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775074; x=1761311074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ka5ttrTleL/Ct3ANbBPzaVEqvP9UA33xx6pJzKITIMA=; b=jy6MG/l0GIMwjV/tdvpQYmnNThHx4okl5MJXfMJP3pXmY8pLtzksxjS1 bPFPZ0RY8sjhdfSXZy76Fq5GsBheJwKHMjYOTCLFJmI4plkB+7k2Mvv74 9oHaMyxDYq0bFakETtycNWrRW67HvvY5UT4N2gWtZ1w0LZBEYEdIqeit+ SlIkiIW8298rXZQyN9QdCy6v83t6bkphNPlMajt7w2cQIMoWBtoP5Smnk xSCTYQuUtXWxi3VBm1DwEwDCnOXdreQRTQ6fgutaHMbDveiNFBpB+R4FE QTb7WwEYyc7IAF2qTOjbTr9af2lUYH5xEFeXAVofGrMpERh/cC0PQsuRU A==; X-CSE-ConnectionGUID: 46gAZZznQHengQbfjhX+xA== X-CSE-MsgGUID: fZaNdBa0Qc2F+a8XJzv+Sw== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="40795240" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="40795240" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:32 -0700 X-CSE-ConnectionGUID: kaHB+LMRRYqQeYr+UcearA== X-CSE-MsgGUID: sdyLLeXCRfGVQq6qGSKcfA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="103898632" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa002.fm.intel.com with ESMTP; 24 Oct 2024 06:04:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2765D74C; Thu, 24 Oct 2024 16:04:25 +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 v2 10/13] iio: light: isl29018: drop ACPI_PTR() and CONFIG_ACPI guards Date: Thu, 24 Oct 2024 15:36:15 +0300 Message-ID: <20241024130424.3818291-11-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. */ -#include #include #include +#include +#include #include #include #include #include #include + #include #include -#include #define ISL29018_CONV_TIME_MS 100 @@ -819,15 +820,13 @@ static int isl29018_resume(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, isl29018_resume); -#ifdef CONFIG_ACPI static const struct acpi_device_id isl29018_acpi_match[] = { {"ISL29018", isl29018}, {"ISL29023", isl29023}, {"ISL29035", isl29035}, - {}, + {} }; MODULE_DEVICE_TABLE(acpi, isl29018_acpi_match); -#endif static const struct i2c_device_id isl29018_id[] = { {"isl29018", isl29018}, @@ -841,14 +840,14 @@ static const struct of_device_id isl29018_of_match[] = { { .compatible = "isil,isl29018", }, { .compatible = "isil,isl29023", }, { .compatible = "isil,isl29035", }, - { }, + {} }; MODULE_DEVICE_TABLE(of, isl29018_of_match); static struct i2c_driver isl29018_driver = { .driver = { .name = "isl29018", - .acpi_match_table = ACPI_PTR(isl29018_acpi_match), + .acpi_match_table = isl29018_acpi_match, .pm = pm_sleep_ptr(&isl29018_pm_ops), .of_match_table = isl29018_of_match, }, From patchwork Thu Oct 24 12:36:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848945 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 B07991E2607; Thu, 24 Oct 2024 13:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775089; cv=none; b=aB0siWR9soJymbzz2sb4pEgo1p6mKrF4R5eadUyt/wtHhRG13WKFCsd1bFMEMH8/hdBk6P/PY74Yfwb1gv9wj4wvRe5cI0T2fWZvSoE4QWAcmZZrcrYFBxnjqqcVCAHQNYj1o2QiC4qgZPsmdmWLEob+bAjLguR+ImMOGN6bW0s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775089; c=relaxed/simple; bh=Iocz/KVSforp7TWPBNMBSymCJu2I9Wm9f+hSS1P8ifo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DZ6jcDw0EAAEmC+gzAyDgzWk4jHcZGhq5CBWQJfpmAbGHZXLwY5Dkd0JE+pCUP/xdpJBiumKdu8g9uR5heUpynwOkxKyspkRu1vDhrjEnESrNIGmF9FOsxqnIB01J645+aseihTGIxsp20O+Kfj4+SC0zQzBMYj8f6WAooNMOFM= 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=XhKEEb/O; arc=none smtp.client-ip=192.198.163.7 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="XhKEEb/O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775088; x=1761311088; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Iocz/KVSforp7TWPBNMBSymCJu2I9Wm9f+hSS1P8ifo=; b=XhKEEb/OKhJlXIk5TONg6tXy1RKBakaWX+AbL5nFq9x9ocgznTUWM/1m iwV8KjA9PL4g3H2uFqV+OWa9/jJVXzFM2Y5y7SnI3aq/MYeH/MeIhNX5n rI7wny2x2ybeTA1QyaJpcEsmcGcvJYM7GxaYUvRMXYf7H2eVNQ4bwxSWl BzmROSLCrXhsI2P5ZPEjAX/AV/0jXxsWIt0aUxdPEjhePyp8dHIyLou5a pKW7/kt3A0T/iOWCZB+uT4MAn5xEwdON4EE2CYWmlrKQMm/ACbYf8Xd3S wp4kaQb0HMV7jR7v5SPZ73npu/UByVm+eYIaocDgo75BimMEEYIDqYyu4 w==; X-CSE-ConnectionGUID: vzoKtPQtSZGsQRQ82bA+Ig== X-CSE-MsgGUID: AmDt5GFfT6u3PC8ks4y2tw== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="54802845" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="54802845" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:32 -0700 X-CSE-ConnectionGUID: q+4u1cDQSUOIZnIxYHooQw== X-CSE-MsgGUID: 4qxAxZ1VQGic+Vojf1ToVA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="80238794" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa007.fm.intel.com with ESMTP; 24 Oct 2024 06:04:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 355FA386; Thu, 24 Oct 2024 16:04:25 +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 v2 11/13] iio: light: ltr501: Drop most likely fake ACPI IDs Date: Thu, 24 Oct 2024 15:36:16 +0300 Message-ID: <20241024130424.3818291-12-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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_resume); static const struct acpi_device_id ltr_acpi_match[] = { - { "LTER0501", ltr501 }, - { "LTER0559", ltr559 }, { "LTER0301", ltr301 }, { }, }; From patchwork Thu Oct 24 12:36:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848944 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 2347E1E1A18; Thu, 24 Oct 2024 13:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775088; cv=none; b=Yl26ngWtDdueeeuyMWixpTF/eKqCBFbC4Luc97EdaNKce39Uw+Eop4ZisA1+u09wJyhn0v0VKyizx3VmbBk1voCG6a81sg1zF8cQOBSWTBeYdxZCWSw7YD4P8YMq5eMsUc0IrfOFwVpeUc4X5JL/ktDc9mLzcja9fIs2IZzi6AE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775088; c=relaxed/simple; bh=fvNel6p61T3jK3xq1Ew/lp5LBDNzFIYblZQCIwx3ZuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QrWTCPG2EFdIIsspQ+8kwkv2rOYKXAvcglP4a2W+oHlIi6LdG+u586hYz/lp0YJXALL+3Qjy+6yeV4se3ZCG1jvDPL/dy+tHnd5o9Di8MZ67Y9SuBLK++quXdST+n1NQVycTclUiVfXnqrncWLeODszYhef1K6TyH3vQ43sL7W0= 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=da8zLoxq; arc=none smtp.client-ip=192.198.163.7 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="da8zLoxq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775087; x=1761311087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fvNel6p61T3jK3xq1Ew/lp5LBDNzFIYblZQCIwx3ZuI=; b=da8zLoxqKpLAtPHDG8ierjbUJ5EgH6YGMVIf5ACxGAjIGfh+DBevFnRL KXJBPu0pT4n3JKUN8m8nnXMR7fVFFJrOnOQ2YgMPb6Wab5Jw8fV0pVPOz Jgjr76O8Y/8Q1j7ou+pOe1W7yG5vMAhBWSlm4MYX+nzyTbxdwKDsTRkpB 4qxigUZk2EWs6xAqiVo54F+il0wrJMeJoWMniPk0ZYUpwvOhPu9DLzMsE 8NuC8+5RaS3nxiTaYa3vM5CwNqdeQNwSkSnkmrpkhoOG0iRjURlVnZyJN TOX6imUQXXKFgLptiWaopUz77SIfTak/K3CyjViT/yqnLJSHVuWxuMXfq w==; X-CSE-ConnectionGUID: JnyUe+d2SLChvobgTXxBaw== X-CSE-MsgGUID: TaDAQqZyTlCw2CdEht01zw== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="54802832" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="54802832" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:32 -0700 X-CSE-ConnectionGUID: v4K9xq7jQm62svSFktsecw== X-CSE-MsgGUID: Uy8RVuK6R/CKackwGFt8Aw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="80238792" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa007.fm.intel.com with ESMTP; 24 Oct 2024 06:04:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3FA407B8; Thu, 24 Oct 2024 16:04:25 +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 v2 12/13] iio: light: ltr501: Add LTER0303 to the supported devices Date: Thu, 24 Oct 2024 15:36:17 +0300 Message-ID: <20241024130424.3818291-13-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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=lter0303 Closes: https://lore.kernel.org/r/9cdda3e0-d56e-466f-911f-96ffd6f602c8@redhat.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); static const struct acpi_device_id ltr_acpi_match[] = { { "LTER0301", ltr301 }, + /* https://www.catalog.update.microsoft.com/Search.aspx?q=lter0303 */ + { "LTER0303", ltr303 }, { }, }; MODULE_DEVICE_TABLE(acpi, ltr_acpi_match); From patchwork Thu Oct 24 12:36:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13848934 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 9B8001D89E4; Thu, 24 Oct 2024 13:04:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775074; cv=none; b=mqNfUGaQqb6ooffyVPbVlxsXoQEpCaRmYmkztWWafb1Fpxn2tCUsvn5BvZ4WiYCFVp2o8C8u8EorpO4jGOXWtbeMjHTQp9ySULBdsKey26CoOYE18Nw0s5bW9B5LxsczOA6YuHQKt56DGMZNVXQg12m38W9FFINK7naUxIOI75E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729775074; c=relaxed/simple; bh=uf9btLtoClCOjF/hTMc4aLgnXwHw0svLKzR/oE7cpbo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oqCSbcX+s2SPjxXIH9d6kLD1X9hmbooRzy0m1Hl4KuI2SHwtbsFpUmS37K2rHMiF9FGkj1HlMZm7Uljup0bZKc+BU4GAzIgCbw4vFB5okYIPpWzfVagudDauy/SMdnKhfI97H4aiPjpHphaM/EUXITxUhu/WavfnNUfMWZTwSnE= 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=l8dpvO54; arc=none smtp.client-ip=198.175.65.12 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="l8dpvO54" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729775072; x=1761311072; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uf9btLtoClCOjF/hTMc4aLgnXwHw0svLKzR/oE7cpbo=; b=l8dpvO540pDF2rMtTxOOk2MrNacMDua1zRFvSU/R870ASVpLRTAI+MUE s+7CG+/n5qmKJGkIuXElo0egR6OJm0k3aUVpmunnW5EYP3igxX1cL1T4j GQ4L2Q0iBnzG56Ay0mrAZu3lxeNcwBZM1Pf92PetS1wgrpiPOiEgSs9hR flLpPK43QJ5jvJG8x2JO3aS5fbwqvdOPqQqj215Sj6LvpUL8UN3nTks6w lfD8p04CrDyUbVX7kZ/EYZpEna1oUxlTx4B+d2yjuHI+7dePBieBBhgux zfqxCr7eceOa9MUnBWi8eqB3Zdyn+xOx1ppW55tOoYLOqFKLOW2H/fd8Z Q==; X-CSE-ConnectionGUID: 9GZS6s1DTaiuSrQOL3lbmw== X-CSE-MsgGUID: rT6+6DlOQ8KFEja8DLeMiQ== X-IronPort-AV: E=McAfee;i="6700,10204,11235"; a="40795228" X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="40795228" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 06:04:32 -0700 X-CSE-ConnectionGUID: Aslfd0SbSkWbImDdq2vs9w== X-CSE-MsgGUID: Hf3D80zFREmQFKzMtYsCag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,229,1725346800"; d="scan'208";a="103898631" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa002.fm.intel.com with ESMTP; 24 Oct 2024 06:04:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4572C7A7; Thu, 24 Oct 2024 16:04:25 +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 v2 13/13] iio: light: ltr501: Replace a variant of iio_get_acpi_device_name_and_data() Date: Thu, 24 Oct 2024 15:36:18 +0300 Message-ID: <20241024130424.3818291-14-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> References: <20241024130424.3818291-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 #include @@ -1422,17 +1421,6 @@ static int ltr501_powerdown(struct ltr501_data *data) data->ps_contr & ~LTR501_CONTR_ACTIVE); } -static const char *ltr501_match_acpi_device(struct device *dev, int *chip_idx) -{ - const struct acpi_device_id *id; - - id = acpi_match_device(dev->driver->acpi_match_table, dev); - if (!id) - return NULL; - *chip_idx = id->driver_data; - return dev_name(dev); -} - static int ltr501_probe(struct i2c_client *client) { const struct i2c_device_id *id = 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 = 0; - const char *name = NULL; + int partid, chip_idx; + const void *ddata; + const char *name; + int ret; indio_dev = 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 = id->name; chip_idx = id->driver_data; - } else if (ACPI_HANDLE(&client->dev)) { - name = ltr501_match_acpi_device(&client->dev, &chip_idx); } else { - return -ENODEV; + name = iio_get_acpi_device_name_and_data(&client->dev, &ddata); + chip_idx = (intptr_t)ddata; } + if (!name) + return -ENODEV; data->chip_info = <r501_chip_info_tbl[chip_idx];