Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1630038ybz; Sat, 18 Apr 2020 05:12:20 -0700 (PDT) X-Google-Smtp-Source: APiQypKh5AMefiJHtWNfMWa1Ed9Bc8YpnFlJNICtRQwDa2p+U6ahiaEX94Rlpa3yho1BEpf8/uTG X-Received: by 2002:a50:fe05:: with SMTP id f5mr6808178edt.338.1587211940093; Sat, 18 Apr 2020 05:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587211940; cv=none; d=google.com; s=arc-20160816; b=SiwHeKchjzpW50fbNdEYDgfTcgJimGv9LjLovwL+5MGfvBXkSYpvrATiGhubdLydiw vdTExwfu0ffYm32COGqC5S04hUACZ3GYga4qMwMGBxE39ONlLlNwHulJmJSicvNmCAE5 jTL9RQdLtX0q2UxCEawEWZyC3HMVt5gRFc9CHbZpEYuO6qE7P304j1rkxg3tJ6wRLxl+ fBtU8PSa+19PSl8adBUYPPcAy2hW6gRHvm2xVHBKOUo9rOyFP5benybtWUJSGmGiRANc WzF9MZdKBp2IowS1Yn8wBmWTlYMvi5YfXywwGAsXW6f/MoeXRt030Z92zDIZx/dDTLNa FEHA== 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:cc:to:subject:from:date :dkim-signature; bh=W8uyfORoWpoopNQAQRiFt0F12jT9ut5sphQKhCFCQnI=; b=Q3D/A8VwD0swAOOvlLof95vGuUTlVgKswwp9lCnd/spbdkcN7cq712CwUlz5RQ8/En +FpP00OIbWugZxgIbE5xibvNCZFePR923OJLGG9r99HT69YJWx+D4b0DG0xgv6mlNHsw YHtclaZ/dsSPAs94qjoKVr4rhADZpkTGycOxDm/Nm38yryQokYOuA19F/qirkYYqb3+2 XXLm+xeex30ZpmbktWg9f1rXSZqIi2LcTaU3kkihk0vJY/nAfdpXdjfsDcSxQin5ojJj ayb5XQlJCeJ1ZI59gNI3C1Eoh1q6e3MkwmQPAUVO2lScqFP2m6Wn9Y8DZHhdXfPPWvoi FWvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=GnQ9Xu4N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d23si16592679ejd.506.2020.04.18.05.11.57; Sat, 18 Apr 2020 05:12:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=GnQ9Xu4N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725982AbgDRMK2 (ORCPT + 99 others); Sat, 18 Apr 2020 08:10:28 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:60176 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725873AbgDRMK1 (ORCPT ); Sat, 18 Apr 2020 08:10:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1587211824; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W8uyfORoWpoopNQAQRiFt0F12jT9ut5sphQKhCFCQnI=; b=GnQ9Xu4NTvPUquR8iR0VIKLtACsC6IM+aIypTrEzV5CVG1YA9XS7UYVNec1wHO8ZKdcTBK 9jiuRA7KEcZet3Im5oH5sODW8CWKMPTHaQfOuCf/FqwNTQNly/9hTNGk47WsflgImO0Ob/ xS7TkvnoGiiaz2OKA8kw9JfZek7dLyk= Date: Sat, 18 Apr 2020 14:10:12 +0200 From: Paul Cercueil Subject: Re: [RESEND PATCH v5 5/5] input: joystick: Add ADC attached joystick driver. To: Andy Shevchenko Cc: Artur Rojek , Dmitry Torokhov , Rob Herring , Mark Rutland , Jonathan Cameron , Heiko Stuebner , linux-input , devicetree , linux-iio , Linux Kernel Mailing List Message-Id: <0HGZ8Q.TO6FK92GVGIN3@crapouillou.net> In-Reply-To: References: <20200417202859.35427-1-contact@artur-rojek.eu> <20200417202859.35427-5-contact@artur-rojek.eu> <7CFY8Q.68YMS0V08F992@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le sam. 18 avril 2020 =E0 14:57, Andy Shevchenko=20 a =E9crit : > On Sat, Apr 18, 2020 at 1:48 AM Paul Cercueil =20 > wrote: >>=20 >>=20 >>=20 >> Le sam. 18 avril 2020 =E0 0:49, Andy Shevchenko >> a =E9crit : >> > On Sat, Apr 18, 2020 at 12:24 AM Paul Cercueil=20 >> >> > wrote: >> >> Le sam. 18 avril 2020 =E0 0:10, Andy Shevchenko >> >> a =E9crit : >> >> > On Fri, Apr 17, 2020 at 11:21 PM Artur Rojek >> >> >> >> > wrote: >> > >> > ... >> > >> >> >> +#include >> >> > >> >> > Do you really need this? (See below as well) >> > >> >> >> +static const struct of_device_id adc_joystick_of_match[] =3D=20 >> { >> >> >> + { .compatible =3D "adc-joystick", }, >> >> >> + { }, >> >> >> +}; >> >> >> +MODULE_DEVICE_TABLE(of, adc_joystick_of_match); >> >> >> + >> >> >> +static struct platform_driver adc_joystick_driver =3D { >> >> >> + .driver =3D { >> >> >> + .name =3D "adc-joystick", >> >> > >> >> >> + .of_match_table =3D >> >> >> of_match_ptr(adc_joystick_of_match), >> >> > >> >> > Drop this a bit harmful of_match_ptr() macro. It should go=20 >> with >> >> ugly >> >> > #ifdeffery. Here you simple introduced a compiler warning. >> >> >> >> I assume you mean #ifdef around the of_device_id + module table >> >> macro? >> > >> > Yes. >> > >> >> > On top of that, you are using device property API, OF use in=20 >> this >> >> case >> >> > is contradictory (at lest to some extend). >> >> >> >> I don't see why. The fact that the driver can work when probed=20 >> from >> >> platform code >> > >> > Ha-ha, tell me how. I would like to be very surprised. >>=20 >> iio_map_array_register(), >> pinctrl_register_mappings(), >> platform_add_devices(), >>=20 >> you're welcome. >=20 > I think above has no relation to what I'm talking about. Yes it does. It allows you to map the IIO channels, set the pinctrl=20 configurations and register a device from platform code instead of=20 devicetree. > How *this* driver can work as a platform instantiated one? > We seems have a conceptual misunderstanding here. >=20 > For example, how can probe of this driver not fail, if it is not > backed by a DT/ACPI properties? platform_device_add_properties(). >=20 >> >> doesn't mean that it shouldn't have a table to probe >> >> from devicetree. >> > >> > I didn't get what you are talking about here. The idea of=20 >> _unified_ >> > device property API is to get rid of OF-centric code in favour of=20 >> more >> > generic approach. Mixing those two can be done only in specific=20 >> cases >> > (here is not the one). >>=20 >> And how are we mixing those two here? The only OF-centric thing=20 >> here is >> the device table, which is required if we want the driver to probe=20 >> from >> devicetree. >=20 > Table is fine(JFYI the types and sections are defined outside of OF > stuff, though being [heavily] used by it) , API (of_match_ptr() macro > use) is not. Sorry, but that's just stupid. Please have a look at how of_match_ptr()=20 macro is defined in . -Paul