Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4639301pxb; Tue, 28 Sep 2021 00:02:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsUCAYEfOVcXuvNWTTlhkuTZkH+iMza1wbsrjnTAPaRX5c9Qc3tlIv7yh7QFwO1UaDG5LW X-Received: by 2002:a17:906:7804:: with SMTP id u4mr5069194ejm.462.1632812540859; Tue, 28 Sep 2021 00:02:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632812540; cv=none; d=google.com; s=arc-20160816; b=c1yUfhgQbgP8XNsQKi5Ux/hY4ZQ3UST4S3uW84c3+rlQtAUIE4ze+EQwU5vk9D3AcP M7OkzKsopFO25pN0Zos8cd7IAmlWEv1IBQQ1qtw0lSOj9iYrykjQrU29WfU5gTSDJdU7 IeOna+f+BJ7VDGSNo5rWA4J8vXAfILAxstpbZxCvo3JwIsWAMEANZbGxodjFD6b3LBBv YO1YjqzhvdyKUi1sz4h1mA+VksvP+q7brG16JQ94WYLD2I1qEtjhhchYwlseJ+yfO4oa WRrdtM0X8SrIt1ph3v5JnbALoL5o0CvUpLonGAY73k9/UjSl0yLRkN2Sk/Jd+w+/ZO5J ra2w== 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=CxRwXZyrFM0R5ksimEeM4YNMSELXlKaQdekJa55wl9I=; b=Iwa4SxwLlDuIJJ5uciBM665vKqAB3ElQekWIVZ2APtGaWmfa9H/1al/jUNSMFBosjq +KQCyFTveKruHbM/fLcVWQD1ZsMfcvZ8P6jXT5uKnMh+5RZpqd2XvC2/Gsc6lUDKohAB fAcXOEc1gDnSwKdOWfEL7W0b+27pB7jGeFiSXn1yfH2ofnUFaeOTUOKbspF+LHg270bs SyLZBA1eypbbtMqZ8gPSKYIg8SD27ZRzC75jQUcEBm5M30WUiB34NlQKZ0XaaVy311Xw 8jJAvBFNXLhMQodnpm1JrNqmHfwW+X5Iw+ni559P0sOfFDE2nVSF9Ag8KhcQ9ubGilgN jFlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ACVWCWjf; 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 qw30si5274897ejc.104.2021.09.28.00.01.56; Tue, 28 Sep 2021 00:02:20 -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=ACVWCWjf; 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 S239054AbhI1HAH (ORCPT + 99 others); Tue, 28 Sep 2021 03:00:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:38990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239024AbhI1HAG (ORCPT ); Tue, 28 Sep 2021 03:00:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 635D4610A5; Tue, 28 Sep 2021 06:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632812307; bh=lp8MP9YioyCUAmP0PSXCMeBeQXDIBgFJrhSJhdMz+18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ACVWCWjf6M9KkhqrzNSygYmGx9hgm6fA9KXFrhq9jyBC4We26Iruu9Fd3b81yQXD/ Zl2k5kpV9LBGv+/TV1hqyGyJI0QhouBcXhIAI4p/hUDW4tBF0rPicNth9ov9HioX0i PfhgxxtCmFzVo4QVXcUTRfDMDO6rYg6AIPJ3nXWaHTPc41TXcp6AQFIFrtyHqYN4de viU5+PtJbwwIcMgXgF9lUQQ98O/Pkc4yqy6sBVPPzchQ+21RkRjr2XZ6bGDKqVn/Z1 v6039hkhtyQQH5AwowaHiB6kicvR7p2MC8r76/WowswrHXcDLDTV1P9Bu3aippXfsO TkXiwlneZiKeg== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mV74L-000R2y-B7; Tue, 28 Sep 2021 08:58:25 +0200 From: Mauro Carvalho Chehab To: Lee Jones Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Arnd Bergmann , Greg Kroah-Hartman , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org Subject: [PATCH v2] mfd: hi6421-spmi-pmic: cleanup drvdata Date: Tue, 28 Sep 2021 08:58:19 +0200 Message-Id: <0cc63f19506ea78d3a1c111774c97bbbc1a9a292.1632812219.git.mchehab+huawei@kernel.org> 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 in struct hi6421_spmi_pmic that aren't used. As a matter of fact, only regmap is needed. So, drop the struct as a whole, and just set the regmap as the drvdata. Acked-by: Mark Brown Acked-for-MFD-by: Lee Jones Signed-off-by: Mauro Carvalho Chehab --- drivers/mfd/hi6421-spmi-pmic.c | 16 +++++---------- drivers/misc/hi6421v600-irq.c | 9 ++++----- drivers/regulator/hi6421v600-regulator.c | 10 +++++----- 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/mfd/hi6421-spmi-pmic.c b/drivers/mfd/hi6421-spmi-pmic.c index 4f136826681b..c9c0c3d7011f 100644 --- a/drivers/mfd/hi6421-spmi-pmic.c +++ b/drivers/mfd/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 *sdev) { struct device *dev = &sdev->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(sdev, ®map_config); - if (IS_ERR(ddata->regmap)) - return PTR_ERR(ddata->regmap); + regmap = devm_regmap_init_spmi_ext(sdev, ®map_config); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); - ddata->dev = dev; - - dev_set_drvdata(&sdev->dev, ddata); + dev_set_drvdata(&sdev->dev, regmap); ret = devm_mfd_add_devices(&sdev->dev, PLATFORM_DEVID_NONE, hi6421v600_devs, ARRAY_SIZE(hi6421v600_devs), diff --git a/drivers/misc/hi6421v600-irq.c b/drivers/misc/hi6421v600-irq.c index 08535e97ff43..1c763796cf1f 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 platform_device *pmic_pdev; struct device *dev = &pdev->dev; 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 662d87ae61cb..4671678f6b19 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/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