From patchwork Fri Jul 17 14:40:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 235711 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1764933ilg; Fri, 17 Jul 2020 07:40:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWax3U6qI3BKeXW0poPOSQUy8fWh4Gof5Hc1cyuylA2Rlh4hWHcqn7tZhisHXSgul/DvSx X-Received: by 2002:aa7:c6d1:: with SMTP id b17mr9729872eds.201.1594996846933; Fri, 17 Jul 2020 07:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594996846; cv=none; d=google.com; s=arc-20160816; b=poX2h3u8X88hin/DsilqK1+Q4r7bFbaQ91STIFiUwQZC8e0ke4jzM68ncn96FuI1SJ g/fq7KL61Tvmd5lTbqOR6maDTyL54MongZpzUjvE7eLrVV/Alqw3fB4C20BuKb6x/f0B W8ah5FZMBNa/AsHA+NxXZUH/FbJ4e6sZ5/79ZlyczUcNhxy7XgGl+i4Ae4CYfeEn1Jf+ Ici24Nr9gXF9Om5PZUWuf0wNQ1+S1TWWUh1PBCtkgWyIWe+DNFez7pu1yh5v9SWEKUvO /OoAizAxL6Kyvu2RDBfG8IZUYIZdfWk8ECd5YFCT6q+gUG1TJDjoNLK7WqUXy53MFpG3 hpvw== 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=eI2tzzBD0mcrBgHP0gckQxxsg/KqXE0va6uJcXDlZ8k=; b=IcGEno9KqLY7S9WJII3xe3JaVVJShroyeIFaONXltwvdnjjbNLblZT9vmNBpRALQaz K+XNuH3oD7trtcp9qJ4Fjb2da6eI/vmCK/FeD2L5fDUZMpcPqq/z4An5NdjFf8Utn9wA k1+RzIiN3VgYS70uWnJ9P3jvn5KQG7xjwshSR+dlQTd2nOAryNPWbw5SyMDU0Tk97fiY TfD+WDOArY7EqbRrliRxMjUp3H/klSAusR02crNuIVlMeEyUMpuEl78dHkk+F2B2F93M +BV5q5TlXaQ/aT9JlfycWI8Qdl+rrUbUOurUir0IiRKZqEDS1pggTnyxwCZB433Tmq7h Vg8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wKllrF9l; 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 h16si5226061edz.526.2020.07.17.07.40.46; Fri, 17 Jul 2020 07:40:46 -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=wKllrF9l; 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 S1726817AbgGQOkq (ORCPT + 5 others); Fri, 17 Jul 2020 10:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726811AbgGQOkp (ORCPT ); Fri, 17 Jul 2020 10:40:45 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47AAEC0619D2 for ; Fri, 17 Jul 2020 07:40:45 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id b25so12956149ljp.6 for ; Fri, 17 Jul 2020 07:40:45 -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=eI2tzzBD0mcrBgHP0gckQxxsg/KqXE0va6uJcXDlZ8k=; b=wKllrF9l3VCHeqRJZ+VTBINNNexRGRxs/I0PMY41ZAIlB5jFU5j2SqOZzI164Kcp9l WzHkvrcvV5AFzzJxf8JwUU8hsWDu6nZQtab89BSUspMAyCufB+LmFQHj3zq6l/TyRjoO ajMigsLHqVuauPklTnZ+nt7wCySrqhpHW7dvNsjByzLz5FSFbKVZ6MuRMWDUJs6hlLg+ FUtBTcS/9UBHPvTLG1dVFrJePXewaztClnRlxjwBJlklwSJqSKzJ3QbS2F3azFzGcX14 ovchhboGtuZTBVhZCjt2phY/f2m5xqT6pa+3gmrmFuvcZze3560LqrFRBSAh9PbRUqmb Rk8g== 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=eI2tzzBD0mcrBgHP0gckQxxsg/KqXE0va6uJcXDlZ8k=; b=SmjdYER1UesBJBwpTaIoRD0HDKTHe99pnDMXGSx0rrRYB7REYuNShalwmLOOzVKgAK Ni9SR/sq9OsInwzw5EbFr3kQ/IdQulkCRDSomd/9RWu2NKddXsXpTKxoctVF11kMABGA vJeuGmmLVoeHzoOXJufYB0qyxvX4zQP0mTQr6o669ZOTRfkXLhGKThKLzRpiZ6JSuzzi A+ETal6dmrJyRgpWMGbwTfbDpTKt/RLktjvhaV3LVo6r3E5X8VEJEY2W020u7nP6d6Gt fSGgBH/9+7CEaKTd4g4Ach4L8ZXSjx12Kub5vdPY+QUtmsOAWpbyryP8rFgw8sRBIqSe K69g== X-Gm-Message-State: AOAM530visBF0iDyKw+RM7ZXQUbeHV/KtZzaOnz8VEiAneHMXwlBY8f8 dmOrsrx+e+ZHZtyZC9wPKsYXl8bWhC0= X-Received: by 2002:a2e:858e:: with SMTP id b14mr4931013lji.301.1594996843336; Fri, 17 Jul 2020 07:40:43 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id q3sm1683454ljm.22.2020.07.17.07.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 07:40:42 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Bartosz Golaszewski , Linus Walleij , Andy Shevchenko , Marek Vasut , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Adam Ford , Vignesh Raghavendra Subject: [PATCH] gpio: pca953x: Use irqchip template Date: Fri, 17 Jul 2020 16:40:40 +0200 Message-Id: <20200717144040.63253-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: Andy Shevchenko Cc: Marek Vasut Cc: Uwe Kleine-König Cc: Adam Ford Cc: Vignesh Raghavendra Signed-off-by: Linus Walleij --- drivers/gpio/gpio-pca953x.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 2.26.2 Reviewed-by: Andy Shevchenko Tested-by: Andy Shevchenko diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 9c90cf3aac5a..ab22152bf3e8 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -834,6 +834,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base) struct irq_chip *irq_chip = &chip->irq_chip; DECLARE_BITMAP(reg_direction, MAX_LINE); DECLARE_BITMAP(irq_stat, MAX_LINE); + struct gpio_irq_chip *girq; int ret; if (dmi_first_match(pca953x_dmi_acpi_irq_info)) { @@ -883,16 +884,16 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base) irq_chip->irq_set_type = pca953x_irq_set_type; irq_chip->irq_shutdown = pca953x_irq_shutdown; - ret = gpiochip_irqchip_add_nested(&chip->gpio_chip, irq_chip, - irq_base, handle_simple_irq, - IRQ_TYPE_NONE); - if (ret) { - dev_err(&client->dev, - "could not connect irqchip to gpiochip\n"); - return ret; - } - - gpiochip_set_nested_irqchip(&chip->gpio_chip, irq_chip, client->irq); + girq = &chip->gpio_chip.irq; + girq->chip = 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_simple_irq; + girq->threaded = true; + girq->first = irq_base; /* FIXME: get rid of this */ return 0; } @@ -1080,11 +1081,11 @@ static int pca953x_probe(struct i2c_client *client, if (ret) goto err_exit; - ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip); + ret = pca953x_irq_setup(chip, irq_base); if (ret) goto err_exit; - ret = pca953x_irq_setup(chip, irq_base); + ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip); if (ret) goto err_exit;