From patchwork Fri Oct 18 12:56:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 176824 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp820730ill; Fri, 18 Oct 2019 05:56:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFz1Ln/jxnI68kn+1LXCL6ymQwHxonO9xz8hmQEfU8K8+BBm5tbSt3GHQtODWMP459u4g8 X-Received: by 2002:a17:906:6094:: with SMTP id t20mr8554042ejj.316.1571403377845; Fri, 18 Oct 2019 05:56:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571403377; cv=none; d=google.com; s=arc-20160816; b=ZNcGHQJKuUUIg2kRTKrEhb1XQoKYbDMTRUZd8prS7xK32utlUvpcIp/UszJRtrFS3l N5Bs/L0GyvZWhIy/tcbDczo3XFXMQnnPB0ucX4rU+WILM2RtTFElTaiQiSyuyNMg/Iuu ypMRwlMtgDEoRAgbj1Mbu55QELOg26it5hNDK121r38poX6ewwlvkBaZ9lUCcgWpb7TP cCcp2uxLo56Leyv8Ypcrs7Mi6EfR4w7sygqdLOMMDI5Ov9gLBSG9SpPjsErWj0klSjHE 8cZHcs9BEIvrWUV0Gc8s9e2SaDvWj2LZPWZXhHqtXMWP+/OAq7KqYD75CuVQ4GhUcOZQ nxNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=RI1bFjYRN5JoMtaeqs26PN1sSu7fROvvqss/8HZl7T4=; b=vcUNq+lIW9M/CcZSu/H5Mz4+uqHVozNgrhd+5cVM/mBLxkYz78AtMOFM7+S7QmmyZo DC5FDgdHpfDspM4GgYxvLFzI3dyH5o/hWW4A0w1XF1jwu6uTdK62ho5vOgCs1t8K0Cf8 f9f34/RIUqGCH2Oda0Z+8ZjmsSw8grg7FSk1PexWBcOWihbZ+ZuPvdfavCCOQWWQSsoM WMi6Md/cz9aBVbn4DTtpK90TS5o+IfSc7GBkFuPeNjvRJTdS8Z/6ALJqHFU0BtGljb4w xFOiXONVYRl4AEHVV9ebZSMYrzp4ePsj+nVkh6k38ulUZx8ikoiHEVVXrghrIwgXh9OJ 9c7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Tkump4dk; 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 j47si3670642ede.117.2019.10.18.05.56.17; Fri, 18 Oct 2019 05:56:17 -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=Tkump4dk; 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 S2410146AbfJRM4O (ORCPT + 26 others); Fri, 18 Oct 2019 08:56:14 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40985 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408410AbfJRM4O (ORCPT ); Fri, 18 Oct 2019 08:56:14 -0400 Received: by mail-wr1-f68.google.com with SMTP id p4so6151502wrm.8 for ; Fri, 18 Oct 2019 05:56:12 -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:in-reply-to:references; bh=RI1bFjYRN5JoMtaeqs26PN1sSu7fROvvqss/8HZl7T4=; b=Tkump4dkVHciY3EeN1den7fHXElV+9LPol0+LGG3Z7MWtrr7yGuf5RVZ41hMkz6dL7 pQDq79k4nyRfYaA1srfAPUUjnTfnixSxG/3HVivTenEJ1j+axHw4aH9c3ZleE1gp7cQf DrZWH2k2B12+nwMszZ5/5W7wHgoITM5o+D8IVlOdJrE7lFGvHcjP31AoaUprRjTU3XyB t7sm2PpXhN4LLXJPIYLbVz7vh7qVTByPvW24Iid7J8l6L+YZ5OEVulRWRaIcWLQVxj/Y yLvz2i2tfSl6U88FWJPSqnspRFwayraj9hJakM3sJQFRaBIAjORWXkWMfgOnq6qUtDqQ 3ErA== 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:in-reply-to :references; bh=RI1bFjYRN5JoMtaeqs26PN1sSu7fROvvqss/8HZl7T4=; b=tpwp0YEJT8+j0FDTDIuYShLbVeOL+VUVLjoLgx/UsHahEeJpNXP9sBXOernxIHRkED ENH0Z6Vw6rURljO8WrMJEgIc6a8eWtQRuWxeUcLY3AzgceyEb4Qku/zT9igKgBGfeEli MUHavXuNARzR+GL2AL8v+A2QPMWaafsmWrxroVuI9gJ56UZIPlUxa30krgeOotdnG5Yc ZBJYSobqh7OVtRSEUEvOu5hSxaer0UebD1V1MvRs5a3pJV6b92/HkyfcE3ixDbAkF4+4 7RC6e0en8/8iVrULNaiP4euHRguvcA7HUa2zAs6v3Icqkj+mrV5lcN4xe5AD7A9vL7bq PVMA== X-Gm-Message-State: APjAAAUZ1WWRipBawG1h7WD9LcH6HjckrYKTbxyEojN7lRSqstHZnK/c X5+c4qkf4iS7Q5ZZnfZZ+hSq8Q== X-Received: by 2002:adf:e292:: with SMTP id v18mr7628000wri.190.1571403371768; Fri, 18 Oct 2019 05:56:11 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.47]) by smtp.gmail.com with ESMTPSA id q14sm6058491wre.27.2019.10.18.05.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 05:56:11 -0700 (PDT) From: Lee Jones To: broonie@kernel.org, linus.walleij@linaro.org, daniel.thompson@linaro.org, arnd@arndb.de Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dilinger@queued.net, Lee Jones Subject: [PATCH 1/4] mfd: cs5535-mfd: Use PLATFORM_DEVID_* defines and tidy error message Date: Fri, 18 Oct 2019 13:56:05 +0100 Message-Id: <20191018125608.5362-2-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018125608.5362-1-lee.jones@linaro.org> References: <20191018125608.5362-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In most contexts '-1' doesn't really mean much to the casual observer. In almost all cases, it's better to use a human readable define. In this case PLATFORM_DEVID_* defines have already been provided for this purpose. While we're here, let's be specific about the 'MFD devices' which failed. It will help when trying to distinguish with of the 2 sets of sub-devices we actually failed to register. Signed-off-by: Lee Jones --- drivers/mfd/cs5535-mfd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c index f1825c0ccbd0..2c47afc22d24 100644 --- a/drivers/mfd/cs5535-mfd.c +++ b/drivers/mfd/cs5535-mfd.c @@ -127,10 +127,11 @@ static int cs5535_mfd_probe(struct pci_dev *pdev, cs5535_mfd_cells[i].id = 0; } - err = mfd_add_devices(&pdev->dev, -1, cs5535_mfd_cells, + err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, cs5535_mfd_cells, ARRAY_SIZE(cs5535_mfd_cells), NULL, 0, NULL); if (err) { - dev_err(&pdev->dev, "MFD add devices failed: %d\n", err); + dev_err(&pdev->dev, + "Failed to add CS5532 sub-devices: %d\n", err); goto err_disable; } From patchwork Fri Oct 18 12:56:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 176825 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp820781ill; Fri, 18 Oct 2019 05:56:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8sD1PoqvQ7EVO8GXvnUukl7/HU695BbtWi4dmKN9SOSw1YA3QSCxEu63ZoiScxgxWTWZq X-Received: by 2002:aa7:d145:: with SMTP id r5mr9271393edo.275.1571403381626; Fri, 18 Oct 2019 05:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571403381; cv=none; d=google.com; s=arc-20160816; b=CxdkqTNEiwWbspx11t3qRJL/MaZ2HSgySwA4B7F2tc0UWzu8sNiXBSWy+MX4mjl+bO KavJnSYyFpYojP6Ds0T+/Yl3bSxKAyNAG0Zmx6ZZv07BlzFCN/DB3a4nhIgE55ubZoQe cDzMB0SnFyAcNxvaalJAmzTVZvwlea+IvchW1llN0dZ7vq+mDZdyT0yPuBK7BdoMhaFC uBameVvUIl7x77tV4rLlOLBAoOGKRH95ZsazUEWvHHLUErjpddwOfqhKAbFH9ZIROiwG JPJJEqGU5YB3DRje5gU7TaTZ3T69kYAJnoEMqcHi79YHmgkV+CDg3fVLB0Q0NFLD0Ndi vFjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=tA6TKsBMxQLUjSU3fzXg4jKW0/ylO7bO362kG6mzlHw=; b=zudJGFTYxstBzFY/dneq6BeWYWTxC9v2QI85m3/QrZqelWmltduMKunfPynqoT6K1c w0qQQncpiJYbNhQkscUWw82k5Y0zs8d6YqeW9w0203iqCr0fKYUrqESusGSMCjlBKGWc 889ZQ/ztboqCwJ952dsQX8hQmfv7Qsi4hClZavPeOYvXXDlNq5D/w7rg3IhAzFnJQlB0 T/UB3wwLmWX8nVqCGQYju6tpFAWs9AsBD/4t7vuz8LxQFeMl5nFhLDiWdi5GZhyGbVT9 ucZZSfo6K19F00uR5wsBmf/QTz5n+/68Ivfu31jvmnVh4aSCD+t7wou4bFdHgpBHAE/B FWeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SGq9PI4d; 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 b1si3965991edm.271.2019.10.18.05.56.21; Fri, 18 Oct 2019 05:56:21 -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=SGq9PI4d; 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 S2633947AbfJRM4S (ORCPT + 26 others); Fri, 18 Oct 2019 08:56:18 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52169 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410137AbfJRM4Q (ORCPT ); Fri, 18 Oct 2019 08:56:16 -0400 Received: by mail-wm1-f68.google.com with SMTP id 7so6108807wme.1 for ; Fri, 18 Oct 2019 05:56:13 -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:in-reply-to:references; bh=tA6TKsBMxQLUjSU3fzXg4jKW0/ylO7bO362kG6mzlHw=; b=SGq9PI4daFfcszjMKf2wYtPHwldGY0somzhl6xsa50sVxELUnAfL1hBRF6DH65q8e+ ejb63GlrWXNL/FqxGKP+fBm7jeh1Xxm3kB66e+SmLAN+BX6OlCaLM69RkdnszMpvJ4ua NdH4/2Qmt6LOZutddI2mB4sg7QT6L42JVh97GK7baN2XK5Hrikafro5EnAFfm9ldTAdq pYA+68ajMbp7se1ubtErRWe6dlKVnwiiVatdOzyhewkYYqz3nYhszY/g0lVNv1CBQp7r 88R6F4ZTnbr6TLNCeplZ9/nRPFa7M5jMKG+i5UOJpzDRzv6M1AgqLIKuOgb65MS9Q3v0 6rCA== 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:in-reply-to :references; bh=tA6TKsBMxQLUjSU3fzXg4jKW0/ylO7bO362kG6mzlHw=; b=tijtU8M8zVnn5SYEaz4G2sNktzLm81DqSVqCUPE+RSfiCver3QNhSGrUi1kF2LnbX+ NWolSz5iXf2JYZwnvHuclzQutpVa/yizpyOxN8pTgpp3S9/X01foYioayLChVZSMOkZJ YLqAaSv1sDduikBdLvBgZgaJYeq3vB/CtLPOzqevkT8FtAw2l5eqee8e6d/0sYNC0QdR DnpMftlVY6Ss0Od4hUHPQ523/nIrOicdvMV79lSfSvS7YKZE/AbhnJRcpwAlMphlae+u qTnWkHl//isf55+Le+QsViPO5kBGg+BoM92BXlSPEP/kYi4auaqzQROPkqcavjGYFIva f49Q== X-Gm-Message-State: APjAAAV9NmAC6TOMhOW70xW4mCPIMtSCfAhFzC0tUaoIb9xwQpzdN6TO 18LqLdOJZd2LOQSHb9dAeUOu2g== X-Received: by 2002:a05:600c:23cf:: with SMTP id p15mr3532014wmb.1.1571403372638; Fri, 18 Oct 2019 05:56:12 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.47]) by smtp.gmail.com with ESMTPSA id q14sm6058491wre.27.2019.10.18.05.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 05:56:12 -0700 (PDT) From: Lee Jones To: broonie@kernel.org, linus.walleij@linaro.org, daniel.thompson@linaro.org, arnd@arndb.de Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dilinger@queued.net, Lee Jones Subject: [PATCH 2/4] mfd: cs5535-mfd: Remove mfd_cell->id hack Date: Fri, 18 Oct 2019 13:56:06 +0100 Message-Id: <20191018125608.5362-3-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018125608.5362-1-lee.jones@linaro.org> References: <20191018125608.5362-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current implementation abuses the platform 'id' mfd_cell member to index into the correct resources entry. If we place all cells into their numbered slots, we can cycle through all the cell entries and only process the populated ones which avoids this behaviour. Signed-off-by: Lee Jones --- drivers/mfd/cs5535-mfd.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c index 2c47afc22d24..b01e5bb4ed03 100644 --- a/drivers/mfd/cs5535-mfd.c +++ b/drivers/mfd/cs5535-mfd.c @@ -62,26 +62,22 @@ static int cs5535_mfd_res_disable(struct platform_device *pdev) static struct resource cs5535_mfd_resources[NR_BARS]; static struct mfd_cell cs5535_mfd_cells[] = { - { - .id = SMB_BAR, + [SMB_BAR] = { .name = "cs5535-smb", .num_resources = 1, .resources = &cs5535_mfd_resources[SMB_BAR], }, - { - .id = GPIO_BAR, + [GPIO_BAR] = { .name = "cs5535-gpio", .num_resources = 1, .resources = &cs5535_mfd_resources[GPIO_BAR], }, - { - .id = MFGPT_BAR, + [MFGPT_BAR] = { .name = "cs5535-mfgpt", .num_resources = 1, .resources = &cs5535_mfd_resources[MFGPT_BAR], }, - { - .id = PMS_BAR, + [PMS_BAR] = { .name = "cs5535-pms", .num_resources = 1, .resources = &cs5535_mfd_resources[PMS_BAR], @@ -89,8 +85,7 @@ static struct mfd_cell cs5535_mfd_cells[] = { .enable = cs5535_mfd_res_enable, .disable = cs5535_mfd_res_disable, }, - { - .id = ACPI_BAR, + [ACPI_BAR] = { .name = "cs5535-acpi", .num_resources = 1, .resources = &cs5535_mfd_resources[ACPI_BAR], @@ -115,16 +110,16 @@ static int cs5535_mfd_probe(struct pci_dev *pdev, return err; /* fill in IO range for each cell; subdrivers handle the region */ - for (i = 0; i < ARRAY_SIZE(cs5535_mfd_cells); i++) { - int bar = cs5535_mfd_cells[i].id; - struct resource *r = &cs5535_mfd_resources[bar]; + for (i = 0; i < NR_BARS; i++) { + struct mfd_cell *cell = &cs5535_mfd_cells[i]; + struct resource *r = &cs5535_mfd_resources[i]; - r->flags = IORESOURCE_IO; - r->start = pci_resource_start(pdev, bar); - r->end = pci_resource_end(pdev, bar); + if (!cell) + continue; - /* id is used for temporarily storing BAR; unset it now */ - cs5535_mfd_cells[i].id = 0; + r->flags = IORESOURCE_IO; + r->start = pci_resource_start(pdev, i); + r->end = pci_resource_end(pdev, i); } err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, cs5535_mfd_cells, From patchwork Fri Oct 18 12:56:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 176826 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp820796ill; Fri, 18 Oct 2019 05:56:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyu1yl3kVjL2+sCWdgh+VR5zSPGRPbE+yuEiWPMlSowHl4t4CFwq27wZA41YLHO8KBI3pDz X-Received: by 2002:a50:eb4d:: with SMTP id z13mr9282559edp.175.1571403382516; Fri, 18 Oct 2019 05:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571403382; cv=none; d=google.com; s=arc-20160816; b=N9fsKqCx6dqqE03KIM6NbIqzSEslNJT7vl5khPgIHtcIfa0V0wSI0w3K4VGZv39bnX PNvRqQjfHy8alh0lR4YcGeB+NtwIPqhJ71whD09UjKu98rnHXPKuEhpSaLubNsYfmxid w8kPBwlV6/eon/ydTikMBJ2S9lfhvxadsxB5XtCRE1qmDC7kfWvDSstfi4CPp7nA8kZq gwwbY+NCfhVQwD7hqcBOL9bZap6gHjemKS8DH3Q92GONlIn9STgJHW8snypDNHZGXZoG SWP1X56JT6ye6l69rTUuoOO5J0M7xv9PGixjrTU5ScnPglYENu/NL7OBv9nm2/+eioxM 3G+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=uffMabFPldA3sW0xXZbJX93ZYIXfUZ6x/6qzeDvqKHU=; b=ya81EhTRxY1x9dHcCv4rxJ/SNhd2SaD5SN823WglMWoiZol5J2ZxbQkI7dIKGwNudL e4uo/20JclPk1cSPsrsGhXD9mxVcJ3OS/cdr7C4uTxQcfo9ommdKfWw6nQdGRnTxpQ8o dfKHaia27MV67eLsLdeC0KEhUS2tVfYYIf9P2BFOWfvFoziU7G+EOASlihqrI9rAcLSb TxcpuT5V6AocdulQNirlBwQe/esEcFSZx+tlww88Pp2zmXFW7p04omvFqKy6YbadlxJ7 Yu5UuU+86URCPD4duEA8cd4pOB9byH78TtVeInJPMj8VBz5OSqMXn1LEWLxp3yM/wh1N lfmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="a1/kW5wJ"; 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 b1si3965991edm.271.2019.10.18.05.56.22; Fri, 18 Oct 2019 05:56:22 -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="a1/kW5wJ"; 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 S2438918AbfJRM4R (ORCPT + 26 others); Fri, 18 Oct 2019 08:56:17 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39053 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410148AbfJRM4P (ORCPT ); Fri, 18 Oct 2019 08:56:15 -0400 Received: by mail-wm1-f67.google.com with SMTP id v17so5994303wml.4 for ; Fri, 18 Oct 2019 05:56:14 -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:in-reply-to:references; bh=uffMabFPldA3sW0xXZbJX93ZYIXfUZ6x/6qzeDvqKHU=; b=a1/kW5wJjmnv20kwpLmkrzovugTb1olIvoyebb0Vdjs5JnX4ljk48LR2JgfzAjq4/n YKi2C6bNqD6clsE+QBZVYEo9XsI9jYOLAtvqUdSnnzW/tlQWAbhfDG+sMMdt2e6Q+1LP j0c5e06g8KXzDIAG5CgCngwS8Z6LW3mdQFpgOI20kiWERusJCaNM7w5z37F3BEO+XFwm VbQyEFtAOvTXyzASG63fQ6P1o4Xt+5v+br3HT9BljgIjlArGhXRfP++umd0r5DVc1rZm TshzZHKWukXC0S2TOXY/8NsmxbDHS/UUjOOwV9zz/ILiIE/4x5e50M9xrFEpir2W6KMQ 3w2A== 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:in-reply-to :references; bh=uffMabFPldA3sW0xXZbJX93ZYIXfUZ6x/6qzeDvqKHU=; b=P1bk2o9hdyYgAVyfbrPQyHfG1BImackkh3KwOzVrpxKOhE/EgozpFWeLLgZ/PC9dbJ aOhI3rBDOWOfo/MlI4jwAHV0+aSYkXJWKfxL5Jyj4FVmvDRkTvdB91LPZd0j2vtPtwdD RUvoZPHk0ijYSfetqMcLNrO19tmKuf76QsOoIhEA7VIfj23JP/7fBRPDqYIrm+seCKuJ fZ1fAVPBYsZk5ozOVVgQOViFAS5pR0FCvxT+YSNhBtX0kK9drXaHaRJCVXTOKOuFxnH/ 02ytjQYueuxIPy+pkW/zUbdo8pLsQJ/kFhAqA2d5Dc8J+VaXIe/trK/yv9Hk9Ht0G8IR dFfA== X-Gm-Message-State: APjAAAW/uuYYjcwsulwtG0gVDbf936oMSMOo/zEni0+lpcErbfhJB4sx vgckptvc6H+3cjMBM2xlA/dmVg== X-Received: by 2002:a1c:6702:: with SMTP id b2mr2599688wmc.107.1571403373543; Fri, 18 Oct 2019 05:56:13 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.47]) by smtp.gmail.com with ESMTPSA id q14sm6058491wre.27.2019.10.18.05.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 05:56:12 -0700 (PDT) From: Lee Jones To: broonie@kernel.org, linus.walleij@linaro.org, daniel.thompson@linaro.org, arnd@arndb.de Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dilinger@queued.net, Lee Jones Subject: [PATCH 3/4] mfd: cs5535-mfd: Register clients using their own dedicated MFD cell entries Date: Fri, 18 Oct 2019 13:56:07 +0100 Message-Id: <20191018125608.5362-4-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018125608.5362-1-lee.jones@linaro.org> References: <20191018125608.5362-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CS5535 is the only user of mfd_clone_cell(). It makes more sense to register child devices in the traditional way and remove the quite bespoke mfd_clone_cell() call from the MFD API. Signed-off-by: Lee Jones --- drivers/mfd/cs5535-mfd.c | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/mfd/cs5535-mfd.c b/drivers/mfd/cs5535-mfd.c index b01e5bb4ed03..2711e6e42742 100644 --- a/drivers/mfd/cs5535-mfd.c +++ b/drivers/mfd/cs5535-mfd.c @@ -95,9 +95,23 @@ static struct mfd_cell cs5535_mfd_cells[] = { }, }; -static const char *olpc_acpi_clones[] = { - "olpc-xo1-pm-acpi", - "olpc-xo1-sci-acpi" +static struct mfd_cell cs5535_olpc_mfd_cells[] = { + { + .name = "olpc-xo1-pm-acpi", + .num_resources = 1, + .resources = &cs5535_mfd_resources[ACPI_BAR], + + .enable = cs5535_mfd_res_enable, + .disable = cs5535_mfd_res_disable, + }, + { + .name = "olpc-xo1-sci-acpi", + .num_resources = 1, + .resources = &cs5535_mfd_resources[ACPI_BAR], + + .enable = cs5535_mfd_res_enable, + .disable = cs5535_mfd_res_disable, + }, }; static int cs5535_mfd_probe(struct pci_dev *pdev, @@ -130,8 +144,18 @@ static int cs5535_mfd_probe(struct pci_dev *pdev, goto err_disable; } - if (machine_is_olpc()) - mfd_clone_cell("cs5535-acpi", olpc_acpi_clones, ARRAY_SIZE(olpc_acpi_clones)); + if (machine_is_olpc()) { + err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, + cs5535_olpc_mfd_cells, + ARRAY_SIZE(cs5535_olpc_mfd_cells), + NULL, 0, NULL); + if (err) { + dev_err(&pdev->dev, + "Failed to add CS5532 OLPC sub-devices: %d\n", + err); + goto err_disable; + } + } dev_info(&pdev->dev, "%zu devices registered.\n", ARRAY_SIZE(cs5535_mfd_cells)); From patchwork Fri Oct 18 12:56:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 176827 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp820930ill; Fri, 18 Oct 2019 05:56:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHRuJpJd8EwY1vTsPVL+3iWemFW6AgPiV1gHtbyUg/U0ghnPbpThHRGR84BAdhPb8C1ktB X-Received: by 2002:a17:906:4895:: with SMTP id v21mr4016201ejq.2.1571403389640; Fri, 18 Oct 2019 05:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571403389; cv=none; d=google.com; s=arc-20160816; b=e0vimMLZusC4BhBhz9XRt2L4bhQV5HBqbQBOw4Est8CzbGA04Xoi9nCBQEAq+SHyaL cIpTeoCGR1s1FXs4is3NRZvAa2NLMnq2EoWT8Y7NJadwQVei3tYHkAGp2chKLGw5Cpay 0QIRwSiI5+xRsba5KyWSVxO0fBNlwD//CFwSXWt5lcY/mhDceVtYRM0z0ClPOsGo+E+5 sD+H/MG7Z+83QGhmQSUEz4mhXjtmQGciiS3SsaOwW2kXBQWC4c0ddJi2J4+W9hfIVpZO 6TWks5IkQbmiXtTn9Nhhrh6CEAWjHCQFc82K87uRyshKhul/tbkhqAmF+Qb/MsKO2HbO 23Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=H4mTo2HGqwmy0EIuop2B1GXHxjKBlt/sTDf6EAka3Lg=; b=eQ+NsqBskedMA44THIGo6CyugI48fjkOw/57H8SqTegLotAbV2Y5bhw2tv020vRd9x Wgvnc8zR0zpq399kWZE4Oy98oAbvQFIahGD0d5pct9rqm+mD0vTJ4njqIowxjEtMCZ8l aXzzmXZJIZlYeDQj/Z+/KrPjlW7NEXq/CgZjz5watzy0zcm0xW69EzEKRQyQ9OuXuaeR yNdoRHZkSOXvK2rE+Y59n6EGBW33/8l2d+5PgTLWQPddgdDlE5Dj1y6aGhIEZYjVIWCA ynm8K7mMGS7RAnzhdmLvu1N+7Xxevdt4j9Cr2taFpq08ylZ3QV70DjlJA7KrTSB7z698 YYPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ylikPevI; 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 k6si3155932eji.137.2019.10.18.05.56.29; Fri, 18 Oct 2019 05:56:29 -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=ylikPevI; 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 S2410158AbfJRM4Z (ORCPT + 26 others); Fri, 18 Oct 2019 08:56:25 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38866 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408410AbfJRM4R (ORCPT ); Fri, 18 Oct 2019 08:56:17 -0400 Received: by mail-wm1-f67.google.com with SMTP id 3so6009197wmi.3 for ; Fri, 18 Oct 2019 05:56:15 -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:in-reply-to:references; bh=H4mTo2HGqwmy0EIuop2B1GXHxjKBlt/sTDf6EAka3Lg=; b=ylikPevI+WeeuVyJHM9diR5Ll0ND42DwvS62otpbOR7NpeVRkv/QxIllgr1dp+sUV4 YugopkImYD6Wj4mho/7VDBT/WB5E1hGmeKZr+6C6pkRCjmgxpBlZFOkbN1nLCw1cPBKN 051SK/eiFMelfug6/IP+D7VAHuvPuB93d6m8GPe4hQuWMLxaoGCzMfuNyuqC+WmMZ1Xa AMCQpURQHcxKPIDPBwE1rud0PcXzgk2aApAx5Do2GJRNKhaNLb5tjDzaIHglatPa+rQD BEdF5iSLd0em235wEA+/oVIphuMvjRnI52cipOAmb/qVkUy8KDxrYqAd5btpAwxJYn7D 4Ulw== 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:in-reply-to :references; bh=H4mTo2HGqwmy0EIuop2B1GXHxjKBlt/sTDf6EAka3Lg=; b=ro3TwsfJ19ZTrJI8EtHZgfosC4wAZBc0yGgEYeoLzpA8v4NTEKkXyxPEia+rclYTG9 ulZPSL6NHp7dMwkQbiaoMS/raIaZba7rkZhVnUP5K1o+sVjKUt6dw0zAf4BXvR9GAZba aVQv7k9fbkRAOx5wonbYluTEYR5tq7tf3sotQXZTS4XLKq+rYVsyx3TiDNxSl8/wjVCL Lf5T8b9+oTD3H6JTuFjGjulpXQCXdLisHH2J24dMMv+fUJu13fdZHYjgC47oE3pz5kMD CKysyDZYQ1JIuiOTiFvjBF9qxBHGM+VIkMojDTrbMyZIWiet408gkgk8m+3n2uZH6cby mV6Q== X-Gm-Message-State: APjAAAXv3tkniif/Dk9ugP8pFtpDqW7Ks8cs1fbvktlZgbhZUJlAQ/k4 JjH2207wfeJ+6ukQsiWAxbJtcA== X-Received: by 2002:a1c:4805:: with SMTP id v5mr7961246wma.130.1571403374485; Fri, 18 Oct 2019 05:56:14 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.47]) by smtp.gmail.com with ESMTPSA id q14sm6058491wre.27.2019.10.18.05.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 05:56:14 -0700 (PDT) From: Lee Jones To: broonie@kernel.org, linus.walleij@linaro.org, daniel.thompson@linaro.org, arnd@arndb.de Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dilinger@queued.net, Lee Jones Subject: [PATCH 4/4] mfd: mfd-core: Remove mfd_clone_cell() Date: Fri, 18 Oct 2019 13:56:08 +0100 Message-Id: <20191018125608.5362-5-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191018125608.5362-1-lee.jones@linaro.org> References: <20191018125608.5362-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Providing an subsystem-level API helper seems over-kill just to save a few lines of C-code. Previous commits saw us convert mfd_clone_cell()'s only user over to use a more traditional style of MFD child-device registration. Now we can remove the superfluous helper from the MFD API. Signed-off-by: Lee Jones --- drivers/mfd/mfd-core.c | 33 --------------------------------- include/linux/mfd/core.h | 18 ------------------ 2 files changed, 51 deletions(-) -- 2.17.1 diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 23276a80e3b4..8126665bb2d8 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -382,38 +382,5 @@ int devm_mfd_add_devices(struct device *dev, int id, } EXPORT_SYMBOL(devm_mfd_add_devices); -int mfd_clone_cell(const char *cell, const char **clones, size_t n_clones) -{ - struct mfd_cell cell_entry; - struct device *dev; - struct platform_device *pdev; - int i; - - /* fetch the parent cell's device (should already be registered!) */ - dev = bus_find_device_by_name(&platform_bus_type, NULL, cell); - if (!dev) { - printk(KERN_ERR "failed to find device for cell %s\n", cell); - return -ENODEV; - } - pdev = to_platform_device(dev); - memcpy(&cell_entry, mfd_get_cell(pdev), sizeof(cell_entry)); - - WARN_ON(!cell_entry.enable); - - for (i = 0; i < n_clones; i++) { - cell_entry.name = clones[i]; - /* don't give up if a single call fails; just report error */ - if (mfd_add_device(pdev->dev.parent, -1, &cell_entry, - cell_entry.usage_count, NULL, 0, NULL)) - dev_err(dev, "failed to create platform device '%s'\n", - clones[i]); - } - - put_device(dev); - - return 0; -} -EXPORT_SYMBOL(mfd_clone_cell); - MODULE_LICENSE("GPL"); MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov"); diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h index b43fc5773ad7..bd8c0e089164 100644 --- a/include/linux/mfd/core.h +++ b/include/linux/mfd/core.h @@ -86,24 +86,6 @@ struct mfd_cell { extern int mfd_cell_enable(struct platform_device *pdev); extern int mfd_cell_disable(struct platform_device *pdev); -/* - * "Clone" multiple platform devices for a single cell. This is to be used - * for devices that have multiple users of a cell. For example, if an mfd - * driver wants the cell "foo" to be used by a GPIO driver, an MTD driver, - * and a platform driver, the following bit of code would be use after first - * calling mfd_add_devices(): - * - * const char *fclones[] = { "foo-gpio", "foo-mtd" }; - * err = mfd_clone_cells("foo", fclones, ARRAY_SIZE(fclones)); - * - * Each driver (MTD, GPIO, and platform driver) would then register - * platform_drivers for "foo-mtd", "foo-gpio", and "foo", respectively. - * The cell's .enable/.disable hooks should be used to deal with hardware - * resource contention. - */ -extern int mfd_clone_cell(const char *cell, const char **clones, - size_t n_clones); - /* * Given a platform device that's been created by mfd_add_devices(), fetch * the mfd_cell that created it.