From patchwork Thu Oct 24 16:38:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 177547 Delivered-To: patch@linaro.org Received: by 2002:ac9:3c86:0:0:0:0:0 with SMTP id w6csp2400618ocf; Thu, 24 Oct 2019 09:39:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxs/VnyqqOlcjEXZFesNcOrtcqp1i0h6yqM2CiRvPAZw43bRJTXaPUFzk3AQsNp5LRs2sfP X-Received: by 2002:aa7:c502:: with SMTP id o2mr5533507edq.223.1571935155991; Thu, 24 Oct 2019 09:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571935155; cv=none; d=google.com; s=arc-20160816; b=xpMIedItad/SNW8Xww0NC1LnxWVnQu79Ok31Jv1AmuJG6UvZ+05OuePryr98G8Vc1t R0kmWbTim451T/yDwx2JIjBD+COTGzYiZn6ioLsurx1uKuhdrD+bCvsWB7mZ3FeGN5mV js0HldPRHlPMiDWRO79WAYglUNsqoO5k6XSINUJk/IlI0vCxth9Q8DrlcKhCk3jS0jX+ ALsuEVZM2UuExFTVeyhcdHtzn36hk4TX6RhSebPNBB+jmPxpaiqkbIGQ/SSycwtQHfc3 HQ/Fr/HGkC34/pMub/YYZoZBJiZkh6UqF7N7bhmHHKyreMBrKpNOrc/+rvIGpu/Qpf1a Ct8w== 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 cf22si6096432ejb.290.2019.10.24.09.39.15; Thu, 24 Oct 2019 09:39:15 -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 S2503628AbfJXQjM (ORCPT + 26 others); Thu, 24 Oct 2019 12:39:12 -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(-) -- 2.17.1 Reviewed-by: Daniel Thompson Reviewed-by: Mark Brown 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;