Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3822014imj; Tue, 12 Feb 2019 05:20:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IbNz4tjZb28UGJb7/2RrkJuz2kMnvUGrl0WXRjqsH8H9h/f9J6Sy3NccsSng7QE3BFOdDaF X-Received: by 2002:a17:902:503:: with SMTP id 3mr4027226plf.233.1549977654036; Tue, 12 Feb 2019 05:20:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549977654; cv=none; d=google.com; s=arc-20160816; b=vDvpUpNp5ufpI9ejiTojESyLHfqDy/7DOjqj2lJxj0Ss0TMn/ioo6ALyizwVbO7nEA jujUCqbu2/TCLZ14am0Kf5t2IzSjk3OD8FtIyvBeshWEXQ8Q8VF8IdUbrk79Br4MiG2W WttBqnF3ct3WiHHv9rGRcMXauCqPJOqudN+7xTTNUUYynxgQztBj6uGZsUmXs/1Xy5PK eyYrvhRmueARJh3jR9TwdfXeJ8/Udbe5sYJtcEeXM92nzDHVb6bd7qUgaVwB67YLYvoA IfUN7quRB+Ybnis8IQWCmHpwEbQd8yeW3tsmq9KG+CCBqEjH1r5jUrJVBfHMYM3uW1NE 5fGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EDAIw774Db9K3TDJlAs9vNTmZAl7FoIEHd7WSGrIJWs=; b=qx2uJ1PqUToqpnWRg7Kk+mvh6NhDMcC0zRLmR8IC11hsrGMHVOkhVBaqRpWdv8+ZJl LzkszOxniWGjDrnZopSIx9LpKL7wnhvIA/yLTBVpcRosrFnCfuITrPKsDWyJLzPCQJxv 32p3XY7/4STLOLGxk9jqyTNN7FB4XniXwnI94W4z/k4160xvhwpFLByHXv/vje37jvq+ LiJMpFbmipN65Yjf7rP5OA8BHnP7O0rqQTZOjQTDvsCoxgzEG6HkzpBKkmtD1rPDhzo6 KViCQEkTCgcMdziEwXk2uz6F11G4xHO7BaSQZPXk92u6ndwcEKQORIMPaM15BkbtUgkl BC6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NSp+CuCf; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si12762429pls.32.2019.02.12.05.20.37; Tue, 12 Feb 2019 05:20:54 -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=@linaro.org header.s=google header.b=NSp+CuCf; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729762AbfBLNUZ (ORCPT + 99 others); Tue, 12 Feb 2019 08:20:25 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41803 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729602AbfBLNUY (ORCPT ); Tue, 12 Feb 2019 08:20:24 -0500 Received: by mail-wr1-f67.google.com with SMTP id x10so2630535wrs.8 for ; Tue, 12 Feb 2019 05:20:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=EDAIw774Db9K3TDJlAs9vNTmZAl7FoIEHd7WSGrIJWs=; b=NSp+CuCfHMCahl8z8WotVc9DYLBptiZY7B1X4gNH9J02MnuET21AXRr5k24sRne71y wIB65jwsfD+bT/ZPgVLUVcewLcs05l3dzXDkdj/HOwfKiiMzJcGQ8/HBbUyqGIL5T9hu DVJEA6cfnBWsDtUfLZqTqtODjEQ6L5ibvsAQAPtIA8f3K+1lmwk9YcHtZ/uFsBi/YNLN ODxTt8x48vkW3alvzFFjZ/+2OXzzOX0tdsciL1duxbGIHQU6rdieZ/a8AhJUmn97XZFa ermHridUqTiqj4IxF4wZHXjNWE8BzctsZJO/hVMHRRohwQHunCfKL8PFOmeQDb9EL5Uz 1eeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=EDAIw774Db9K3TDJlAs9vNTmZAl7FoIEHd7WSGrIJWs=; b=lC13wXeo3I5SHyqiLdASMZHvCTHayCb/oqw9JHsPmuypmMMtsjneI2zTTRIQs5ga74 /hpmh8tvZpdFlax/Bkh999Fz1Sq4pbTmMJn0cP0Vw6FY9GODSfYyF33PJ6e6xLJLEoNv 2yV05CtxQhv3gvn7T/23vmX7eLhB7HuXuG6ope8+fq8vdFf2KngrUxjbC0iASBI+pMyV +cJixNsn7mCaBhJe0BatvNqWUW4gFJ3CpLDQ0QbQBq/U3pII2L4OD825L+FSa8eRMSIr v3wKg6/PG2sSGYiH31hblFMa0yQHewijSXmJBn8LEUH65jKzZADHBlPBMRDVqWoU/H4c e+pQ== X-Gm-Message-State: AHQUAuY63lRMULlmnOBN+QkxUxfpsak6h0o3ek8nRhLuc4j9qX/Jm33W qvVWCHRookYX7UypHXQFdAgTAA== X-Received: by 2002:a05:6000:14c:: with SMTP id r12mr2870824wrx.172.1549977621835; Tue, 12 Feb 2019 05:20:21 -0800 (PST) Received: from dell ([2.27.35.171]) by smtp.gmail.com with ESMTPSA id y22sm38723822wrd.45.2019.02.12.05.20.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 05:20:18 -0800 (PST) Date: Tue, 12 Feb 2019 13:20:16 +0000 From: Lee Jones To: Bartosz Golaszewski Cc: Bartosz Golaszewski , Rob Herring , Mark Rutland , Linus Walleij , Dmitry Torokhov , Jacek Anaszewski , Pavel Machek , Sebastian Reichel , Liam Girdwood , Greg Kroah-Hartman , Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , devicetree , Linux Input , Linux LED Subsystem , Linux PM list Subject: Re: [PATCH v4 05/10] mfd: max77650: new core mfd driver Message-ID: <20190212132016.GA4781@dell> References: <20190205091237.6448-1-brgl@bgdev.pl> <20190205091237.6448-6-brgl@bgdev.pl> <20190212083642.GT20638@dell> <20190212095457.GA20638@dell> <20190212101835.GB20638@dell> <20190212111403.GC20638@dell> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 12 Feb 2019, Bartosz Golaszewski wrote: > wt., 12 lut 2019 o 12:14 Lee Jones napisał(a): > > > > On Tue, 12 Feb 2019, Bartosz Golaszewski wrote: > > > > > wt., 12 lut 2019 o 11:18 Lee Jones napisał(a): > > > > > > > > On Tue, 12 Feb 2019, Bartosz Golaszewski wrote: > > > > > > > > > wt., 12 lut 2019 o 10:55 Lee Jones napisał(a): > > > > > > > > > > > > * The declaration of a superfluous struct > > > > > > * 100 lines of additional/avoidable code > > > > > > * Hacky hoop jumping trying to fudge VIRQs into resources > > > > > > * Resources were designed for HWIRQs (unless a domain is present) > > > > > > * Loads of additional/avoidable CPU cycles setting all this up > > > > > > > > > > While the above may be right, this one is negligible and you know it. :) > > > > > > > > You have nested for() loops. You *are* wasting lots of cycles. > > > > > > > > > > Need I go on? :) > > > > > > > > > > > > Surely the fact that you are using both sides of an API > > > > > > (devm_regmap_init_i2c and regmap_irq_get_*) in the same driver, must > > > > > > set some alarm bells ringing? > > > > > > > > > > > > This whole HWIRQ setting, VIRQ getting, resource hacking is a mess. > > > > > > > > > > > > And for what? To avoid passing IRQ data to a child driver? > > > > > > > > > > What do you propose? Should I go back to the approach in v1 and pass > > > > > the regmap_irq_chip_data to child drivers? > > > > > > > > I'm saying you should remove all of this hackery and pass IRQs as they > > > > are supposed to be passed (like everyone else does). > > > > > > I'm not sure what you mean by "like everyone else does" - different > > > mfd drivers seem to be doing different things. Is a simple struct > > > containing virtual irq numbers passed to sub-drivers fine? > > > > How do you plan on deriving the VIRQs to place into the struct? > > Exampe: > > struct max77650_gpio_pdata { > int gpi_irq; > }; > > In MFD driver: > > struct max77650_gpio_pdata *gpio_data = devm_kmalloc(dev, sizeof(*gpio_data)); > > gpio_data->gpi_irq = regmap_irq_get_virq(irqchip_data, GPI_NUM); > > gpio_cell.platform_data = gpio_data; > > In GPIO driver: > > struct max77650_gpio_pdata *gpio_data = pdev->dev.platform_data; > > int irq = gpio_data->gpi_irq; Definitely not. What you're trying to do is a hack. If you're using Regmap to handle your IRQs, then you should use Regmap in the client to pull them out. Setting them via Regmap, then pulling them out again in the *same driver*, only to store them in platform data to be passed to a child device is bonkers. *Either* use the MFD provided platform-data helpers *or* pass and handle them via the Regmap APIs, *not* both. -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog