Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1836753imu; Sat, 8 Dec 2018 08:13:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/VrK8sSDtErJQReG8VD1dq3u5Oq1JjnN1HlC04Fa6LhVGgZ3MoRssZz27HgJeamKKMt2s1T X-Received: by 2002:a63:4187:: with SMTP id o129mr5123442pga.370.1544285582486; Sat, 08 Dec 2018 08:13:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544285582; cv=none; d=google.com; s=arc-20160816; b=A4mmEOAKP6VhwLnGXikct92BYnl9VRtvl/29UOvwGSoOd8PNfsDwYYzcwwq2buflTP U1oQJPx12X7uXK2SPQJxp1ncBKI4n146BV52WYTGichrL2wD9LRdi96HyffPy/6iRn2b PX5uwvZl2VZ7078c9iiwnRC8XE3YeBJ4t9mbxdaqw9rtVkMY+osbLA8NUysPfZna9hZu zHqeDShVtVvSfLOZ+FUfYmA2raEjXVFdi5X0GGwAYqAGIkQsEKmn4n0apPAmZdVw0eaP 0AUEkV7FBszDrGKinL1hnDXdlWEorjvyGcFTzPCUnhRx3ve42pH88qqi5Nb2aW6lwwZ/ g8wA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=RzI8dalricTzemjzm16uPAkb9kikC0u/cW8Fo2KK9P8=; b=f7EDUUr3of5lWeWWuSZNoda11KAGg97moz6wMvH3yH2Q4V3YX+tXtlzcM4McmYVA41 oJsNmzKq3ASoDUJFqPaEMZoQ5+9fUXGqYBBMWxJyo3T/5k6jru5vYR9qqltmnSJLG/LA Ll5Z32cqu0bOSBNziRpBK4gAUr+QvRWj3m4KelcAhlXWQEA/caJ/M6f8Z3MNCMiy9uUI u210K3fsZ/8fbPfhvb8kmZ6vqwABu7+p+GlDd6DKdwvOEqkmhAU6GI2mWKFBPL3ckwry Jy3mlExa34gw9e7azxmbl1b7z0v370AXg+mRYpoVRQlRSP5GmIGVq6WU1jyglJXovADN 1QYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rmzl8lzl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r11si5156775pgg.327.2018.12.08.08.12.46; Sat, 08 Dec 2018 08:13:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rmzl8lzl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726189AbeLHQMN (ORCPT + 99 others); Sat, 8 Dec 2018 11:12:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:48642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726160AbeLHQMN (ORCPT ); Sat, 8 Dec 2018 11:12:13 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A30C02081C; Sat, 8 Dec 2018 16:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544285532; bh=cimpes1rh1STQSzkQndE+MoFUC2JHbN1Xcq1Dqxi/tU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=rmzl8lzlochnUlFsNsh4NgH9/0yA7ewghUL9gVKf1tQ+mkzuHpamyg9+F50yhTB1X s5TtKmprqiy5tnJH2xHYEauRYbbHUYLQ4jhS59GvevJmTu0BSHScFa2pxulyknZR+4 DN6MdGaS95nRub77uQJVmePXGTdL0rMyMm2JeKcs= Date: Sat, 8 Dec 2018 16:12:07 +0000 From: Jonathan Cameron To: Shreeya Patel Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/3] Staging: iio: adt7316: Move interrupt related code Message-ID: <20181208161207.47ee755c@archlinux> In-Reply-To: <20181208151638.8759-3-shreeya.patel23498@gmail.com> References: <20181208151638.8759-1-shreeya.patel23498@gmail.com> <20181208151638.8759-3-shreeya.patel23498@gmail.com> X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 8 Dec 2018 20:46:37 +0530 Shreeya Patel wrote: > There is a function adt7316_irq_setup() where irq_type is being > set. It would be good to move devm_request_threaded_irq() function > and assignment of chip->config1 in adt7316_irq_setup() to unclutter > the code in probe function. > > Signed-off-by: Shreeya Patel As commented below, this didn't end up as tidy as it might have been. It would I think have been simpler before patch 1 or just merged with it. Anyhow, I might combine the two whilst applying. However before I do that I'd like to leave this on list for a few days to let Alex or others have time for another look before I apply it. All heading in the right direction! Thanks, Jonathan > --- > drivers/staging/iio/addac/adt7316.c | 34 ++++++++++++++--------------- > 1 file changed, 17 insertions(+), 17 deletions(-) > > diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c > index 86b2c3d53588..97dd48153293 100644 > --- a/drivers/staging/iio/addac/adt7316.c > +++ b/drivers/staging/iio/addac/adt7316.c > @@ -1807,11 +1807,12 @@ static irqreturn_t adt7316_event_handler(int irq, void *private) > return IRQ_HANDLED; > } > > -static int adt7316_setup_irq(struct device *dev, int irq) > +static int adt7316_setup_irq(struct iio_dev *indio_dev) Hmm. This has ended up a lot more complex than ideal due to the effective two layers of rework. I would either have done patches 1 and 2 as one patch or reordered them so the rework preceded the change to DT. It's not that important but it would have lead to code that was easier to review. > { > - int irq_type; > + struct adt7316_chip_info *chip = iio_priv(indio_dev); > + int irq_type, ret; > > - irq_type = irqd_get_trigger_type(irq_get_irq_data(irq)); > + irq_type = irqd_get_trigger_type(irq_get_irq_data(chip->bus.irq)); > > switch (irq_type) { > case IRQF_TRIGGER_HIGH: > @@ -1821,13 +1822,23 @@ static int adt7316_setup_irq(struct device *dev, int irq) > case IRQF_TRIGGER_FALLING: > break; > default: > - dev_info(dev, "mode %d unsupported, using IRQF_TRIGGER_LOW\n", > + dev_info(&indio_dev->dev, "mode %d unsupported, using IRQF_TRIGGER_LOW\n", > irq_type); > irq_type = IRQF_TRIGGER_LOW; > break; > } > > - return irq_type; > + ret = devm_request_threaded_irq(&indio_dev->dev, chip->bus.irq, > + NULL, adt7316_event_handler, > + irq_type | IRQF_ONESHOT, > + indio_dev->name, indio_dev); > + if (ret) > + return ret; > + > + if (irq_type & IRQF_TRIGGER_HIGH) > + chip->config1 |= ADT7316_INT_POLARITY; > + > + return ret; > } > > /* > @@ -2124,7 +2135,6 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus, > { > struct adt7316_chip_info *chip; > struct iio_dev *indio_dev; > - int irq_type; > int ret = 0; > > indio_dev = devm_iio_device_alloc(dev, sizeof(*chip)); > @@ -2168,19 +2178,9 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus, > indio_dev->modes = INDIO_DIRECT_MODE; > > if (chip->bus.irq > 0) { > - irq_type = adt7316_setup_irq(dev, chip->bus.irq); > - > - ret = devm_request_threaded_irq(dev, chip->bus.irq, > - NULL, > - adt7316_event_handler, > - irq_type | IRQF_ONESHOT, > - indio_dev->name, > - indio_dev); > + ret = adt7316_setup_irq(indio_dev); > if (ret) > return ret; > - > - if (irq_type & IRQF_TRIGGER_HIGH) > - chip->config1 |= ADT7316_INT_POLARITY; > } > > ret = chip->bus.write(chip->bus.client, ADT7316_CONFIG1, chip->config1);