lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 4 Apr 2023 10:15:28 +0200
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Herve Codina <herve.codina@...tlin.com>
Cc:     Lee Jones <lee@...nel.org>, Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, alsa-devel@...a-project.org,
        Christophe Leroy <christophe.leroy@...roup.eu>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v5 2/5] mfd: Add support for the Lantiq PEF2256 framer

On 04/04/2023 10:07, Herve Codina wrote:

>>> So, the structure I have in mind:
>>> - pef2256.c (MFD)
>>>   implement and do the setup at probe()
>>>   Add the children at probe():
>>>     - pef2256-pinctrl (pinctrl) added using mfd_add_devices()
>>>     - pef2256-codec (ASoC codec) added using devm_of_platform_populate()
>>>
>>> Lee, with this in mind, can the core pef2256.c be a MFD driver ?  
>>
>> You do not use MFD here, so why do you want to keep it in MFD? If you
>> disagree, please tell me where is the MFD code in your patch?
> 
> I don't want to absolutely use MFD.
> I just want to put my driver somewhere and I don't know the right location
> between MFD and Misc.
> 
> Basically, the driver needs to do (little simplified and error path removed):
> 
>   static const struct mfd_cell pef2256_devs[] = {
>   	{ .name = "lantiq-pef2256-pinctrl", },
>   };
> 
>   static int pef2256_probe(struct platform_device *pdev)
>   {
> 	struct pef2256 *pef2256;
> 	void __iomem *iomem;
> 	int ret;
> 	int irq;
> 
> 	pef2256 = devm_kzalloc(&pdev->dev, sizeof(*pef2256), GFP_KERNEL);
> 	if (!pef2256)
> 		return -ENOMEM;
> 
> 	pef2256->dev = &pdev->dev;
> 
> 	iomem = devm_platform_ioremap_resource(pdev, 0);
> 
> 	pef2256->regmap = devm_regmap_init_mmio(&pdev->dev, iomem,
> 						&pef2256_regmap_config);
> 
> 	pef2256->mclk = devm_clk_get_enabled(&pdev->dev, "mclk");
> 	pef2256->sclkr = devm_clk_get_enabled(&pdev->dev, "sclkr");
> 	pef2256->sclkx = devm_clk_get_enabled(&pdev->dev, "sclkx");
> 
> 	pef2256->reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_LOW);
> 	if (pef2256->reset_gpio) {
> 		gpiod_set_value_cansleep(pef2256->reset_gpio, 1);
> 		udelay(10);
> 		gpiod_set_value_cansleep(pef2256->reset_gpio, 0);
> 		udelay(10);
> 	}
> 
> 	pef2556_of_parse(pef2256, np);
> 
> 	irq = platform_get_irq(pdev, 0);
> 	ret = devm_request_irq(pef2256->dev, irq, pef2256_irq_handler, 0, "pef2256", pef2256);
> 
> 	platform_set_drvdata(pdev, pef2256);
> 
> 	mfd_add_devices(pef2256->dev, PLATFORM_DEVID_NONE, pef2256_devs,
> 	      		ARRAY_SIZE(pef2256_devs), NULL, 0, NULL);

Wait, now you use MFD framework, so the driver is suitable for MFD.
Before there was nothing like that in your code.

Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ