From patchwork Mon Oct 21 10:58:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 177058 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp3245288ill; Mon, 21 Oct 2019 03:58:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKMt24MTmcRsRd0Z5bVr+7NsFl5S6zZ1GDTkuWvsjkFxxk5imBgQtzkXF+4YzcnnrR26P5 X-Received: by 2002:a17:906:bfcb:: with SMTP id us11mr21259316ejb.299.1571655513281; Mon, 21 Oct 2019 03:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571655513; cv=none; d=google.com; s=arc-20160816; b=uZ9AoEMrccOFeMrVfOPJGWGJ198PfI0O7KNrd1T8UstnKdns8JYDXNnqVpJAM2wcfL 3Tt5FiMQ3CjpxmEn11vzpd1dr7+OvZivZM+vVUgTT5YElUfFpNtmF2uPuBMyiphuCDwG q2wAtGwuxCTAIKvTbXopFyLGkcaeWFsEUqeRAaLm17/EJt9HB68AXZFuBWAKY2PUIp6T h0KwmTlJKMyJIE6teLZTmbRSHDrxJ102+8uVjkasFDBkY9tKFbSvpErMjRRgS1s5Esp+ ZRr7BtiZ442Xq5ZgkrJ8Zsgm2MSFiJ8FV/LCZedZcLbKEt2fsQLvQKaHT5F21+JlI6uK p/qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=M+Rr/WbPC8m7dZLhfszJHtex79KIwoH5LRc6fwcboyc=; b=VtAkvIcahZDfZV96C/t/rh8lofJFBXcu9K3DAN0BK7XR/ekjR+S44NycZcprPDZXkH i+920WWSgCsr0QANb0vaV3yitMdq9+k5Ee7KSaqtrn1W26gimuE9nLhp9CUeNBbhmXFE X+FvK+WAE3MJ5tuhbiycMTJY/QU5crB6VXLtOqV8gFK8QNm4VHcjm1UV3r/bcJq1UY/6 HoF+SWwczfRQ4ZRN3P8LwV109VyJahvzceyBnv/Zyx0w2xIwX5awXqzklk9avB5ZFM56 WJvATqsUk9L/c50HChG/PXbvQt/tfFOwuUgFQDcws1HwKL4aQRJTvroo0NXn1TUJGFnR LPGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xEhVtga6; 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 rn4si8809325ejb.251.2019.10.21.03.58.33; Mon, 21 Oct 2019 03:58:33 -0700 (PDT) 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=xEhVtga6; 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 S1728178AbfJUK62 (ORCPT + 26 others); Mon, 21 Oct 2019 06:58:28 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:37287 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbfJUK61 (ORCPT ); Mon, 21 Oct 2019 06:58:27 -0400 Received: by mail-wm1-f67.google.com with SMTP id f22so12292741wmc.2 for ; Mon, 21 Oct 2019 03:58:26 -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; bh=M+Rr/WbPC8m7dZLhfszJHtex79KIwoH5LRc6fwcboyc=; b=xEhVtga6MQRbG6XAjBCACpSU2T15US9KjrquctDHuyVAap92YsR4cpqZxx2G5wqwtw ua/RA9+ma6tcuCAlgqO8oSmy3+2IFSb4BlVTWZKEGr9GajuSihUV3DE8khNmcmFYtiMF MEqNJ2rvrw0GjYVb3MOf+F/qm7FO0UNbewTyd1M1m3C0ymePmRk2531mV+YdyoGtf7ig AL/rCtOUhQyNJtiBGvKqBYud+v2dZIN/s0VGGekoBELHF8OeUGVWQTIe4l2CNXt0TB9H wuaXEWJhnF/8GTR5539dLHqIVqAL7baluYHVUg3fBY2GlvEJ7+ZZIxmAMU/eZFjCFrXd UcoQ== 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; bh=M+Rr/WbPC8m7dZLhfszJHtex79KIwoH5LRc6fwcboyc=; b=ELV+U4qN0olLrgOQ0g07rhizvwi2Ts5eD7zLqJIVeOFWOTGlePspX1xyigOK3dB8ho 5QKPA4L3BavQ3cExxqmEA5i6xUmauNnYKHKTRsW5fRpt619y6dC655Q1Ir5KZzcp7nD3 0Bl9ZZD65MbElEIKx9cqYa/xpN/eua1NOlZmTWn0j/qHJc3+b2jghAns3VvfMVDBmK5c iLtGPygAckX9u1w4yPyxZN8ZDpAsaOi0Xs24dECE0BVw08gphgaeXW9LGqPCFET6iaAW sMuQlVh9HT4TjuiJJa5+NvesUy7KqVadO2lVHIDoeU6i7oxEs679Sz9Mh4W9FWH2Aqms gPng== X-Gm-Message-State: APjAAAXN9qkdFchTsqyFYuFazHC2AU47MoJCYt/UqmJRcgi+cJOlYezj CnUOXtxfSREUiY3PIoMPaQEdhA== X-Received: by 2002:a1c:f305:: with SMTP id q5mr18617648wmq.137.1571655505510; Mon, 21 Oct 2019 03:58:25 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.99]) by smtp.gmail.com with ESMTPSA id q22sm12544289wmj.31.2019.10.21.03.58.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 03:58:25 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, arnd@arndb.de, broonie@kernel.org, linus.walleij@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, baohua@kernel.org, stephan@gerhold.net, Lee Jones Subject: [PATCH v2 0/9] Simplify MFD Core Date: Mon, 21 Oct 2019 11:58:13 +0100 Message-Id: <20191021105822.20271-1-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MFD currently has one over-complicated user. CS5535 uses a mixture of cell cloning, reference counting and subsystem-level call-backs to achieve its goal of requesting an IO memory region only once across 3 consumers. The same can be achieved by handling the region centrally during the parent device's .probe() sequence. Releasing can be handed in a similar way during .remove(). While we're here, take the opportunity to provide some clean-ups and error checking to issues noticed along the way. This also paves the way for clean cell disabling via Device Tree being discussed at [0] [0] https://lkml.org/lkml/2019/10/18/612. Lee Jones (9): mfd: cs5535-mfd: Use PLATFORM_DEVID_* defines and tidy error message mfd: cs5535-mfd: Remove mfd_cell->id hack mfd: cs5535-mfd: Request shared IO regions centrally mfd: cs5535-mfd: Register clients using their own dedicated MFD cell entries mfd: mfd-core: Remove mfd_clone_cell() x86: olpc: Remove invocation of MFD's .enable()/.disable() call-backs mfd: mfd-core: Protect against NULL call-back function pointer mfd: mfd-core: Remove usage counting for .{en,dis}able() call-backs mfd: mfd-core: Move pdev->mfd_cell creation back into mfd_add_device() arch/x86/platform/olpc/olpc-xo1-pm.c | 6 -- drivers/mfd/cs5535-mfd.c | 124 +++++++++++++-------------- drivers/mfd/mfd-core.c | 113 ++++-------------------- include/linux/mfd/core.h | 20 ----- 4 files changed, 79 insertions(+), 184 deletions(-) -- 2.17.1 Tested-by: Lubomir Rintel (OLPC XO-1)