Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2065954ybl; Thu, 15 Aug 2019 06:05:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcS3wAnuWuYu0gl2AtzFwruxz4GiuTR/tr9IPppJV8LgWML4BGoeV9POxsRKoCLcgA7sYK X-Received: by 2002:a17:90a:1a1a:: with SMTP id 26mr2159676pjk.118.1565874345374; Thu, 15 Aug 2019 06:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565874345; cv=none; d=google.com; s=arc-20160816; b=fHGiR2VFNjSF8D3l7eqwGbhQK34RIy13F37twSylXp78nMaRgGhNiLXl/0K8TLOrsm XF5rFrNId+LHR7s8HBpjzjOzirw0CCSHKDOQTPZALnQ3Q9ZldCfOmS0jib022zBGnwtn J6RlMaDHX3cw7Qaf3HHyQHvsMX4q/+NKbpkPERaU2Zd6Tulu2ibxShZ5HoYDSogaz3aU rh649OleiClBkTIm3BjxQuPt2u/rNrXYIK951ZdIroYwW4HKRekNADhMEw/N3JaalN2m IFMyNaiur7jUcSx6gXQhXvCwAqpdEVoqXM15FIRDlku8EefCOktFKEoNHFgeiiL2hz8m PCFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=GiK69loFWv8ahowplYJyOqaZrqB8hOm07czE0sKNAjg=; b=cxAPxM/H4NXrOplveVc7ptJRPb1n6pMhuqkjx9JBMydF8PldUFwMG1VDolacY27+DW JfCHg6wLel5kWnKzvxo6TTqMZzmbbNKG36o5ghndOPbbk8PTM3ZHUnf86o/S/Wr5mvzD q55spUl3xvqs5FKCogWaW/JLFW38qUAnwd/ZP1/0LmpJ8gJ7v3hS2yYfOLSL5nBDKsqe 2BAsYNmMZ0X3RXUAU8ja/KR+immeTCt9aKt3Sju1vviqznD+DQVFUgurH/FNttyNnVM8 jzgA5zUIqLatt7UkV4+QUFHFcVaIt7lZ7C+1cXBjGYkzPdYXeYULkJHnJitb1QS1i6N+ qpxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d34si1364456pld.54.2019.08.15.06.05.28; Thu, 15 Aug 2019 06:05:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732048AbfHONCe (ORCPT + 99 others); Thu, 15 Aug 2019 09:02:34 -0400 Received: from gofer.mess.org ([88.97.38.141]:40135 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbfHONCd (ORCPT ); Thu, 15 Aug 2019 09:02:33 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id AED2B6078C; Thu, 15 Aug 2019 14:02:30 +0100 (BST) Date: Thu, 15 Aug 2019 14:02:30 +0100 From: Sean Young To: Marc Gonzalez Cc: Ezequiel Garcia , Brad Love , Mauro Carvalho Chehab , Jonathan =?iso-8859-1?Q?Neusch=E4fer?= , linux-media , LKML , Bjorn Andersson , Guenter Roeck Subject: Re: [PATCH v3] media: dvb: Provide 4 devm variants Message-ID: <20190815130230.nhetv5zj4pqjxqj7@gofer.mess.org> References: <068836c7-a116-7e6f-cbb2-f2176fbb9a38@free.fr> <64344008-4077-9948-4482-0878279b50e8@free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <64344008-4077-9948-4482-0878279b50e8@free.fr> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; > }