From patchwork Fri Nov 1 07:45:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 178257 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp116984ill; Fri, 1 Nov 2019 00:45:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1P88Apg+QnW3OU0Rzmehn+7OuRcDcYPZWgxtAOFUT5fFikP+OhAMVIWbUSCiT0Sv7abwU X-Received: by 2002:a17:906:e88:: with SMTP id p8mr115291ejf.15.1572594349913; Fri, 01 Nov 2019 00:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572594349; cv=none; d=google.com; s=arc-20160816; b=w1QNuB2L2u8pJDIrtNxvjk+X/u8cshJMnQsmzwnNSHgYDtpxZq865C1Lh3soBHJ12L a4+JCfk+z9bv7/G01t/b82e5ryHFo2V5J5VYtLbT9c8sT7cYY/r4bC7GG1e7623ORvZV J7eEjZXmK5aSqS0Weh/cDVN5WsS2HmkZ5gUo+6IbO/Nz2S7BLvRaTXIYOPcagtT4fiM/ 8fWiTfXEj36Tv0m+PAtThNLGLuJdPE62DhF5HYZIoHs8IParzJGoCO7rDsyirEY4dQui oGE2HGlDWUG4qGxiIQmW5p2yWwvPe9/lac4mzVXsnStoEUk+t0RtjbmqzYid3sXhO/pU 0ENw== 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=L3ntFqp0Br65sFjkR6CV5W+v78yDN2My2Y/1a4PurZc=; b=D/1o0ylq3U8eGrndGE2Sf3WVuEc6x14tlwv3Q0327zmWNmn6/vtdXMz5JpCwf+yOT3 it+AkKb1Y8svONpw+GxBPU76FuoW04gz/8XB1pIfslK/p3kCGGrFHwnDFlHonXJQvdsB HPvIT2Kg5KYEfo7U3dMkLnWM9zqzqWNtC46b9Yr8hXokznC+v6vl3DZ4M4o3H1DJLnNn QgOrBLyzNwaZLcxpq+9SnuQIDJHlDEwPEDNr3veBVFFzKwNKefLtYFClVy3luiAqk/7Y 2YQGwFUMl4tJoJ9e+NgCdZe6w4mi1zGC8E1jJLUmg30SdTKs0PW6kpbTkVD/gW5n3smh D4FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dnSa6iYh; 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 w18si5188280ejv.378.2019.11.01.00.45.49; Fri, 01 Nov 2019 00:45:49 -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=dnSa6iYh; 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 S1730183AbfKAHps (ORCPT + 26 others); Fri, 1 Nov 2019 03:45:48 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38737 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730135AbfKAHpf (ORCPT ); Fri, 1 Nov 2019 03:45:35 -0400 Received: by mail-wr1-f66.google.com with SMTP id v9so8814194wrq.5 for ; Fri, 01 Nov 2019 00:45:33 -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=L3ntFqp0Br65sFjkR6CV5W+v78yDN2My2Y/1a4PurZc=; b=dnSa6iYhiNbdnjJmZ64ci22Ch8sTiVytWPZwp/hjW4bZZj9bX8HlNOYpLoAJtK5QAW Mjqohe0lpiN6BwInpgNQwBaMm48MYcx6CmBAjKRAXH7Ehq5xE64nuEyjgqn6s/vuwoo3 6vTfUBcQyK5pt++HyFRgz/y4lBQg0/NNs+GOae3rK+gMX+/aEsXaOOuk5NyQs2YoEchD flDohJEiKxDyuUWk6L+KAxXWJNP/GlaHVI+5rw7gBmd8ms7/mvM0CdudoEcElp7d6Lu+ 9C0eNZNkHRPYs0IIF5MtPX0dISfIH/38IYa/Ffo67/O4qa1tko1zJQn9o7W9W4rlmvFw VKSw== 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=L3ntFqp0Br65sFjkR6CV5W+v78yDN2My2Y/1a4PurZc=; b=gxqSvkF/fBs+54mUODH33nUl7cavm/KASqTW0tUhhjX38mAT8MuCjkHjmPPC9maMjf TPLFwUZzcLpXS7CilIre2ZiCUVYlJ3zzUL5EkqcTUhd8K/sf3w1LHGIxksVb/9BdNHOP SJNcycO1LmMjT7u7L9zeGEgeIOnPjVgvpKKU4wRTWtb8W/HTRg2jxlN7Hb8DkUw0+Ao4 ke0yIw14wNMPiu5LWxBCShl67JhGF6E+1SYKLBT1izEXm4qfg98hSNDpdsfT26o6UfBH a/v5ii77xUUfj6GEmtBUSLWNsb/ntFKOtRQZv6rQ9XfTzQ746+TXvj5xZqUmjzE+xvtw 1snw== X-Gm-Message-State: APjAAAUcQWApc/TPAV401DUoETsp6Cyhylm5tXZZ5K9HAvv4fKdb39Ny xHvR2eK68aLMqgN/jDKJgz+pyA== X-Received: by 2002:adf:9799:: with SMTP id s25mr9477755wrb.390.1572594332397; Fri, 01 Nov 2019 00:45:32 -0700 (PDT) Received: from localhost.localdomain ([2.31.163.64]) by smtp.gmail.com with ESMTPSA id b1sm576215wrw.77.2019.11.01.00.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 00:45:31 -0700 (PDT) From: Lee Jones To: daniel.thompson@linaro.org, broonie@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, arnd@arndb.de, linus.walleij@linaro.org, baohua@kernel.org, stephan@gerhold.net, Lee Jones Subject: [PATCH v4 10/10] mfd: mfd-core: Move pdev->mfd_cell creation back into mfd_add_device() Date: Fri, 1 Nov 2019 07:45:18 +0000 Message-Id: <20191101074518.26228-11-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191101074518.26228-1-lee.jones@linaro.org> References: <20191101074518.26228-1-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Most of the complexity of mfd_platform_add_cell() has been removed. The only functionality left duplicates cell memory into the child's platform device. Since it's only a few lines, moving it to the main thread and removing the superfluous function makes sense. Signed-off-by: Lee Jones Reviewed-by: Daniel Thompson Reviewed-by: Mark Brown --- drivers/mfd/mfd-core.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) -- 2.17.1 diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 2535dd3605c0..cb3e0a14bbdd 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c @@ -49,19 +49,6 @@ int mfd_cell_disable(struct platform_device *pdev) } EXPORT_SYMBOL(mfd_cell_disable); -static int mfd_platform_add_cell(struct platform_device *pdev, - const struct mfd_cell *cell) -{ - if (!cell) - return 0; - - pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL); - if (!pdev->mfd_cell) - return -ENOMEM; - - return 0; -} - #if IS_ENABLED(CONFIG_ACPI) static void mfd_acpi_add_device(const struct mfd_cell *cell, struct platform_device *pdev) @@ -141,6 +128,10 @@ static int mfd_add_device(struct device *parent, int id, if (!pdev) goto fail_alloc; + pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL); + if (!pdev->mfd_cell) + goto fail_device; + res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL); if (!res) goto fail_device; @@ -183,10 +174,6 @@ static int mfd_add_device(struct device *parent, int id, goto fail_alias; } - ret = mfd_platform_add_cell(pdev, cell); - if (ret) - goto fail_alias; - for (r = 0; r < cell->num_resources; r++) { res[r].name = cell->resources[r].name; res[r].flags = cell->resources[r].flags;