From patchwork Tue Jul 21 13:25:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 246746 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp2921468ilg; Tue, 21 Jul 2020 06:25:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye7J/WyO9Q2PorgZl/PvKdeHYak9QuhUab/kd9mi7UaTgz+SZrGfbKRoQWxqf0UYGtrRaf X-Received: by 2002:a17:906:824c:: with SMTP id f12mr22350082ejx.443.1595337943976; Tue, 21 Jul 2020 06:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595337943; cv=none; d=google.com; s=arc-20160816; b=LGj1UStPX+AkD6+yRiM09ubNgOKenAyehqgHDxfnDUY1WwfAPJ5RaqC9B5tgK6oYo2 h8dAMtH66q2JWR4cBK6m+deGfHKtFYuN1ABA2GiizMBWYEOJ/Sjer4OGavpB6Q69xucn qEc/gbsEs3b3gOLe6qKwbJ8TZVqEqC6TrSrs6xDI93Ay5u2X2iKRp+ZhospYlPLVAeYk E7jWDZTV+rtjo+/6oGVA72LU827OFgc65IK4zbVRxF6ML6E5WG/MuNstRIhq7t59V7C2 GQrLItx78hnH6uLGNKIEtsKOJacwO5Iezhe0KYoKoWXBtzgbp93tvMb13gklqjFtLKUD U0Ew== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=qi1ypQB3Wnir5aNUVAtZquwjxveKU/MTjZcze+t5MwY=; b=Xs4qLFIhhKBcSos4yK1O540gLg555nHgfmqwuBJnGb3HeNEbGEP2h07zIkVpmU59N6 iiAEwAYGZlkaSmjlDnZxuuTJK/dzDKMLjPKsuqFgACiW24M4anY451KagySn2kJcbtcj bKPd/YX3q2iQLfsLDX76DITo5w4CyuuiEj++8K9FKHayAV+PI/9TljT4F/D/G2vYnN3S iqEiSNrVGl53DLki1FwKdTNeoGX8XcH3Uk2JGA4TrW4vJGaTLL84bs4nu08WlJ8oSaqO sVfrDFLSZagLvpZMtcWWEyGZjwTeElBut4gSYykWybv+F5Io2eZ1PAIcuGOAv8KgZQMG o/WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z0IPKBN0; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j12si12449466ejy.723.2020.07.21.06.25.43; Tue, 21 Jul 2020 06:25:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-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=@linaro.org header.s=google header.b=z0IPKBN0; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727779AbgGUNZn (ORCPT + 5 others); Tue, 21 Jul 2020 09:25:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbgGUNZm (ORCPT ); Tue, 21 Jul 2020 09:25:42 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9295BC061794 for ; Tue, 21 Jul 2020 06:25:41 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id q4so24124999lji.2 for ; Tue, 21 Jul 2020 06:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qi1ypQB3Wnir5aNUVAtZquwjxveKU/MTjZcze+t5MwY=; b=z0IPKBN0w6cNOL178JY7Lkm334YsTcmVTX8mvm0v3OrEstCEF9Mis8Olyl06zUF5tQ CIMYQhJ93xPv8VBarcFQibOFkezJnHCd19Lr83lQw/KxCOBPrT1G2xiUx8l9fKMOqNMh ZemK3xowMLsN8ZOQzlOmtENIGdJCD9KDEvbo6z8A5sRQRAJDG62CAy8vLVbufi4eBkgo 1H6PQ4tLDo+mVCUoeEqdcKHI9gvs6L971qsBbgGfa66PNkgLq12REmF9Wpa6t45tnQRC rcr+CWgIjvKyMx+9FCGKECGqun2f3F/Rusr4EmTFSHRm8sqb9hTk4X6fzg0LmKt6oT6b Z15g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qi1ypQB3Wnir5aNUVAtZquwjxveKU/MTjZcze+t5MwY=; b=Zq5p4XVtYMSsI1twMtya0Kn6dqZWUVvrv0Uqp1h04zqk/njjx3d0gTy/GG+mfst/to QFeuEODA8TfiT+HpTZG/6YDWFY+4O+VqbxrlCRfxeRz7gDmkJxoo9LWEBB0+VaJtZPRW RZuI2y22eu70+rvyO5CaryIvnc41mt4MDm98begpgF1PVoBPt5DNoruPvhRqQEkPd7R4 5woy8xnSbFHIycKj1rjvzVB2Pjh37MzomYWEiBthIe82otiosaS0hKX1PeY2PTOQrruZ s7cgFlUHW39PTTJ/W8A9B6RrOPOKTzQ9VdBhq9cEzp6cWXAVeK+tng74JtQn3mXLYTUV 27Pw== X-Gm-Message-State: AOAM533xNdrT6xw3VXz9M1k2pwc7MBj2DN8YHvEoqTXcEvPSNCwWc6vJ MMFsX/7ejXHlmqctegn8qKFGrz8l9y0= X-Received: by 2002:a2e:2e07:: with SMTP id u7mr11943608lju.195.1595337939875; Tue, 21 Jul 2020 06:25:39 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id q3sm4432440ljm.22.2020.07.21.06.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 06:25:39 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Linus Walleij , Peter Rosin , Andrey Smirnov , Neil Armstrong Subject: [PATCH] pinctrl: sx150x: Use irqchip template Date: Tue, 21 Jul 2020 15:25:37 +0200 Message-Id: <20200721132537.362160-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Cc: Peter Rosin Cc: Andrey Smirnov Cc: Neil Armstrong Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-sx150x.c | 44 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) -- 2.26.2 Acked-by: Neil Armstrong diff --git a/drivers/pinctrl/pinctrl-sx150x.c b/drivers/pinctrl/pinctrl-sx150x.c index 708bc91862fe..b325a136ac48 100644 --- a/drivers/pinctrl/pinctrl-sx150x.c +++ b/drivers/pinctrl/pinctrl-sx150x.c @@ -1187,17 +1187,10 @@ static int sx150x_probe(struct i2c_client *client, if (pctl->data->model != SX150X_789) pctl->gpio.set_multiple = sx150x_gpio_set_multiple; - ret = devm_gpiochip_add_data(dev, &pctl->gpio, pctl); - if (ret) - return ret; - - ret = gpiochip_add_pin_range(&pctl->gpio, dev_name(dev), - 0, 0, pctl->data->npins); - if (ret) - return ret; - /* Add Interrupt support if an irq is specified */ if (client->irq > 0) { + struct gpio_irq_chip *girq; + pctl->irq_chip.irq_mask = sx150x_irq_mask; pctl->irq_chip.irq_unmask = sx150x_irq_unmask; pctl->irq_chip.irq_set_type = sx150x_irq_set_type; @@ -1213,8 +1206,8 @@ static int sx150x_probe(struct i2c_client *client, /* * Because sx150x_irq_threaded_fn invokes all of the - * nested interrrupt handlers via handle_nested_irq, - * any "handler" passed to gpiochip_irqchip_add() + * nested interrupt handlers via handle_nested_irq, + * any "handler" assigned to struct gpio_irq_chip * below is going to be ignored, so the choice of the * function does not matter that much. * @@ -1222,13 +1215,15 @@ static int sx150x_probe(struct i2c_client *client, * plus it will be instantly noticeable if it is ever * called (should not happen) */ - ret = gpiochip_irqchip_add_nested(&pctl->gpio, - &pctl->irq_chip, 0, - handle_bad_irq, IRQ_TYPE_NONE); - if (ret) { - dev_err(dev, "could not connect irqchip to gpiochip\n"); - return ret; - } + girq = &pctl->gpio.irq; + girq->chip = &pctl->irq_chip; + /* This will let us handle the parent IRQ in the driver */ + girq->parent_handler = NULL; + girq->num_parents = 0; + girq->parents = NULL; + girq->default_type = IRQ_TYPE_NONE; + girq->handler = handle_bad_irq; + girq->threaded = true; ret = devm_request_threaded_irq(dev, client->irq, NULL, sx150x_irq_thread_fn, @@ -1237,12 +1232,17 @@ static int sx150x_probe(struct i2c_client *client, pctl->irq_chip.name, pctl); if (ret < 0) return ret; - - gpiochip_set_nested_irqchip(&pctl->gpio, - &pctl->irq_chip, - client->irq); } + ret = devm_gpiochip_add_data(dev, &pctl->gpio, pctl); + if (ret) + return ret; + + ret = gpiochip_add_pin_range(&pctl->gpio, dev_name(dev), + 0, 0, pctl->data->npins); + if (ret) + return ret; + return 0; }