Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3653979ybg; Fri, 25 Oct 2019 07:09:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNx48omZ8oSN5IGdAfzzgp+1jkNpoqw1rdsUgUvqrVgzw22gw4fLwWpkX10V8j6RjmDi4N X-Received: by 2002:a17:906:4a0d:: with SMTP id w13mr3659694eju.89.1572012572730; Fri, 25 Oct 2019 07:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572012572; cv=none; d=google.com; s=arc-20160816; b=VQymQsQqtgB2sS9p6IssmGdAjVFYIAn3PlOrLIvZQSAbNr+LBEsWh4LJF8Be/5FwUk M7YQlnZD5V3sOCwswQkrOmJHUkSOqK+AJMJFgdGIpqk2hrjEW7BEvNKaNa/bX0OnXp8H r4jVzybswav7mv3gbdjSYaTuAX/Tr5JFlpQR9VFlwznxBJp66PQTeW8d7UeG5H0ULWm+ QLImq5ljewnlXdxYDGGFqd5Vxe3a45xZvGfM8dAQO+J1QIZ3qP/laK5QRUBnSqcd6Bl8 vrBZlWw5eCHQVa6sEWTIr3g2WeVYCTojJ6j4HrvRPYAVL6bYniNTjvpFDVpemGq43LSB HdMA== 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=LHOyXu4LqYDTcB2MwV67QciReuGA+gSIbqPrvF1Pvm4=; b=NhFf0xN9PmG0v4V1Vk34wNTi5RhW2JI7flmDdVbVN7CpI4aaH34DT4t00wMp3D4FWG I+HLPb22fEnnd2E2pfJjerA/p6hfNcZZNFleBPU0PlFpFgAte0LUzzaZN3RUL9Ma6TAo mpA1ZjwKCb0Z29ukejjs24rs4/VdFYhNicRy8Skdn/M2hkABRz70oFvXowokdSJVvWNj R74TDdSDOoijZO8K+A7VPgegvDfLeXqDUJ4KxuIl9UEdI6096m/gsTZFhoEBnhP74igO nOaFUqVEJsgO7GW9vY0zn2n06HIqf6G/mUKQHg9W6BDWveQyB9Z/u7tB+rqmV4Iom+bT A3RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=exAyRgPo; 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 dk11si1301887ejb.97.2019.10.25.07.09.07; Fri, 25 Oct 2019 07:09:32 -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=exAyRgPo; 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 S2503624AbfJXQjL (ORCPT + 99 others); Thu, 24 Oct 2019 12:39:11 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:35244 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503551AbfJXQis (ORCPT ); Thu, 24 Oct 2019 12:38:48 -0400 Received: by mail-wr1-f66.google.com with SMTP id l10so26413214wrb.2 for ; Thu, 24 Oct 2019 09:38:47 -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=LHOyXu4LqYDTcB2MwV67QciReuGA+gSIbqPrvF1Pvm4=; b=exAyRgPo0tbJRTibAfJNkRf5NqiS7Ggg8h7mHvZ93UuWH2HxFLfuM+W2DRhuQ3qGGe 873Cwjby6hyu8499QtMvCUQtoiPQlnls1+CUQAl+qaV3cPMqI6WRcvL+uk/WNtrf1f3O V63sZiuElS1jIMoYNlFn6Qaif3JuuBTrukVtupm8yy0kK3BYvzaoaayGklWl7Nmj7bfQ MPKHe5ssUy6qZEWe0Lk2q1Zyo8YuhhrVyzXNbOU8foIv9fitdgPO/Cq580RJgByiKLik r4GpUfpfyrc3VEJqT5q86Px1YIobxXVM+oEi/sdSo1Q8HcJpmdMlS+V23XpuIu3ixY4x 9Ywg== 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=LHOyXu4LqYDTcB2MwV67QciReuGA+gSIbqPrvF1Pvm4=; b=Hcz7ZhJiQqGjsFwRwWwRycRx+okwZXcKPeP3biNidPs8iAXNyIPJZgOKQZ5aW4/0JS hFxa33CyTdNvv9Upkv4q0frCTAORlv74os8GHv7oiiMb0OBymnYl/EsBM4AZm7aonZQV RwWdzkneNxKgdZZFelXKgoiZ0NNHQsYE6/C5pPTbwMfXvOC34IfpptP2D8gw7/eqJQRW clQ8K52zBHkTDJ8/WZYsamWr2nABHQlLyXll7liP5TgP5NPU0q5tG8JS3LKloik/k/GG qr8A5BglgfosTMPu0x2lh/NVoRYJhnNGdHvIBnfc43ax9ncN8432J1JfCJDGYruugXYJ aGyw== X-Gm-Message-State: APjAAAVON11DEMHEIZ1LCfG15kInf/EAPzQmF5pm4noPO1yPbVF63H9e 2tdCCUlOxdR8xUwLMcYI+QGHJQ== X-Received: by 2002:adf:e50a:: with SMTP id j10mr4493921wrm.352.1571935126970; Thu, 24 Oct 2019 09:38:46 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.99]) by smtp.gmail.com with ESMTPSA id 6sm3446175wmd.36.2019.10.24.09.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 09:38:46 -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 v3 10/10] mfd: mfd-core: Move pdev->mfd_cell creation back into mfd_add_device() Date: Thu, 24 Oct 2019 17:38:32 +0100 Message-Id: <20191024163832.31326-11-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191024163832.31326-1-lee.jones@linaro.org> References: <20191024163832.31326-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 --- drivers/mfd/mfd-core.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) 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; -- 2.17.1