Received: by 10.192.165.148 with SMTP id m20csp1480750imm; Sat, 21 Apr 2018 09:09:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx482wC0Kfqjzw37vZc89+e/cSsDvX0PjXh8G3PfbB9P4Pd1n9CunlvC+qg/2ehmb6b9mmtp6 X-Received: by 10.99.152.84 with SMTP id l20mr11437612pgo.16.1524326952085; Sat, 21 Apr 2018 09:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524326952; cv=none; d=google.com; s=arc-20160816; b=h0PuBSnulS9DRxrUQakcSk7ibtcl8XyrJdfL+402n5aO+6+/oF+TnrzCGODxM1IOUB RX39uWb00QGG10sU9pxm1xd/SdAhvm9Eg/qwitRk56TRnau4EkXanYWaj/w3vTVg7Ndo kXCferPMgEN6DNsLAq0/IV501+9d6OjYVO3iiXSjNWxd0+782ouPuVLaXoyNNfYNe6EW SSZYus6J9czbPNDpAimx8T2wfYXSBy3zzhfG8qfgYjWPsfoLPxyYweVAejmbWdIRzFcO yJtZ+zBWYFmVaEcbDLQhiz8OA5uy4qnxP9Vcbm2jJQq97vo6U3DsTpQO/u0n6xJcnsjX rxlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=odsBmNvp5P+2PQEmXZ0wxDxZgo+Km1rihjV2lfJbxeY=; b=jArY3DPM3zv2Q1KBiTJ/N2aBvlrcxif7Zon+gYzR1pCe71+zubXzodOeBXJtOCJ/Uq DRnHTsB4hSz/ZpEjQLN6qTwhPpYk9lGDdhG8qF6k/9peenPAILHbMt6zqpRs5s6Ei+Jo C42NLTbKScnTNoIlP84pZMBSaeMNYknLI0IjEE82yWhZ2m4CRDd8jS+Nq5mv4j5oAUhV FX8lbbje65lcjQLsDErmyr1mbNRLhA0tSjXluhkru1PeDKegmcKMjqRDqD7dAZKf0TqK YaETwiUKQvv5N6jTaonP4Y67TQT88k6nkeImY4gxtJfvOuSXgorB5zskxZLzyF7HcIeR RLzQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t16si5599306pfe.225.2018.04.21.09.08.20; Sat, 21 Apr 2018 09:09:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752899AbeDUQFM (ORCPT + 99 others); Sat, 21 Apr 2018 12:05:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:38766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752765AbeDUQFL (ORCPT ); Sat, 21 Apr 2018 12:05:11 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 165B520C09; Sat, 21 Apr 2018 16:05:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 165B520C09 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Sat, 21 Apr 2018 17:05:05 +0100 From: Jonathan Cameron To: Javier Arteaga Cc: Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Dan O'Donovan , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] iio: adc128s052: add ACPI _HID AANT1280 Message-ID: <20180421170505.60d7784a@archlinux> In-Reply-To: <20180419132036.27493-3-javier@emutex.com> References: <20180419132036.27493-1-javier@emutex.com> <20180419132036.27493-3-javier@emutex.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Apr 2018 14:20:36 +0100 Javier Arteaga wrote: > From: Nicola Lunghi > > ACPI _HID AANT1280 matches an ADC124S101 present on the UP Squared board > that is compatible with adc128s052. > > Add it to the driver. > > Signed-off-by: Nicola Lunghi > [javier@emutex.com: fix up commit message and one checkpatch warning] > Signed-off-by: Javier Arteaga Hi Javier, This is in principle fine, but I'd like to see it done somewhat more explicitly. 1) Add the adc124s101 and similar families to the driver first. I think this is just a case of IDs for all of adc124s051 and adc124s101. 2) Add the ACPI ID as you have done here. That way we at least reflect clearly that the part is supported rather than just in a comment on the ACPI ID. Hmm. Looking at it, we should perhaps revisit whether some of these TI parts are similar enough that their drivers can be cleanly combined. A job for another day! Jonathan > --- > drivers/iio/adc/ti-adc128s052.c | 25 ++++++++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c > index 56ec04d1c68f..917273f1268c 100644 > --- a/drivers/iio/adc/ti-adc128s052.c > +++ b/drivers/iio/adc/ti-adc128s052.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > > struct adc128_configuration { > const struct iio_chan_spec *channels; > @@ -136,9 +137,22 @@ static int adc128_probe(struct spi_device *spi) > { > struct iio_dev *indio_dev; > struct adc128 *adc; > - int config = spi_get_device_id(spi)->driver_data; > + int config; > int ret; > > + if (ACPI_COMPANION(&spi->dev)) { > + const struct acpi_device_id *ad_id; > + > + ad_id = acpi_match_device(spi->dev.driver->acpi_match_table, > + &spi->dev); > + if (!ad_id) > + return -ENODEV; > + > + config = ad_id->driver_data; > + } else { > + config = spi_get_device_id(spi)->driver_data; > + } > + > indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adc)); > if (!indio_dev) > return -ENOMEM; > @@ -199,10 +213,19 @@ static const struct spi_device_id adc128_id[] = { > }; > MODULE_DEVICE_TABLE(spi, adc128_id); > > +#ifdef CONFIG_ACPI > +static const struct acpi_device_id adc128_acpi_match[] = { > + { "AANT1280", 2 }, /* ADC124S021 compatible ACPI ID */ > + { } > +}; > +MODULE_DEVICE_TABLE(acpi, adc128_acpi_match); > +#endif > + > static struct spi_driver adc128_driver = { > .driver = { > .name = "adc128s052", > .of_match_table = adc128_of_match, > + .acpi_match_table = ACPI_PTR(adc128_acpi_match), > }, > .probe = adc128_probe, > .remove = adc128_remove,