Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2124205ybg; Fri, 5 Jun 2020 06:17:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz234VaCgH9Df2UEmoak6jcCamU8+k/pxQtzSBrFipyb05KmquYjK4OqoXR5oe6ZIpJqbuE X-Received: by 2002:a17:906:2484:: with SMTP id e4mr9156396ejb.155.1591363058317; Fri, 05 Jun 2020 06:17:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591363058; cv=none; d=google.com; s=arc-20160816; b=b5hg1rCQTbtMLkiB83eawWesLxjg5KrUadeE8oxo3+xHCCIceZ9dONRqWxImjP3ULC ycLWrzTRIYCwElfSkaWe6IY8zjm6nSyS5Ac7iV98NqxHySLdlXcLivqV5EWH97BdZsvG lMQ9zpfIMGppr5ofsdhKfqhyD6cEcVA41DxkIeh4dSsto+h7zXH1KNP5LKQ546R/H/Eq YbEg5GowUm9RIL6+vXzM2QFhfT3leWwgbW4Dc78Iu8HEiC0wCvrL+9FkOpZQVf6IVR3q nzuhVpxk1FOqigasL9iurnpeIy08njLejhoPvFfnmWlIR51zzQBKfwaMAAvmF6LOiSod ohGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=h9TZkOJoK1ZpdMK7W5xE1V0kdkjDguQBJs3y2WIN9jQ=; b=hL5FTAJoAzZ5bOKXuKB2qS0whco6YYnKib9afNrGZd4izNQJ0CFd8keNSB9UjbXpQh cJzU5M8Sjwad7PpLEq2jr/Qbo1TKp4UO/qipHlU1a3pDmFRjOCB4dFMWz9jIsTanR4QG QAmDuVeiJc+Sm656ZUwvuNw2Nn2zQ56UOUoUeZUd9/aIaLuNrT/SEKNZeOVZPwMYbVXg s65RVEm+7BioGzK4pV7MwghqyMgVJj9/ZDABp5cQXVuzTqzg2a/QizVEtEjpt32b/SE2 YQAp24tD2uMaG+x7khJxVMpMZePNaV+nfE3CwA3p4VtaEklN0wDOJp9MmhgKEvu7nFy2 ad1A== ARC-Authentication-Results: i=1; mx.google.com; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si3705702edl.533.2020.06.05.06.17.15; Fri, 05 Jun 2020 06:17:38 -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; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726899AbgFENPa (ORCPT + 99 others); Fri, 5 Jun 2020 09:15:30 -0400 Received: from mga07.intel.com ([134.134.136.100]:61808 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbgFENP3 (ORCPT ); Fri, 5 Jun 2020 09:15:29 -0400 IronPort-SDR: hDay6+sP/Xbm6Cdru3WbeELqAe9tguzQLXjLNKS916hDlpki4t4fO5K+EXJblEEuU+4DW3j+hd YghXPkuZ7upw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2020 06:15:28 -0700 IronPort-SDR: 8z64UIpITHvnMyk+hpzKUgfEq+GlBhraZiuh97RJehWFeDVXSXsoR2BA/l3B/XSSk2a/rUPVZY 91vGmgg9lXIA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,476,1583222400"; d="scan'208";a="258028176" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga007.fm.intel.com with ESMTP; 05 Jun 2020 06:15:23 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jhCBx-00B2CL-6c; Fri, 05 Jun 2020 16:15:25 +0300 Date: Fri, 5 Jun 2020 16:15:25 +0300 From: Andy Shevchenko To: Michael Walle 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 , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , 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 Message-ID: <20200605131525.GK2428291@smile.fi.intel.com> References: <20200604211039.12689-1-michael@walle.cc> <20200604211039.12689-7-michael@walle.cc> <216db3154b46bd80202873df055bb3f3@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <216db3154b46bd80202873df055bb3f3@walle.cc> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > > 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. ... > > > + 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. > > > + 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 :-) ... > > > + .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. -- With Best Regards, Andy Shevchenko