Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10890104rwp; Fri, 21 Jul 2023 06:31:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlEI9bURjOHvtiFRBBJMIPNvZO8NQQ29nxTMYij8nKTjkGFtGxIm68YyEXP96skPlQ5N71SA X-Received: by 2002:a17:906:3115:b0:994:539d:f97f with SMTP id 21-20020a170906311500b00994539df97fmr1607937ejx.37.1689946318893; Fri, 21 Jul 2023 06:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689946318; cv=none; d=google.com; s=arc-20160816; b=oT7vk/gl2S4/to2P7fqsRsyOV37Op99j2beoP1drYR7bVV9x5DYgbN730k3Up0IbnM JhllvTdKl01JGIHrhHwrI3elAKAccyLWJ966FYw4SCcAyJWUWqzOWf6TNeOZBS9KJLGO 8jOKZOQN4+mn0e4KRtKWmDpuM3csgSAzoSEFt1WbHQ5Lxelx47qZ667rz5turmdktoGh Pr8jdGNc6wtKxgTtIrj02UcCqTDDRB16M6rC2mIbsgUQDKIkuzo5D11I2zLAjFRxPc3V 4Hjk8K/Gh2A9hF93ncbh1mBNX+MuayT80iVrHg0lQl1GPSOGuOZU/T0vLODk6/u6HH4e UzfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=HXWow9N5YrY+JaQID+WAjVzVYr7r+nAXsgXVDHysF3Q=; fh=thJwGOIztJkBzixU3MCKh5ZXDkYcRa6EV7s504ufYIw=; b=oNbjlXhnC82XQt+mkyW6eoOorL7z9dc56SgZXwObNB+J24fM8SS1I1KYejIB/fsqhN qTqSCzTg0971ncA7yTTBpuA1kMz8WXjRpKpsGIE3kprJG/Z0vUHsMgMjVwf/sHbOsqdw /4h4oo58iGTNlaI5HJSlLfkVssvMscz43OAuLBfSuYOXpIvHSHb/XeGMyMrgIgby7cMR oaJ7/XY/btXkfijz9/nqPApP0j9cMvu37/hrzk8ryAoGligq1Jt8FHArGcgtIth57+/l +bmRvUhQbw7t4zwJc83a8AzABx6bIsmZ1JdcdRXHJHMFwFnbT+w5Ff+rWIyyuN2tNZgV xKEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l15-20020a170906078f00b00992d6e88081si2162621ejc.956.2023.07.21.06.31.31; Fri, 21 Jul 2023 06:31:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230443AbjGUNTZ (ORCPT + 99 others); Fri, 21 Jul 2023 09:19:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230404AbjGUNTV (ORCPT ); Fri, 21 Jul 2023 09:19:21 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F4463595; Fri, 21 Jul 2023 06:19:09 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="347313899" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="347313899" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2023 06:19:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="702053539" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="702053539" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga006.jf.intel.com with ESMTP; 21 Jul 2023 06:18:54 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qMq1x-005vpD-13; Fri, 21 Jul 2023 16:18:49 +0300 Date: Fri, 21 Jul 2023 16:18:49 +0300 From: Andy Shevchenko To: nikita.shubin@maquefel.me Cc: Hartley Sweeten , Lennert Buytenhek , Alexander Sverdlin , Russell King , Lukasz Majewski , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd , Daniel Lezcano , Thomas Gleixner , Alessandro Zummo , Alexandre Belloni , Wim Van Sebroeck , Guenter Roeck , Sebastian Reichel , Thierry Reding , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Mark Brown , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Vinod Koul , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Damien Le Moal , Sergey Shtylyov , Dmitry Torokhov , Arnd Bergmann , Olof Johansson , soc@kernel.org, Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Michael Peters , Kris Bahnsen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-rtc@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-pm@vger.kernel.org, linux-pwm@vger.kernel.org, linux-spi@vger.kernel.org, netdev@vger.kernel.org, dmaengine@vger.kernel.org, linux-mtd@lists.infradead.org, linux-ide@vger.kernel.org, linux-input@vger.kernel.org, alsa-devel@alsa-project.org Subject: Re: [PATCH v3 01/42] gpio: ep93xx: split device in multiple Message-ID: References: <20230605-ep93xx-v3-0-3d63a5f1103e@maquefel.me> <20230605-ep93xx-v3-1-3d63a5f1103e@maquefel.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230605-ep93xx-v3-1-3d63a5f1103e@maquefel.me> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 20, 2023 at 02:29:01PM +0300, Nikita Shubin via B4 Relay wrote: > From: Nikita Shubin > > This prepares ep93xx SOC gpio to convert into device tree driver: > - dropped banks and legacy defines > - split AB IRQ and make it shared > > We are relying on IRQ number information A, B ports have single shared > IRQ, while F port have dedicated IRQ for each line. > > Also we had to split single ep93xx platform_device into multiple, one > for each port, without this we can't do a full working transition from > legacy platform code into device tree capable. All GPIO_LOOKUP were > change to match new chip namings. ... > -static void ep93xx_gpio_ab_irq_handler(struct irq_desc *desc) > +static u32 ep93xx_gpio_ab_irq_handler(struct gpio_chip *gc) > { > - struct gpio_chip *gc = irq_desc_get_handler_data(desc); > - struct ep93xx_gpio *epg = gpiochip_get_data(gc); > - struct irq_chip *irqchip = irq_desc_get_chip(desc); > + struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc); > unsigned long stat; > int offset; > > - chained_irq_enter(irqchip, desc); > - > - /* > - * Dispatch the IRQs to the irqdomain of each A and B > - * gpiochip irqdomains depending on what has fired. > - * The tricky part is that the IRQ line is shared > - * between bank A and B and each has their own gpiochip. > - */ > - stat = readb(epg->base + EP93XX_GPIO_A_INT_STATUS); > + stat = readb(eic->base + EP93XX_INT_STATUS_OFFSET); > for_each_set_bit(offset, &stat, 8) > - generic_handle_domain_irq(epg->gc[0].gc.irq.domain, > - offset); > + generic_handle_domain_irq(gc->irq.domain, offset); > > - stat = readb(epg->base + EP93XX_GPIO_B_INT_STATUS); > - for_each_set_bit(offset, &stat, 8) > - generic_handle_domain_irq(epg->gc[1].gc.irq.domain, > - offset); > + return stat; > +} > > - chained_irq_exit(irqchip, desc); > +static irqreturn_t ep93xx_ab_irq_handler(int irq, void *dev_id) > +{ > + return IRQ_RETVAL(ep93xx_gpio_ab_irq_handler(dev_id)); > } > > static void ep93xx_gpio_f_irq_handler(struct irq_desc *desc) > { > - /* > - * map discontiguous hw irq range to continuous sw irq range: > - * > - * IRQ_EP93XX_GPIO{0..7}MUX -> EP93XX_GPIO_LINE_F{0..7} > - */ > struct irq_chip *irqchip = irq_desc_get_chip(desc); > - unsigned int irq = irq_desc_get_irq(desc); > - int port_f_idx = (irq & 7) ^ 4; /* {20..23,48..51} -> {0..7} */ > - int gpio_irq = EP93XX_GPIO_F_IRQ_BASE + port_f_idx; > + struct gpio_chip *gc = irq_desc_get_handler_data(desc); > + struct gpio_irq_chip *gic = &gc->irq; > + unsigned int parent = irq_desc_get_irq(desc); > + unsigned int i; > > chained_irq_enter(irqchip, desc); > - generic_handle_irq(gpio_irq); > + for (i = 0; i < gic->num_parents; i++) > + if (gic->parents[i] == parent) > + break; > + > + if (i < gic->num_parents) > + generic_handle_irq(irq_find_mapping(gc->irq.domain, i)); Can we use generic_handle_domain_irq(gc->irq.domain, i); here as well? > chained_irq_exit(irqchip, desc); > } ... > - int offset = d->irq & 7; > + int offset = irqd_to_hwirq(d); irq_hw_number_t ? > irq_flow_handler_t handler; ... > + int ret, irq, i = 0; What do you need this assignment for? ... > + ret = devm_request_irq(dev, irq, > + ep93xx_ab_irq_handler, It can be located on the previous line. > + IRQF_SHARED, gc->label, gc); > + if (ret) > + return dev_err_probe(dev, ret, "error requesting IRQ : %d\n", irq); Drop duplicating word 'error' in the message. Space is not needed before colon. ... > + /* TODO: replace with handle_bad_irq once we are fully hierarchical */ To be pedantic: handle_bad_irq() > + gc->label = dev_name(&pdev->dev); > + if (platform_irq_count(pdev) > 0) { > + dev_dbg(&pdev->dev, "setting up irqs for %s\n", dev_name(&pdev->dev)); > + ret = ep93xx_setup_irqs(pdev, egc); > + if (ret) > + dev_err(&pdev->dev, "setup irqs failed for %s\n", dev_name(&pdev->dev)); What's the point to print dev name twice? Esp. taking into account gc->label assignment above. Why not use dev_err_probe() to unify the format of the messages from ->probe()? -- With Best Regards, Andy Shevchenko