Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3453464ybb; Mon, 6 Apr 2020 09:12:21 -0700 (PDT) X-Google-Smtp-Source: APiQypKqWINoHlp4oKCxN27T8IZsd5H+Fv+wZbp0SKvpY+6jCyoms1SJk9Lhc1tfvA+vQD+TpHDE X-Received: by 2002:aca:5041:: with SMTP id e62mr43755oib.146.1586189540974; Mon, 06 Apr 2020 09:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586189540; cv=none; d=google.com; s=arc-20160816; b=vXZJugiVM9M0sOBFvsF2tirLotKh+q7zB78AnEQF2Eq6I1FMfNkMSlvYOYRON9IdyY h7rxCypCR4jD2yAf8fxkUsdNcPlT1jDzto8tTxxZ56wQWzNJvsRSgD2DbYFUWGogbTMt btgr53w1zXvRwU9eGMYn5mCO7/y1tVm0y9gqPqecvsK3n9/Yc3DHdgEP+n6I3jR1TOa+ l7bvSYGfPX95Wonbbl7XNM6De3+9X+aRsgv955Qyl6cCfcODwQuDTOQqU9uXvB05E0ic H4TPOdTLg592He2m/DjffFlBjhYeKL9ItWORzVzxB22CCD7GGpWF15yU9EECldIYH2KB aNrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=qhOUGpjPKASmxoCysFaxbtOB2AHvvFDFpDiOJXOBlNo=; b=HnyhI7pFjADNMcx8bHjX2q8UmV1qwBGw3RHfwDmS0WZuMuhdWNcaj0c4ywq+RY7OKi lHRsNBcCpNxyjD2XvStSKm3O0Wo4qV9TKG67lTcJrvIoLdGW+EUcd4yHiogvzp9xjAuH AOexN8pfrEIE4DlmlCf3/iTqxgTJUbco2ijHPJw975yjy4V4+7b3b80Za80ObbxYvXeD AC+0+Dt2JhclA3ykloHmpfMEE5ot39J2Gkpbd9NVh2OibQcwsO/Zsx56bgOAwG7mUkVi nebm9R+JvYsYzFmzFAdTOQwGUzQ6tf9o6senFzBm45cbqzrZu1WCwUE0MLrmBolpSWWR dkbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UrynkiAy; 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 z5si7800351oiz.209.2020.04.06.09.12.04; Mon, 06 Apr 2020 09:12:20 -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=UrynkiAy; 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 S1729381AbgDFQLh (ORCPT + 99 others); Mon, 6 Apr 2020 12:11:37 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:35729 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728707AbgDFQLg (ORCPT ); Mon, 6 Apr 2020 12:11:36 -0400 Received: by mail-lf1-f66.google.com with SMTP id r17so8755304lff.2; Mon, 06 Apr 2020 09:11:34 -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-language:content-transfer-encoding; bh=qhOUGpjPKASmxoCysFaxbtOB2AHvvFDFpDiOJXOBlNo=; b=UrynkiAylxjENx/BTXAnxsXfsPXLlbFbVf9NAYsIXircg3qbDqGgXpl0Agz7FjWxYV o23532+gFX5nUrvt45ZV+JltPlf69OMbNpqjzTuosCOt+1TThYRgyYXYgYMkj+bUQNsG C69GB+hmlKc3cCgePelBhWBhuChb5+qwFpoG4xSqLYRjBNPx6x+CFL965NRxL6Us8zd4 Wf/pi01y6+iKV4sj4gOGgXO+LjmCb6gg+SeknB1wc28TVxBs8RbprSXCBwbecK0DCmuy PR1s0hQt4uSC473SJAESyeCrMUqIFMusJ/MdF888X8m4l9XMR0JNA8DN1/oIaDaGHcDb w/cg== 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-language :content-transfer-encoding; bh=qhOUGpjPKASmxoCysFaxbtOB2AHvvFDFpDiOJXOBlNo=; b=SyVsXx2wOx8e6TxCr7c4OkNuOUldRLwD8Z5UcQzotf3BSofN0+UaVW3ir/sPbcY4yY rSTbBJNEsDm91I4LlOgSDKnXMxl9brXyHwsl4gJuTG4B3FJ123pXCWKOmj9gwOy9r8FQ eXLQXCLorQjFY61mMwXKsA6KMgJKe9RxTvqstbcRDpJVeCgCPtO8m2LeZwT5Xd2Wiyct leNygLt8hyJDUvd9OFOmVKOEZV3YpS4UITRSXHPRj7hJ/Q+nVKdaTFkvKQaYwilEKZ/6 gN8KtCa5FxOD9KHG3h67I8igd0HsD4vANE/nNnYdUfSEv9AuMqXIs5FuesBY1wBcaLed BXZw== X-Gm-Message-State: AGi0PuZFjZi1OYxPf1OvTmPLtMfiWqHeROEBCaLGnXMYkH92axsYZqSo nea+beupW+tVkcZQoaP8eTCrZTG1 X-Received: by 2002:a05:6512:686:: with SMTP id t6mr14141091lfe.163.1586189492891; Mon, 06 Apr 2020 09:11:32 -0700 (PDT) Received: from [192.168.2.145] (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.googlemail.com with ESMTPSA id o18sm1360571lfb.13.2020.04.06.09.11.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 06 Apr 2020 09:11:31 -0700 (PDT) Subject: Re: [RFC PATCH v6 6/9] media: tegra: Add Tegra210 Video input driver To: Sowjanya Komatineni , thierry.reding@gmail.com, jonathanh@nvidia.com, frankc@nvidia.com, hverkuil@xs4all.nl, sakari.ailus@iki.fi, helen.koike@collabora.com Cc: sboyd@kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org References: <1585963507-12610-1-git-send-email-skomatineni@nvidia.com> <1585963507-12610-7-git-send-email-skomatineni@nvidia.com> <40102767-ecdb-e958-66f4-45d11464069c@gmail.com> From: Dmitry Osipenko Message-ID: <6014fee9-ce97-7ced-f2ba-82176b8b36db@gmail.com> Date: Mon, 6 Apr 2020 19:11:30 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 06.04.2020 18:41, Sowjanya Komatineni пишет: > > On 4/5/20 2:11 PM, Dmitry Osipenko wrote: >> External email: Use caution opening links or attachments >> >> >> 04.04.2020 04:25, Sowjanya Komatineni пишет: >> ... >>> +static int tegra_vi_tpg_channels_alloc(struct tegra_vi *vi) >>> +{ >>> +     struct tegra_vi_channel *chan, *tmp; >>> +     unsigned int port_num; >>> +     unsigned int nchannels = vi->soc->vi_max_channels; >>> +     int ret = 0; >>> + >>> +     for (port_num = 0; port_num < nchannels; port_num++) { >>> +             /* >>> +              * Do not use devm_kzalloc as memory is freed immediately >>> +              * when device instance is unbound but application >>> might still >>> +              * be holding the device node open. Channel memory >>> allocated >>> +              * with kzalloc is freed during video device release >>> callback. >>> +              */ >>> +             chan = kzalloc(sizeof(*chan), GFP_KERNEL); >> Why anyone would want to unbind this driver in practice? >> >> I think it should make more sense to set suppress_bind_attrs=true. > > From the previous feedback of patch series, we need to support > unbind/bind and looks like this driver should also support to built as a > module. If module unloading is also affected, then perhaps you should use get/put_device() to not allow freeing the resources until they're still in-use. I suppose that it should be up to the V4L core to keep the device alive while needed, rather than to put the burden to the individual drivers.