Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3656755pxv; Mon, 5 Jul 2021 02:40:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmgc9R7wSM9cuS+LQyPTmx+bUlrdTVIjAd5k5cruda3zMSyGs1C4G8BaZYhvwGeEHxc04q X-Received: by 2002:a05:6402:148d:: with SMTP id e13mr14965342edv.28.1625478053591; Mon, 05 Jul 2021 02:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625478053; cv=none; d=google.com; s=arc-20160816; b=QebXgdofPRb/OzwkNPq1IFY8ZenbIgoE4XNXGYTuiRgJHc2xjcec+fHTOu64wYQUs5 YUo81HUqS94uBwHvzKWDV7wE6Bmyb9DPvsNJpGVLJmEHsCMzz9J91SWZdeO8FJFV73ws t3FvU8OGuSpODc4dmv7QTftdfR5EGUTmgap5bf1AGn63QZAyqjkZNHo/fauEmGWhHwgY 2A3hZd+En7QK3yDZCME4E/OVPxaZIdXxPyIFZdwX0h5xXTPZeimBgl36AtAWgHFS8VHK cWTjmCmQuxzFxXDlRvzGwEnt3+tv/0GKmdpY2P3iMZPvCq7fsSBsef6J/XnjMeSoNPYU RiGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jg7VYf5NSJHT/QY2eSVo8A09elpPYuvqQVDQvyg2yTw=; b=PQOCLNq6owhbvcesWvzAds1W7H8/I1bxM8YU2JSrAkSfpE3Shz1K2d/R+nEGyToF8m kH8AEjRJe5N4vvtWZNb5/zcDfInFEei2Flek5hdK2Jg/NT3eIM2aF2QFYW0gv9Nv4kmy SvmkllFRZYUp+r2iv1CE+cP6e/WxkYtm0Inb+Q+ZKXdGlOSjXG+Hzm+YKBskY5V4sBAH 7ZTArcLI44O45E6caR6L18mtv1s+hYJUHV8SkTycdo/BEVwc2WPYg6Q03Vc0oAfM9PwD B9AssgAf+d2U+UWaoG092mSjjjdkfMR9cDqbgTTkYGTPNhi+nYMWzIgDWD6mdLJ6/eyh RvFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iqK07QTO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si11061159edt.425.2021.07.05.02.40.30; Mon, 05 Jul 2021 02:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iqK07QTO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230511AbhGEJlt (ORCPT + 99 others); Mon, 5 Jul 2021 05:41:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:57166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbhGEJlj (ORCPT ); Mon, 5 Jul 2021 05:41:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6B549613F6; Mon, 5 Jul 2021 09:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625477942; bh=UPSKwXDLNPPYMIBA/yD1R/m38gQ0EZ+Be21kk2EY/dQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iqK07QTOGwq90v7Yt0tSpkarV/7lXcPP9C540oSSIOUaQKUWDoWFFrJfZK73nKBgi Sxl3tdhO82x6R5FJZrmCNrhfFUaxbr1cFBG/LftyxPLx9/T7DitggSg3bfsqQtv/ZK If2+Hn4NxUrRTn/4eYC2iRvy5rAaZpA87+eV3j+6q+02bDf2LttVZHm6YTlnYI/S4b pdbn6NhKMQ+qQtxFyNrxjgWVY/EXw9DKyJaePGpPJAIGygGCRTLa0qyOP1HGZ9axYJ QZhH2CArc+U9SwrvhTkOpIbH90EXQ3GhNpMCLu3x6RA1uzhquiisIHFkjBZYYiwppO 5MnlcaI7PuUVQ== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1m0L43-002tow-CN; Mon, 05 Jul 2021 11:38:55 +0200 From: Mauro Carvalho Chehab To: Greg Kroah-Hartman Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Arnd Bergmann , Lee Jones , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH v12 5/9] staging: hi6421-spmi-pmic: cleanup drvdata Date: Mon, 5 Jul 2021 11:38:46 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are lots of fields at struct hi6421_spmi_pmic that aren't used. In a matter of fact, only regmap is needed. So, drop the struct as a hole, and set just the regmap as the drvdata. While here, add a missing dot at the Huawei's copyrights. Acked-by: Mark Brown Signed-off-by: Mauro Carvalho Chehab --- drivers/misc/hi6421v600-irq.c | 9 ++++---- drivers/regulator/hi6421v600-regulator.c | 10 ++++----- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 16 +++++-------- include/linux/mfd/hi6421-spmi-pmic.h | 25 --------------------- 4 files changed, 14 insertions(+), 46 deletions(-) delete mode 100644 include/linux/mfd/hi6421-spmi-pmic.h diff --git a/drivers/misc/hi6421v600-irq.c b/drivers/misc/hi6421v600-irq.c index 04623557ec3c..fd9d7223a202 100644 --- a/drivers/misc/hi6421v600-irq.c +++ b/drivers/misc/hi6421v600-irq.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -220,7 +219,7 @@ static int hi6421v600_irq_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = pmic_dev->of_node; struct hi6421v600_irq *priv; - struct hi6421_spmi_pmic *pmic; + struct regmap *regmap; unsigned int virq; int i, ret; @@ -229,8 +228,8 @@ static int hi6421v600_irq_probe(struct platform_device *pdev) * which should first set drvdata. If this doesn't happen, hit * a warn on and return. */ - pmic = dev_get_drvdata(pmic_dev); - if (WARN_ON(!pmic)) + regmap = dev_get_drvdata(pmic_dev); + if (WARN_ON(!regmap)) return -ENODEV; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -238,7 +237,7 @@ static int hi6421v600_irq_probe(struct platform_device *pdev) return -ENOMEM; priv->dev = dev; - priv->regmap = pmic->regmap; + priv->regmap = regmap; spin_lock_init(&priv->lock); diff --git a/drivers/regulator/hi6421v600-regulator.c b/drivers/regulator/hi6421v600-regulator.c index 916d4e1f9061..23cdf90944e9 100644 --- a/drivers/regulator/hi6421v600-regulator.c +++ b/drivers/regulator/hi6421v600-regulator.c @@ -9,8 +9,8 @@ // Guodong Xu #include -#include #include +#include #include #include #include @@ -237,7 +237,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) struct hi6421_spmi_reg_priv *priv; struct hi6421_spmi_reg_info *info; struct device *dev = &pdev->dev; - struct hi6421_spmi_pmic *pmic; + struct regmap *regmap; struct regulator_dev *rdev; int i; @@ -246,8 +246,8 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) * which should first set drvdata. If this doesn't happen, hit * a warn on and return. */ - pmic = dev_get_drvdata(pmic_dev); - if (WARN_ON(!pmic)) + regmap = dev_get_drvdata(pmic_dev); + if (WARN_ON(!regmap)) return -ENODEV; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -261,7 +261,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) config.dev = pdev->dev.parent; config.driver_data = priv; - config.regmap = pmic->regmap; + config.regmap = regmap; rdev = devm_regulator_register(dev, &info->desc, &config); if (IS_ERR(rdev)) { diff --git a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c index 46dc1b856217..f63ba73c9e33 100644 --- a/drivers/staging/hikey9xx/hi6421-spmi-pmic.c +++ b/drivers/staging/hikey9xx/hi6421-spmi-pmic.c @@ -8,7 +8,6 @@ */ #include -#include #include #include #include @@ -30,19 +29,14 @@ static const struct regmap_config regmap_config = { static int hi6421_spmi_pmic_probe(struct spmi_device *pdev) { struct device *dev = &pdev->dev; + struct regmap *regmap; int ret; - struct hi6421_spmi_pmic *ddata; - ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); - if (!ddata) - return -ENOMEM; - ddata->regmap = devm_regmap_init_spmi_ext(pdev, ®map_config); - if (IS_ERR(ddata->regmap)) - return PTR_ERR(ddata->regmap); + regmap = devm_regmap_init_spmi_ext(pdev, ®map_config); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); - ddata->dev = dev; - - dev_set_drvdata(&pdev->dev, ddata); + dev_set_drvdata(&pdev->dev, regmap); ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, hi6421v600_devs, ARRAY_SIZE(hi6421v600_devs), diff --git a/include/linux/mfd/hi6421-spmi-pmic.h b/include/linux/mfd/hi6421-spmi-pmic.h deleted file mode 100644 index e5b8dbf828b6..000000000000 --- a/include/linux/mfd/hi6421-spmi-pmic.h +++ /dev/null @@ -1,25 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Header file for device driver Hi6421 PMIC - * - * Copyright (c) 2013 Linaro Ltd. - * Copyright (C) 2011 Hisilicon. - * Copyright (c) 2020-2021 Huawei Technologies Co., Ltd - * - * Guodong Xu - */ - -#ifndef __HISI_PMIC_H -#define __HISI_PMIC_H - -#include -#include - -struct hi6421_spmi_pmic { - struct resource *res; - struct device *dev; - void __iomem *regs; - struct regmap *regmap; -}; - -#endif /* __HISI_PMIC_H */ -- 2.31.1