Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1771651imm; Sat, 4 Aug 2018 10:22:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc4wYPo+EX3onsdY+HF+5BJ2uDS3B/p7PCC3JU7elZPFtT/5wDzpQ6YqU6EwgWJd92YqvQe X-Received: by 2002:a62:5b85:: with SMTP id p127-v6mr3653836pfb.33.1533403345762; Sat, 04 Aug 2018 10:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533403345; cv=none; d=google.com; s=arc-20160816; b=R+IaVDjrI05QFNFYttxFlFQuiZ2vk3FDZqmYfxN3rnWU1ZIaxMSWOhR5tsCVHbZarr 79IsQlAHZ+jYm+QK3GL5oXDUfqDgNAyvHyqoy7gR4qOha/ee7/OBm+lxxVbhAQwMvEg4 KoYyiapVtZKCi/S1bXp+CaNAFrcg/hFM4u0HxWCa3hg8n64FD6mb2IV1Evxu8JOMLU/Q dDdTAhesMbpnbgccBRim/LYL7DKCOglvTLH/L/E4ru5PVjXoaWzvzRH2mG3T/FtCg6aN Za+VM8A1qfz8ciAqx+o02VCAh4YRWVvFWM7c9VcgwCmS4Dz3gp1xwKV1jEUV2ty6zbHE Hd0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=PQyQS929tzCkCRRLMSYGuMb48igEqErM2m3zoywlAB8=; b=qn/FdekwzzC2VM0IJT6I1rCQKz0E78B7LcOZBhWNF11bwRiQh5WO2QXq+1ug9J3q0d HclXW3ybq0J1QQzP0tG579M4k1U+vAdnLClK41XnuaNVT9AlA9aWyV2CmLBOFH58j7xw nbgkIE23284UkXcNRbIQ19U6RGTVUfhvPfWcfpZHfqiz6WEqH+w+kBqqViQk1T/DLChG AppsIjFfFAwa5y8Emh5WGggOtasBJpyu37mQzKwi0NCQho9yxQ/OuMDADc4naem9pKtp iaLClop8xkjgcgsvN7170LhCPQup14CrMC5yeoFHsjBnoODpN4HUNpB7CBwrWBTF5JTv v2nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jPa+2Ec+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10-v6si7917788pgh.310.2018.08.04.10.21.58; Sat, 04 Aug 2018 10:22:25 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jPa+2Ec+; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729035AbeHDTVy (ORCPT + 99 others); Sat, 4 Aug 2018 15:21:54 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:41363 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727953AbeHDTVy (ORCPT ); Sat, 4 Aug 2018 15:21:54 -0400 Received: by mail-pf1-f193.google.com with SMTP id y10-v6so4835198pfn.8; Sat, 04 Aug 2018 10:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=PQyQS929tzCkCRRLMSYGuMb48igEqErM2m3zoywlAB8=; b=jPa+2Ec+y4+GrpIv9zKkTRGDjCGFiWePaYQbLW92T5Bg1n8E5c6VVB31LBqkZtd8eN AOVrMUjFMnNArdbz1cRo1XvaGImZRhPHkm9VKH42+rd1H1V7uD4y2lLt1eFcSNN/9yky Ox+PciVtbE2I3FOAhwhI+5tOoeueBbhQxt3+mWzRNaH8B80x6EyKbfRKg0NJYm0xQfV8 IXzmWueI/GfF7On5lvPqqoHN2Gimftdd8h5+SNEmT4mZ9vPVin40aGGuFF/Gu6BFSU3j rWxtmvrCmAsdiWod8/oOA5AuxOmrth6pzFPKefdvyoFHg3ojyPOW3JWmj3v03yKfuj6k hUiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=PQyQS929tzCkCRRLMSYGuMb48igEqErM2m3zoywlAB8=; b=s1mbIuCMAHGr/uzwe3yyQWh3md/PlyzL9UcsqZ2xnoyWYWCM1QM2Sn1xFVqFn6s0aF YP/Nk7T8XWNQnceIR3EmY3W2hriP1jRJY49tUDc8Yy/J6q2yNbV+2PADEIpykHg7N+B0 98g2lEhkF7QeG061aAV6hXxL5pUjOKz+DGngJKIV5Iv5sGPv3bIz6Yr5ZyUVW4VWfuay vj/L9dTK6vHB15DH4iuxsxlOSkrrPimN8g+4oMw4Ognoja87elbk+vkNOrINQ2IFyj3U h0oGH7qenoJDQvjdaqSvTdP6X1krTjmPzlR/jT5iyDXGG1T5b9d2b35EzR3fa5+X0JML tReg== X-Gm-Message-State: AOUpUlGSEJsS8f8M+co3Q/UhZ6muSNbA6CRzKuGNmVHVdYVaWZL43Q1C vM8DxrGOCFn77jPddziZDqGGuP4I X-Received: by 2002:a63:6cc8:: with SMTP id h191-v6mr8356742pgc.359.1533403232628; Sat, 04 Aug 2018 10:20:32 -0700 (PDT) Received: from [192.168.1.54] (c-98-210-181-167.hsd1.ca.comcast.net. [98.210.181.167]) by smtp.gmail.com with ESMTPSA id q140-v6sm11126006pgq.11.2018.08.04.10.20.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Aug 2018 10:20:31 -0700 (PDT) Subject: Re: [PATCH v6 16/17] media: v4l2: async: Remove notifier subdevs array To: jacopo mondi Cc: Sakari Ailus , linux-media@vger.kernel.org, Steve Longerbeam , Mauro Carvalho Chehab , Sakari Ailus , =?UTF-8?Q?Niklas_S=c3=b6derlund?= , Sebastian Reichel , Hans Verkuil , open list References: <1531175957-1973-1-git-send-email-steve_longerbeam@mentor.com> <1531175957-1973-17-git-send-email-steve_longerbeam@mentor.com> <20180723123557.bfxxsqqhlaj3ccwc@valkosipuli.retiisi.org.uk> <20180804103354.GB9285@w540> From: Steve Longerbeam Message-ID: <1c2ca684-3de6-d709-2daa-04acdc54846a@gmail.com> Date: Sat, 4 Aug 2018 10:20:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180804103354.GB9285@w540> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacopo, On 08/04/2018 03:33 AM, jacopo mondi wrote: > Hi Steve, > > On Mon, Jul 23, 2018 at 09:44:57AM -0700, Steve Longerbeam wrote: >> >> On 07/23/2018 05:35 AM, Sakari Ailus wrote: >>> Hi Steve, >>> >>> Thanks for the update. >>> >>> On Mon, Jul 09, 2018 at 03:39:16PM -0700, Steve Longerbeam wrote: >>>> All platform drivers have been converted to use >>>> v4l2_async_notifier_add_subdev(), in place of adding >>>> asd's to the notifier subdevs array. So the subdevs >>>> array can now be removed from struct v4l2_async_notifier, >>>> and remove the backward compatibility support for that >>>> array in v4l2-async.c. >>>> >>>> Signed-off-by: Steve Longerbeam >>> This set removes the subdevs and num_subdevs fieldsfrom the notifier (as >>> discussed previously) but it doesn't include the corresponding >>> driver changes. Is there a patch missing from the set? >> Hi Sakari, yes somehow patch 15/17 (the large patch to all drivers) >> got dropped by the ML, maybe because the cc-list was too big? >> >> I will resend with only linux-media and cc: you. > For the Renesas CEU and Renesas R-Car VIN you can add my: > > Tested-by: Jacopo Mondi Thanks for testing! > > I would have a very small comment on the renesas-ceu.c patch. I'm copying > the hunk here below as the patch didn't reach the mailing list > >> @@ -1562,40 +1557,46 @@ static int ceu_parse_dt(struct ceu_device *ceudev) >> dev_err(ceudev->dev, >> "No subdevice connected on endpoint %u.\n", i); >> ret = -ENODEV; >> - goto error_put_node; >> + goto error_cleanup; >> } >> >> ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &fw_ep); >> if (ret) { >> if (ret) { >> dev_err(ceudev->dev, >> "Unable to parse endpoint #%u.\n", i); >> - goto error_put_node; >> + goto error_cleanup; >> } >> >> if (fw_ep.bus_type != V4L2_MBUS_PARALLEL) { >> dev_err(ceudev->dev, >> "Only parallel input supported.\n"); >> ret = -EINVAL; >> - goto error_put_node; >> + goto error_cleanup; >> } >> >> /* Setup the ceu subdevice and the async subdevice. */ >> ceu_sd = &ceudev->subdevs[i]; >> INIT_LIST_HEAD(&ceu_sd->asd.list); >> >> + remote = of_graph_get_remote_port_parent(ep); >> ceu_sd->mbus_flags = fw_ep.bus.parallel.flags; >> ceu_sd->asd.match_type = V4L2_ASYNC_MATCH_FWNODE; >> - ceu_sd->asd.match.fwnode = >> - fwnode_graph_get_remote_port_parent( >> - of_fwnode_handle(ep)); >> + ceu_sd->asd.match.fwnode = of_fwnode_handle(remote); >> + >> + ret = v4l2_async_notifier_add_subdev(&ceudev->notifier, >> + &ceu_sd->asd); >> + if (ret) { >> + of_node_put(remote); > ^^^ The 'remote' device node is only put in > the error path If v4l2_async_notifier_add_subdev() succeeds, then the reference is kept on the remote node until the asd is freed in v4l2_async_notifier_cleanup(). Otherwise if v4l2_async_notifier_add_subdev() fails, the asd is not added to the notifier asd_list so the caller is responsible for putting the remote node. So the only case where the remote needs to be put is in the line you marked above. Otherwise in the other error-out paths, the remote nodes for all asd's that have been added will be put below in the error_cleanup path. Steve >> + goto error_cleanup; >> + } >> >> - ceudev->asds[i] = &ceu_sd->asd; >> of_node_put(ep); >> } >> >> return num_ep; >> >> -error_put_node: >> +error_cleanup: >> + v4l2_async_notifier_cleanup(&ceudev->notifier); >> of_node_put(ep); >> return ret; >> } > Thanks > j