Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2357404ybg; Fri, 5 Jun 2020 11:47:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJWsJYpGUG+qFwOGcn308+kdeifh3+2o701nbQRBCce5B6mG1u0slB9nQ5EpdMZ+fapF/K X-Received: by 2002:a50:fc04:: with SMTP id i4mr10409178edr.117.1591382828362; Fri, 05 Jun 2020 11:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591382828; cv=none; d=google.com; s=arc-20160816; b=BH8AA2Y8/e8CjxlRqY9qtJGrvQEeLlRTPN0pwv/vWAlzsnwdmAm0qDhWTTqcyR8x7V Fm9DvRpAeIBQsntWflBYzq2/PtmrYS95UfhKHJhzwLXwZvg80gBDCg0chypKjn3PCkA6 nhyMmbE6ovk7WN+p4aIof2BEGWhKJPxrut5Ce732zcndKT1HCxAtcNJlPdjjQgMUOhMt ZchW7qpj/bFkP6GKRh6DK8fDhghprOkTcXyWIZilL7CwesZpczuKUlAcayZMaAolNwOr tuh3abb8eU5bMskNAKrXuGr+2Dg1EnxmjpkX05TxHOMvvhV/H8Rta3msg3TF04ZAE8JE jrjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=YRXENm/x2WRLoyAXS0BfjnJoOn+fwaDtXQJ9FoOZsLA=; b=gC6U7WcEaiX435KEELTuW9r6BQzI15sjWwxxmgk6KVl1HH6tY3caeGqinpG/SWZSbD TwgHlEQM0CvF8nkWFGUiuPeH11eD51bSwCdYyBHPtQs4WHvBTbi6gT2UXqYoJ3+/8+Jd ZatKthJRuqWBj3DFOqMVk/n55emjlC+I8kEgn3hM0qqoUDRvaMn13AntklcEiKMcWvCv gGysrPvaS23Q0yiaIe8jtSEa4EKAfcfSqUYaki2WyS+MkLtoGOqhwGHluU86N9eH4UJo vdVjtmLlZC0iVl5FrsH2HpX65qa7G+9NCyG4A4ipPg4IS5Bsi4ihpwViD5IdotiP1tsW m9jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b="j0Eus+/W"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a7si4129312ejx.184.2020.06.05.11.46.44; Fri, 05 Jun 2020 11:47:08 -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=pass header.i=@walle.cc header.s=mail2016061301 header.b="j0Eus+/W"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727081AbgFESo4 (ORCPT + 99 others); Fri, 5 Jun 2020 14:44:56 -0400 Received: from ssl.serverraum.org ([176.9.125.105]:54305 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726077AbgFESo4 (ORCPT ); Fri, 5 Jun 2020 14:44:56 -0400 Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id D4F3122FEB; Fri, 5 Jun 2020 20:44:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1591382693; h=from:from: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=YRXENm/x2WRLoyAXS0BfjnJoOn+fwaDtXQJ9FoOZsLA=; b=j0Eus+/W8QMEAKZ/SsmQb0kD+m3/XjNNl0Ufda7uFq9odKfuAWBB0W5v8SY60Q1bF9vcpo 3dLqeh4xxOffGdO2kS4EOmwn50MCn0MU8NYl8Kzc+MvIKFbpci3tRwsSDkQdqSIrU3phYb jaddnH0/bDjBanv1kCnlJbG0xT/VxY0= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 05 Jun 2020 20:44:52 +0200 From: Michael Walle To: Andy Shevchenko Cc: "open list:GPIO SUBSYSTEM" , devicetree , Linux Kernel Mailing List , linux-hwmon@vger.kernel.org, linux-pwm@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-arm Mailing List , Linus Walleij , Bartosz Golaszewski , Rob Herring , Jean Delvare , Guenter Roeck , Lee Jones , Thierry Reding , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Wim Van Sebroeck , Shawn Guo , Li Yang , Thomas Gleixner , Jason Cooper , Marc Zyngier , Mark Brown , Greg Kroah-Hartman Subject: Re: [PATCH v4 06/11] gpio: add support for the sl28cpld GPIO controller In-Reply-To: <20200605131525.GK2428291@smile.fi.intel.com> References: <20200604211039.12689-1-michael@walle.cc> <20200604211039.12689-7-michael@walle.cc> <216db3154b46bd80202873df055bb3f3@walle.cc> <20200605131525.GK2428291@smile.fi.intel.com> User-Agent: Roundcube Webmail/1.4.4 Message-ID: X-Sender: michael@walle.cc Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 2020-06-05 15:15, schrieb Andy Shevchenko: > On Fri, Jun 05, 2020 at 02:42:53PM +0200, Michael Walle wrote: >> Am 2020-06-05 14:00, schrieb Andy Shevchenko: >> > On Fri, Jun 5, 2020 at 12:14 AM Michael Walle wrote: > >> > > + return devm_regmap_add_irq_chip_np(dev, dev_of_node(dev), >> > > regmap, >> > >> > It seems regmap needs to be converted to use fwnode. >> >> Mhh, this _np functions was actually part of this series in the >> beginning. > > Then, please, make them fwnode aware rather than OF centric. ok > >> > > IRQF_ONESHOT, 0, >> > > + irq_chip, &gpio->irq_data); > > ... > >> > > + dev_id = platform_get_device_id(pdev); >> > > + if (dev_id) >> > > + type = dev_id->driver_data; >> > >> > Oh, no. In new code we don't need this. We have facilities to provide >> > platform data in a form of fwnode. >> >> Ok I'll look into that. >> >> But I already have a question, so there are of_property_read_xx(), >> which >> seems to be the old functions, then there is device_property_read_xx() >> and >> fwnode_property_read_xx(). What is the difference between the latter >> two? > > It's easy. device_*() requires struct device to be established for > this, so, > operates only against devices, while the fwnode_*() operates on pure > data which > might or might not be related to any devices. If you understand OF > examples > better, consider device node vs. child of such node. Ahh thanks, got it. > > ... > >> > > + if (irq_support && >> > >> > Why do you need this flag? Can't simple IRQ number be sufficient? >> >> I want to make sure, the is no misconfiguration. Eg. only GPIO >> flavors which has irq_support set, have the additional interrupt >> registers. > > In gpio-dwapb, for example, we simple check two things: a) hardware > limitation > (if IRQ is assigned to a proper port) and b) if there is any IRQ comes > from DT, > ACPI, etc. I can't follow you here. irq_support is like your (a); or the "pp->idx == 0" in your example. >> > > + device_property_read_bool(&pdev->dev, >> > > "interrupt-controller")) { >> > > + irq = platform_get_irq(pdev, 0); >> > > + if (irq < 0) >> > > + return irq; >> > > + >> > > + ret = sl28cpld_gpio_irq_init(&pdev->dev, gpio, regmap, >> > > + base, irq); >> > > + if (ret) >> > > + return ret; >> > > + >> > > + config.irq_domain = >> > > regmap_irq_get_domain(gpio->irq_data); >> > > + } > > ... > >> > > + { .compatible = "kontron,sl28cpld-gpio", >> > > + .data = (void *)SL28CPLD_GPIO }, >> > > + { .compatible = "kontron,sl28cpld-gpi", >> > > + .data = (void *)SL28CPLD_GPI }, >> > > + { .compatible = "kontron,sl28cpld-gpo", >> > > + .data = (void *)SL28CPLD_GPO }, >> > >> > All above can be twice less LOCs. >> >> They are longer than 80 chars. Or do I miss something? > > We have 100 :-) oh come on, since 6 days *g* >> > > + .name = KBUILD_MODNAME, >> > >> > This actually not good idea in long term. File name can change and break >> > an ABI. >> >> Ahh an explanation, why this is bad. Ok makes sense, although to be >> fair, >> .id_table should be used for the driver name matching. I'm not sure if >> this is used somewhere else, though. > > I saw in my practice chain of renames for a driver. Now, if somebody > somewhere would like to instantiate a platform driver by its name... > Oops, ABI breakage. > > And of course using platform data for such device makes less sense. i just removed the id_table from all drivers anyways. -michael