Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4668885pxv; Tue, 29 Jun 2021 12:35:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1WYAAOx5TkzCA0ZvFSSO4nghU0jP6062RLU2A0TZ+9OvqGY7wHc7HWPOodlRaO/zox3B3 X-Received: by 2002:a6b:d115:: with SMTP id l21mr5299412iob.130.1624995333838; Tue, 29 Jun 2021 12:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624995333; cv=none; d=google.com; s=arc-20160816; b=yrwgkXrQI0kFEUaKwsE0BAgeyc95ph7QG0HadHDWGbZOIBwtfg3KJ/FX5tC6yS7rrK vw4bQiZyGpcH3FkTowS0950havRJClqQczMOy7TwI3idQBiAh8gjOOvG4yqCgqwx2FEA 0GWupleuqFGc/8qfiGJrsgFBGX1Y/Q/paHoSMsGl6MZEl/bfYAxtBhQLd3837zodO8uZ qvD2It33C47g+lMD1+eAfRjq8FjDzMH9xDXCMvPo1NfPLXe65ngz+GbH35LCJ1nrIbwT g3rPO96d/o2LxIzGwU9uPUoJDwu9HvdTKcgUs8HY4PMw1TNUAlOHphttsDRHgzlp8dJ7 96QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=sHz8iA3+4/3sqRmiKryfrw0XCYC/ogNN33S9sZg+egI=; b=ILkbNf6EXDWSjBsF466q+fyATbqPn4NEjseY+4luFWpNnyn2br3i33FB3yWcj0rrsV fWxJL82Odg/fGvFnDsFCsClSE6fTBmLFjQZb3JOvAzHhkMtHMZvfUAQ09qv5EQ7omVGR jNAyQOg9LykXhh9M88l5O7ke6w0OGDvL1drtCtCRr+G6D9EzzIlLHwG6ynXa9YBWazNX 9fZArTDtKcbnMHwJQc5Obkld3nD22LDube2YXgAg3vrHuKSe+SW3o8CcZ+KA77ahYjiv +1Mmw/2HGnsNzwcmkQb15e1n1hK4UnM9DTiZ7tUDWduXk6P7zyxYV/GGXb0hsFEn7H8n xdaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OtoOXB+Z; 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 z10si22043092ioq.37.2021.06.29.12.35.20; Tue, 29 Jun 2021 12:35:33 -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=OtoOXB+Z; 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 S235172AbhF2Tea (ORCPT + 99 others); Tue, 29 Jun 2021 15:34:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:34360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233670AbhF2Te3 (ORCPT ); Tue, 29 Jun 2021 15:34:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EB5F861DE7; Tue, 29 Jun 2021 19:31:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624995122; bh=7qlnV8Wl2x3Qvv6mjcrc1tpRP72lSFEAs94lptLsNag=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=OtoOXB+ZI2h/+SJgHhKPPbLYyNLu+3r1mZ0jlff2s5A9AoMdTxn6fPhhWbOZ0rPp0 2dKDi3WiNCr6Pe+7sD7CS+x/IKX48v4o+ceYEd9ONlxoUvyawzS5YwelmiRgqHB3y2 7VQ5LrQkfVsUji2I7nDdwL0xyngSsUeAhp0DnttnMvKPo9NGGFu/zlA4g/SU5DljFV 5ZYt9sz/wVIGnx6mCmlDwdJ/xso5eExSp2xc613M2T2VxEmBpOUDJlxVecHCmEsJ5g EyF3BMnAlTr9WZiUntFPqZxaDUTj9KyuxtJ5S6LigcoB1S2qCjApxGw06nK+UUZZMH E4zkSGIxq4jxg== Date: Tue, 29 Jun 2021 21:31:56 +0200 From: Mauro Carvalho Chehab To: Mark Brown Cc: Greg Kroah-Hartman , linuxarm@huawei.com, mauro.chehab@huawei.com, Axel Lin , Lee Jones , Arnd Bergmann , Liam Girdwood , linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev Subject: Re: [PATCH v10 2/5] regulator: hi6421v600-regulator: fix platform drvdata Message-ID: <20210629213156.56e6f126@coco.lan> In-Reply-To: <20210629151101.GB4613@sirena.org.uk> References: <20210629151101.GB4613@sirena.org.uk> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, 29 Jun 2021 16:11:01 +0100 Mark Brown escreveu: > On Tue, Jun 29, 2021 at 12:31:28PM +0200, Mauro Carvalho Chehab wrote: > > > platform drvdata can't be used inside the regulator driver, > > as this is already used by the MFD and SPMI drivers. > > Can you clarify what exactly is using which platform drvdata already? > This all feels very confused and I can't tell what the problem that's > being fixed is, if it's a real issue or how this fixes it. I don't remember the dirty details anymore... It has been almost a year since when I started doing that. The SPMI controller driver left staging 8 months ago. I guess it is related with passing the parent's device to devm_regulator_register() at the hi6421v600-regulator driver: struct regulator_config config = { }; ... config.dev = pdev->dev.parent; ... rdev = devm_regulator_register(dev, &info->desc, &config); This is needed by SPMI bus and the SPMI controller in order to use the right platform data when talking to the hardware. > > drivers/misc/hi6421v600-irq.c | 9 ++-- > > drivers/regulator/hi6421v600-regulator.c | 49 +++++++++++---------- > > drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 18 +++----- > > include/linux/mfd/hi6421-spmi-pmic.h | 25 ----------- > > I'm especially nervous about the core driver still being in staging > perhaps meaning there's some issue with it doing odd and confusing > things. The only missing part in staging is the MFD driver. At the current way, it is very simple (71 lines in total): it just declares a regmap, and has a single function on it: static int hi6421_spmi_pmic_probe(struct spmi_device *pdev) { struct device *dev = &pdev->dev; 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); ddata->dev = dev; dev_set_drvdata(&pdev->dev, ddata); ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE, hi6421v600_devs, ARRAY_SIZE(hi6421v600_devs), NULL, 0, NULL); if (ret < 0) dev_err(dev, "Failed to add child devices: %d\n", ret); return ret; } You can see the full driver's code at: https://lore.kernel.org/lkml/8d871e2ccc544d11959c16d8312dbf03dd01b1c8.1624962269.git.mchehab+huawei@kernel.org/#Z30drivers:mfd:hi6421-spmi-pmic.c I'm not aware of anything left preventing it to leave staging. Thanks, Mauro