Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp769217imu; Sat, 17 Nov 2018 09:08:33 -0800 (PST) X-Google-Smtp-Source: AJdET5eRjivuv/r25BsIcdNE/gf1T+691d2vnwWGi2DZjHTR+DJ1vbwCS7UZDTdsAJhELqPUOIPy X-Received: by 2002:a63:6782:: with SMTP id b124mr14293250pgc.151.1542474513161; Sat, 17 Nov 2018 09:08:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542474513; cv=none; d=google.com; s=arc-20160816; b=a+KKtgfuilkGIF7ItKgd+HPoAOVq5pSf6YjusUYqbkWpYLdQoEAym1lrBw4QCGQWG7 HgJL/23/HGVw8V0lGr3FSVdB6J269x2z6k0JRWzfT0fbQiwEW2U8aLI20It7qoRpt2Lg TKWEvP2VrEOd2uHhbmhDXR8EPu6RhC2emz+yAOKQ52wWNFEWCu88x5XwFsigKuJ5X155 T+Do47xg1Z1vwfMKjxRsIGZrA2ykoOlhNq47Sat7vJNaSNsjz0T+xnDSnfSFsJjEUwQH pZfNMP/3kFUZuVSd6TNyhkfodaVh6ONoGuxhqGL7Cf5kRARkdYA9c680nA4J+qVUFB7l JAOA== 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 :dkim-signature; bh=4iByOcbR6a2dX2m8E3bXMVmr56l80tcZ5/smxCVXdHg=; b=ltP7M3QKgMYguOca6TJtIyMHroG+Fs+QZcBK0dtedXRV18KeuF/8I3KnJIUfG1tZny At01rhyvBwTWMC6L4RMYJ2J6ar+WnHCQKO6FevbMRzULrW5n82lbU2PQNBDLY/6+8Z0h puXthUGbkXS40BGFs+I9Y06X+pOFL94chzx2RvgdKB3+QykMbPv5BSFFIQERdJtZ6QyQ rnMj/nywSTpFPdhEwB2slo+bQLNiJ9YYoR7aqiRFqazjp1wCRCQAXR/6XeJaktY/isdF GlasTwV/4geYVXJj2Yk5V+OFfu8AYg+Iof0wEmYRHwzLou9RyPp3AG1f7iQn7at1Q5F8 SGgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qwT2pJIv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2si9842103pgh.474.2018.11.17.09.08.17; Sat, 17 Nov 2018 09:08:33 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=qwT2pJIv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726896AbeKRDWl (ORCPT + 99 others); Sat, 17 Nov 2018 22:22:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:44800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726128AbeKRDWk (ORCPT ); Sat, 17 Nov 2018 22:22:40 -0500 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 D1B842080D; Sat, 17 Nov 2018 17:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542474322; bh=6x4OsypFqLZD2F1LcmDqLP//eVnDUH0QmBGSAMWnoPM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qwT2pJIvrIuT3SzJsb7l5WosYp2tnNOOkZSGdIXg7U2Bksn3wd3w1F+9D1DUsmGMF cc80Zq8nKezLy9Z6QPoM8dx6L075QuYwvL6zBdm2st+lEzfyhiPHneJMg2k6UIKGDm xUFhxY8jlapN6ZDiWIqABKHXq5NpgQ22469GKMBA= Date: Sat, 17 Nov 2018 17:05:17 +0000 From: Jonathan Cameron To: Shreeya Patel Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/7] Staging: iio: adt7316: Add of_device_id table Message-ID: <20181117170517.29ebecdd@archlinux> In-Reply-To: <20181116225537.24723-1-shreeya.patel23498@gmail.com> References: <20181116225537.24723-1-shreeya.patel23498@gmail.com> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 17 Nov 2018 04:25:37 +0530 Shreeya Patel wrote: > When the kernel starts up, it kicks off compiled-in drivers > that match =E2=80=9Ccompatible=E2=80=9D entries it finds in the device tr= ee. > At a later stage (when /lib/modules is available), all kernel modules > that match =E2=80=9Ccompatible=E2=80=9D entries in the device tree are lo= aded. > Hence to be able to use device tree for ADT7316, add of_device_id > table which specifies the supported devices through compatible > property. > Note that there is a fall back path in i2c that will result > in i2c_device_id table being used if there is no of_devcie_id table. of_device_id Should also assign of_match_table in the driver structure so that we will use these to match when probing rather than just for module autoloading which is what this does. See for example drivers/adc/max1363.c Do not use of_match_ptr, just assign directly to avoid blocking the random ACPI probing with DT bindings route. This does make me wonder if the adt7518 is compatible or not as those are fairly random part numbers! Thanks, Jonathan >=20 > Signed-off-by: Shreeya Patel > --- > drivers/staging/iio/addac/adt7316-i2c.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) >=20 > diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/ii= o/addac/adt7316-i2c.c > index 473e5e34ec00..d4b5060c18ee 100644 > --- a/drivers/staging/iio/addac/adt7316-i2c.c > +++ b/drivers/staging/iio/addac/adt7316-i2c.c > @@ -126,6 +126,18 @@ static const struct i2c_device_id adt7316_i2c_id[] = =3D { > =20 > MODULE_DEVICE_TABLE(i2c, adt7316_i2c_id); > =20 > +static const struct of_device_id adt7316_of_match[] =3D { > + { .compatible =3D "adi,adt7316" }, > + { .compatible =3D "adi,adt7317" }, > + { .compatible =3D "adi,adt7318" }, > + { .compatible =3D "adi,adt7516" }, > + { .compatible =3D "adi,adt7517" }, > + { .compatible =3D "adi,adt7519" }, > + { }, > +}; > + > +MODULE_DEVICE_TABLE(of, adt7316_of_match); > + > static struct i2c_driver adt7316_driver =3D { > .driver =3D { > .name =3D "adt7316",