From patchwork Wed Feb 28 21:27:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 208140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp106485dyb; Wed, 28 Feb 2024 17:06:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXiGqetbbFRXILbBz6AzV2xE9/7gcqeXzvTZ0Xeq0vDe3Y1yIidIcPHV3a64kCz6eOoP5/M4s6/AES8c0xSspkz4XuyhQ== X-Google-Smtp-Source: AGHT+IHRfZW4YO296cLWerSMvdV1Vxq6HKT/SbXKAuxXjpk+gX93rEb9b5dqAURah3U/73DW+qwT X-Received: by 2002:a05:6808:23d3:b0:3c1:ae1d:6f2 with SMTP id bq19-20020a05680823d300b003c1ae1d06f2mr825930oib.7.1709168805854; Wed, 28 Feb 2024 17:06:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709168805; cv=pass; d=google.com; s=arc-20160816; b=af3IzZICptKOb+y9NFvRic2xYPOehjJ3p9dnmL3GZqB08P4qru5J2InvRmNCzxsalb SXFD6jLFGLsUekHrIXRhUI9oRHb0yeoAya8UQcUHglMLDpMZ8T7Jh7AQ6zovCQHCyLCF x9eFqwbOh7KGhlFGN+Laj6oBQl11rpbaG5TQZQXTOP7p59IdSBLCSCseJu4P+s8se8iU vsvXyF4/jjMRN0p0/L47+af+nTuZejAtpnUuP00F8GBemok9J5/gVym2ql3HA60GdvN0 x5lGScyOdR2+E8CVRdFwn4196w6chN3DXqhLdLz0LLKq2DMuEGe3lmI8O2mrujheUaoQ CRXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=VJDc96JAtvFpCnsztuCfOL+IXI4cy4RcvHIupQcmfY4=; fh=B/lAw/RZiW2xJ92yiMBaVyzsPyn+5aUdj7gFMmX3Ig0=; b=WM5u3rltcJ7e8imTTXY+kolGIKBraPYKMd7jNAM73OHUtUg/9+bss0LIeuaf5Wqikm 229/ZzpTZEgj4QbpiHNggURMEoU6sWFKo/R6+IC/rZ5EEYt/jlGzHtUdhhwjpK06Cbbt ZoOg74JovSR4TNE7IKg8fiLpHM7XwJoYn4ZBNlsizMKyR+fcUcVDnXC/nHha83jxn+YJ qLlqehxrkZ1bIXn7Rk9tulZ0J6rldBAjQTk37Ebf+4d6EqcP5UZlPbSIA3TM/ubabJJM 5tt8Bj8wH8lvhB9sfsxLHzAK3d/E9PRmgmc/XNEgcpAQEEf+ZHczONy3zOQG7kP1Kd4K 6h3A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ix2qCsmT; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-85719-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85719-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 23-20020a630b17000000b005ce087e004dsi250001pgl.799.2024.02.28.17.06.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 17:06:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85719-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ix2qCsmT; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-85719-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85719-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4C4DF28802C for ; Wed, 28 Feb 2024 21:28:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72B507005D; Wed, 28 Feb 2024 21:28:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Ix2qCsmT" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 C11278627F; Wed, 28 Feb 2024 21:27:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709155680; cv=none; b=WbU3L+/Em8BEjJdzr/hbKruEJAWmmFf0tApcSKL22MX4bt3ci+Fz/j6BHJRKCprQHcLnIAI2WqIzpOzjVpRYM1xCsg9Z0bxUG5uFpYfn6vIH6ZxvtONlhz5Y9FBboOIA1ZSZ5TlQIcYnbF7m1bhs8Tq4TJF+P/rJjL6ezADwTX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709155680; c=relaxed/simple; bh=KRZqXDKyf7LxgmLLihGCD0ad2l3K3+mPreZGWpFnqew=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=CJ+MrZdT9wKwvqS2zCbLj4RvEurpDrCmgjoB5al/j2xZtFY+IjFRXqsbyMnpOQwzzxjAyJk4pabqEXKSBaJoeWeYshICo2WuFfVK7xc1yjeFpLhxioWrKLGYUxu9pLYOoQkVWUk+gbne2Z6RrlcmIqMcVslJsEGFrcApJ8GsjCs= 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=Ix2qCsmT; arc=none smtp.client-ip=198.175.65.18 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709155679; x=1740691679; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KRZqXDKyf7LxgmLLihGCD0ad2l3K3+mPreZGWpFnqew=; b=Ix2qCsmTButdSq+S0q0741RB5i7fCrAh98mfjVKdft+fEhb0y6+qHw98 7ozm90LZNNQUs4pYbZVrsL34wO+AbUI51v7sOz7ahqOTTiVKg5ALE27Ms wIEB8v3Ef5hYiZDH6U17/pJNi1NWC6J16dvOMuMFro+71nRkoZKRD8+qv VJr2AUnIhnD2iqrMb5w1Vnoc2UI6bSxFFT2l+ixLPVj0e3KYFMotxUiTh miRb6eXfCOko2CS51JVByc7Myi1/sjLNIjB5MepSIkVLTLMK0WIIv5ONo trjYw7O3W4zQM/uIE3xw5EjF9Fmaqr73QwZTKUORGMri6gdgW2O9M6jtD Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="3710276" X-IronPort-AV: E=Sophos;i="6.06,191,1705392000"; d="scan'208";a="3710276" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 13:27:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="937034692" X-IronPort-AV: E=Sophos;i="6.06,191,1705392000"; d="scan'208";a="937034692" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 28 Feb 2024 13:27:56 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D285B1C5; Wed, 28 Feb 2024 23:27:54 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v1 1/1] iio: light: isl29018: Drop ACPI specifics from the code Date: Wed, 28 Feb 2024 23:27:46 +0200 Message-ID: <20240228212746.3709512-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792193389743221540 X-GMAIL-MSGID: 1792193389743221540 Convert the module to be property provider agnostic. The ACPI APIs are not required and can be replaced by respective agnostic ones. Include mod_devicetable.h explicitly to replace the dropped of.h which included mod_devicetable.h indirectly. Signed-off-by: Andy Shevchenko --- drivers/iio/light/isl29018.c | 44 +++++++++++++----------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c index 43484c18b101..fe7b9ad7ff35 100644 --- a/drivers/iio/light/isl29018.c +++ b/drivers/iio/light/isl29018.c @@ -8,17 +8,19 @@ * Copyright (c) 2010, NVIDIA Corporation. */ -#include #include #include +#include +#include #include #include +#include #include #include #include + #include #include -#include #define ISL29018_CONV_TIME_MS 100 @@ -523,9 +525,9 @@ static const struct attribute_group isl29023_group = { }; enum { - isl29018, - isl29023, - isl29035, + isl29018 = 1, + isl29023 = 2, + isl29035 = 3, }; static int isl29018_chip_init(struct isl29018_chip *chip) @@ -687,20 +689,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; @@ -718,6 +706,7 @@ static int isl29018_probe(struct i2c_client *client) struct iio_dev *indio_dev; int err; const char *name = NULL; + const void *match; int dev_id = 0; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); @@ -728,14 +717,15 @@ static int isl29018_probe(struct i2c_client *client) i2c_set_clientdata(client, indio_dev); - if (id) { + match = device_get_match_data(dev); + if (match) { + name = dev_name(dev); + dev_id = (int)(uintptr_t)match; + } else if (id) { name = id->name; dev_id = id->driver_data; } - if (ACPI_HANDLE(&client->dev)) - name = isl29018_match_acpi_device(&client->dev, &dev_id); - mutex_init(&chip->lock); chip->type = dev_id; @@ -832,15 +822,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}, @@ -854,14 +842,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, },