Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3791587imj; Tue, 12 Feb 2019 04:51:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IZo9Zh5jFXmwnAeQ5jCPBRhOHH8pOMPUCPF8bQNxwh5fGAfBqFy6GOSLswZ+WI5mTXlobeI X-Received: by 2002:a17:902:8204:: with SMTP id x4mr3833768pln.59.1549975909107; Tue, 12 Feb 2019 04:51:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549975909; cv=none; d=google.com; s=arc-20160816; b=G+OuT8v9GhFnTXJvZUzH+VyDJzzxNuKjoWGh8v/MCYcqKr1368LLrKIkEcbM9bwduo KwJqxNm+94PtaaQ7OQKKbjNU8/QFa2QKtQv7SlRR+8JkfzqnP0r+pHv+RSdq/QM5A290 WYT8G53uAJffCCaggeEjJJVv+yJt5vpiq2i/GQHpklI5YPNm4rf2bBa5D94A9B+Xyy/R Pxi/XXS1A2+wXQf8ZMKtQVw6PgQtM2Cmu6ovREa3WiwpXioFm42FcYmkS/MVwyFjOZDl jJl7KodqR48uwN0M+11IJGouci+sC6n63f/R1akaIwlhimYkHjRNg6R896zgYLOVzTBl Pqhg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ra7LCZ/lf2uw2t4sAFfcvxGp8nDlEvhVh2aiSaqLEVI=; b=wyL2s32aWja8JJComx87iqTDXYMhjIlQMMrE9w/k8QKafUb/gHzpGK7wjAUsvZx67M sS0onkG13mZQkgwqggKd7sUl5wbQQIkpKlMNakygozJ6pkqL6Zej1Tc3My3Yp0QrChGe rXa4AWPwGzI/PH7krPQ+nFBnIRj0hwVMW0ziX7/qtpOS1qxZJ5sVHrFksgeYI+l1frMv e8yAUrjhj2q0cJITwxOpSOqunT0N/IjEEtAJlkJAe7Ld/SgmfvIEGHUqYS2ApcE+7tIE HZnB5iB5QaVwZtnOyPhyG4B5qfIvCM33LsVXC9xhiud90SH/fSKZTVP3mbB1zr/bToVf rcTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=GAgXieVL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si10810072plu.169.2019.02.12.04.51.33; Tue, 12 Feb 2019 04:51:49 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=GAgXieVL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729034AbfBLM3w (ORCPT + 99 others); Tue, 12 Feb 2019 07:29:52 -0500 Received: from mail-ot1-f68.google.com ([209.85.210.68]:40921 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728889AbfBLM3v (ORCPT ); Tue, 12 Feb 2019 07:29:51 -0500 Received: by mail-ot1-f68.google.com with SMTP id s5so4051199oth.7 for ; Tue, 12 Feb 2019 04:29:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ra7LCZ/lf2uw2t4sAFfcvxGp8nDlEvhVh2aiSaqLEVI=; b=GAgXieVLcSlRgosjj10zUMSvJoNk6HKKoSqcfjZjw6c720PZbHZhyr788el9L5n03Z zFtr2CYYDmy0Cbw2WU2Z8xw0aG9nRfVmt+tg6iKvgmqn0yoMKmqrWWkZB3U0eVppupr8 IYIKk9ctGhJbGou+X336CsFP5c+dlBUWGCh5hiAlOVBI58hfobGRPIGGLPWKsQfSzeze a0cu8vSiZZScUCfGQZbIINskGULXxnLjBYpQrT78sqG22h7MUbzoeCS/dWjRsouWVpp1 hfuKLrUYcxFDWWtBP4jrmWp9DhTncZTYpFg3GXoHYz75s/Q2Xs1xV9I0R8uBG1XAIQcN JH/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=ra7LCZ/lf2uw2t4sAFfcvxGp8nDlEvhVh2aiSaqLEVI=; b=AxAMlWKc3FBwqETdVYdaL4cEJL88t4Fdpyt/ntGDaQRgw00x4q6ZouqBhEcnMbD04z pW+79JidyveiNEsqldCnCBUmzfh4NnkmP3bA5KRfjOQxh0AS6uabDIewNy9rLd49Iyij gMzdvCjgaL/ekBuak6Vk2Bwf3fEB7jmDrEFI+Ol42e5AMeap/EifmRE/5Q/di66T92e0 WKadt5K29802A+yML3YzOxgsImosluMDT3BcQIK1zyTiT7cQi/+7LPq/vWPZ7IQqAEKf cg2x9zaPW8Eh0jho0VNX4llF3+jDL4RX1UYU+GWS7vQvxf59tlv/GI77KlfX/oSJG3VD zfBQ== X-Gm-Message-State: AHQUAuYh6mNYMcGCyvg2DoLgUxy76akbuUL7N2ZTtYBYKJxyGag0HzBm W+VGnctM8delguAHe3cTRgGclvxfeouNyHErxQmYKA== X-Received: by 2002:a9d:76c5:: with SMTP id p5mr3393647otl.108.1549974590601; Tue, 12 Feb 2019 04:29:50 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: <20190212111403.GC20638@dell> From: Bartosz Golaszewski Date: Tue, 12 Feb 2019 13:29:39 +0100 Message-ID: Subject: Re: [PATCH v4 05/10] mfd: max77650: new core mfd driver To: Lee Jones 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org wt., 12 lut 2019 o 12:14 Lee Jones napisa=C5=82(a): > > On Tue, 12 Feb 2019, Bartosz Golaszewski wrote: > > > wt., 12 lut 2019 o 11:18 Lee Jones napisa=C5=82(= a): > > > > > > On Tue, 12 Feb 2019, Bartosz Golaszewski wrote: > > > > > > > wt., 12 lut 2019 o 10:55 Lee Jones napisa=C5= =82(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 i= t. :) > > > > > > 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, m= ust > > > > > set some alarm bells ringing? > > > > > > > > > > This whole HWIRQ setting, VIRQ getting, resource hacking is a mes= s. > > > > > > > > > > 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 pas= s > > > > the regmap_irq_chip_data to child drivers? > > > > > > I'm saying you should remove all of this hackery and pass IRQs as the= y > > > 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 =3D devm_kmalloc(dev, sizeof(*gpio_da= ta)); gpio_data->gpi_irq =3D regmap_irq_get_virq(irqchip_data, GPI_NUM); gpio_cell.platform_data =3D gpio_data; In GPIO driver: struct max77650_gpio_pdata *gpio_data =3D pdev->dev.platform_data; int irq =3D gpio_data->gpi_irq; Bart