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] [day] [month] [year] [list]
Message-ID: <20190815130230.nhetv5zj4pqjxqj7@gofer.mess.org>
Date:   Thu, 15 Aug 2019 14:02:30 +0100
From:   Sean Young <sean@...s.org>
To:     Marc Gonzalez <marc.w.gonzalez@...e.fr>
Cc:     Ezequiel Garcia <ezequiel@...labora.com>,
        Brad Love <brad@...tdimension.cc>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Jonathan Neuschäfer <j.neuschaefer@....net>,
        linux-media <linux-media@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Guenter Roeck <linux@...ck-us.net>
Subject: Re: [PATCH v3] media: dvb: Provide 4 devm variants

On Mon, Jul 22, 2019 at 10:13:56AM +0200, Marc Gonzalez wrote:
> On 21/07/2019 17:02, Ezequiel Garcia wrote:
> 
> > On Thu, 2019-07-18 at 15:03 +0200, Marc Gonzalez wrote:
> >
> >> Provide devm variants for automatic resource release on device removal.
> >> Makes error-handling in probe() simpler, thus less error-prone.
> >> Once all resources are devmanaged, remove() is no longer needed.
> > 
> > I think it would be better to add this API as part of a series
> > that also uses it.
> 
> I have an outstanding RFC for a new driver:
> 
> 	https://patchwork.kernel.org/patch/11040435/
> 
> Locally, I've updated the probe function to use the proposed devm functions.
> 
> I was mainly hoping to get initial feedback from the maintainers.
> 1) See if they're OK with devm APIs

devm_ has some lifetime issues, wrt to disconnect. However, for a platform
device it is fine.

> 2) See if they're OK with the way I implemented devm APIs

Looks good to me.

> 3) See what's missing to get an Ack

Please submit both this patch and a the driver as a series.

Thanks,

Sean

> 
> static int tsif_probe(struct platform_device *pdev)
> {
> 	int err, virq;
> 	struct tsif *tsif;
> 	struct resource *res;
> 	struct dvb_frontend *fe;
> 	struct dvb_adapter *adap;
> 	struct device *dev = &pdev->dev;
> 	short num = DVB_UNSET;
> 
> 	fe = dvb_get_demod_fe(dev->of_node);
> 	if (!fe)
> 		return -ENXIO;
> 
> 	tsif = devm_kzalloc(dev, sizeof(*tsif), GFP_KERNEL);
> 	if (!tsif)
> 		return -ENOMEM;
> 
> 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tsif0");
> 	tsif->base = devm_ioremap_resource(dev, res);
> 	if (IS_ERR(tsif->base))
> 		return PTR_ERR(tsif->base);
> 
> 	virq = platform_get_irq_byname(pdev, "tsif0");
> 	err = devm_request_irq(dev, virq, tsif_isr, IRQF_SHARED, "tsif", tsif);
> 	if (err)
> 		return err;
> 
> 	tsif->clk = devm_clk_get(dev, "iface");
> 	if (IS_ERR(tsif->clk))
> 		return PTR_ERR(tsif->clk);
> 
> 	err = devm_clk_prepare_enable(dev, tsif->clk);
> 	if (err)
> 		return err;
> 
> 	adap = &tsif->adapter;
> 	err = devm_dvb_register_adapter(dev, adap, "tsif", THIS_MODULE, &num);
> 	if (err) return err;
> 
> 	/* Not sure the diff between filter and feed? */
> 	tsif->demux.filternum = 16; /*** Dunno what to put here ***/
> 	tsif->demux.feednum = 16;	/*** Dunno what to put here ***/
> 	tsif->demux.start_feed = noop;
> 	tsif->demux.stop_feed = noop;
> 	err = devm_dvb_dmx_init(dev, &tsif->demux);
> 	if (err) return err;
> 
> 	/* What relation to dvb_demux.filternum??? */
> 	/* Do I need this object?? */
> 	tsif->dmxdev.filternum = 16;
> 	tsif->dmxdev.demux = &tsif->demux.dmx;
> 	err = devm_dvb_dmxdev_init(dev, &tsif->dmxdev, adap);
> 	if (err) return err;
> 
> 	err = devm_dvb_register_frontend(dev, adap, fe);
> 	if (err) return err;
> 
> 	writel_relaxed(TSIF_START + ENABLE_IRQ, tsif->base + TSIF_STS_CTL);
> 	devm_add_action(dev, stop_tsif, tsif);
> 	INIT_WORK(&tsif->work, handle_pkt);
> 
> 	return 0;
> }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ