Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4105698ybg; Mon, 21 Oct 2019 03:59:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3htff9YpTPKWhhibiHUwqdvdN9qgQl9uCxchYzvYUFDkJbwV2XsNlo0SMsNjsPv4h0H8g X-Received: by 2002:a50:b6cb:: with SMTP id f11mr2442175ede.299.1571655561288; Mon, 21 Oct 2019 03:59:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571655561; cv=none; d=google.com; s=arc-20160816; b=Ze3e8yZ/E08Ku8bH4clWyf5Txzf4aOsxXKJGpMdNo5L3lIi+yQdjPReOB6cwNoOslu OtTJAuNznp6Vd1vaDbBBfhDwkg66Bnm7NeWlh2iaq1llidao3vGXzi1h+cCJryzrYxTS 7VKrskM6cM4qmnnMt8DrXpSl4Tk88axDtYwjqfwlHZ5ZBVpfmSUUhHn213zjvh35wsra XnsE/6rR2qYxjE1w+dBffkw0CNSaAaXVgANR3kv3xK6o7QDgZtvDa1s/Qk4CnN3Nr+Vj 3RrADNZWs4YfFERy1lY79czhHqSsUScYr61znaBcTC2KPpA7m8h+yO+3GOGC3KCVAjkF sakw== 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=aRIsIrxJRG4WGhOzej9X0cMyz5OqcLFYkbUiKyLomGE=; b=vBKisRaOOQbsGPHE2pM1Yz4C4LsRC2tPDjY0WEpTlu9xXNojn7wnTc1XzYdcm8NCUO hoDB+PkhSunQ/4xVH/PB951BR0GnlKz4PSh4r8kCZk3dAjcVwAD2Zv5VzzUB/rrJZWNT r0oKypo6PbacPg0QYWV2v9BbOQ50GXc9UdCi4RQIxJCXFS42Ty+t8zCDz3IS1mv51oPW 9lr/LKgDch2Auf2siiTwVz8QOAbrVY49fkQZNj2F2u4g2hYsojRc9iv2hs2hkptJOlDm gy5gmVF6Nm8XH194yqEPXYd4Y/PDrIoUKga/ghKTdQFvtAZulOB9BQ/NhJS2XLBL9Iri qxTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cTeiB4Qc; 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 k51si2901309edb.411.2019.10.21.03.58.58; Mon, 21 Oct 2019 03:59: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=cTeiB4Qc; 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 S1728360AbfJUK6h (ORCPT + 99 others); Mon, 21 Oct 2019 06:58:37 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35561 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728287AbfJUK6g (ORCPT ); Mon, 21 Oct 2019 06:58:36 -0400 Received: by mail-wr1-f65.google.com with SMTP id l10so12992728wrb.2 for ; Mon, 21 Oct 2019 03:58:34 -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=aRIsIrxJRG4WGhOzej9X0cMyz5OqcLFYkbUiKyLomGE=; b=cTeiB4QcI/9D1UCeh1hzV+1od3PVVBhQlL72xj03bVUzMnwFnJarkT3Uqedx1NfBAs VYsdVW/U+jL6mmMApxUm7s8EdbLDQ34lDiQMVyO9e5xbSkHQ92Y3/3wKHbOlES7D+Q9a AKRv2JAi+ZPKpEzpS6yO7Nf7cRoCEXJebv27MfESjaxI9K2IO1OZJRf3ShNdo2GSHebK 6VZoPHGPCibQycGVei+Ls5x1pYadk/6OK3pre7jjZbewtrAt0cEbQ59GI1uCS7ri9dRb foXS/X1MFU+gZDuV21M+EN9A04hTB6AvIaaOWnpSGeDfWgQNuXi0Xg3Ned6IUGuMXaRC bjtw== 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=aRIsIrxJRG4WGhOzej9X0cMyz5OqcLFYkbUiKyLomGE=; b=AMuVirigt5A/YFoo5PMrccNLVMNrrKg9Z/W/mv1pgYtssT182/1pBbjyk0qvEJChmz 0AHgrwtjKX1zWaPYMyT1SLGWa2nTkIQ/3hO+Ig0U/OYoyYeZ9jzWKYHhUFDxCDppPZIe E3FTwHPqefATqrIg8xq5s1Yx5In8OtAj/SOMCSE40n6yAySof7QkEeHrY1+DTuVDpp+i e9e1MVVFhlQCnxZesrTu/AoVPFtdu9/cOhhzKC/mowp3wuZe6Efl6ejeXFG3PHBKEz8k JgAe1J/ItL6J/d0zNDTvyVIEIJq1p9TZJMpYevtYdAZ9LrukkgA2wDX0doKJ4CNxINix BXFw== X-Gm-Message-State: APjAAAX2Ze1+/4xACW3+7swcm8SjUXoYRK5Pwz5BX7Y5flb8bhzlcSKT EPXYIGzfPnMY9BpBH6sPhvD2lg== X-Received: by 2002:a5d:5401:: with SMTP id g1mr9448965wrv.54.1571655514185; Mon, 21 Oct 2019 03:58:34 -0700 (PDT) Received: from localhost.localdomain ([95.149.164.99]) by smtp.gmail.com with ESMTPSA id q22sm12544289wmj.31.2019.10.21.03.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 03:58:33 -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 9/9] mfd: mfd-core: Move pdev->mfd_cell creation back into mfd_add_device() Date: Mon, 21 Oct 2019 11:58:22 +0100 Message-Id: <20191021105822.20271-10-lee.jones@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191021105822.20271-1-lee.jones@linaro.org> References: <20191021105822.20271-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 5d56015baeeb..849dbe3798b0 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