Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4675953ybb; Tue, 7 Apr 2020 12:07:19 -0700 (PDT) X-Google-Smtp-Source: APiQypK+fwlsLvk7YK+C3nGyeHYQrnNtDVB9XsnqP6873yI9q/GF97e/XqL9TBJ9wHZex/mQikAP X-Received: by 2002:a05:6808:8ce:: with SMTP id k14mr316264oij.60.1586286439094; Tue, 07 Apr 2020 12:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586286439; cv=none; d=google.com; s=arc-20160816; b=cnU1T0H120bxosQWm/ZXjRgbLdTXuXP6KGo5T13XYlbE71pfqb+4AcaFrRy39F/mAC CIfXytfLLEo1ycGssXEyS9FkcsKzi/pLnLvOM44wAd5zrXSP8SPrPvCPeFbQfk3gM2w+ qPaMGfizV61nB4pEL55gDkH2hsx0uSMPtH8nALXHxr4xHh8ZB3LD/7ZzIWnlPUiP+m4O q1bw2tO4LgPm+G1yvZ1oju7DM3mCf1EAYSpZTLfJ5Ahu4dVgXxYQadD7JNN3OjNCVp+4 pwAPStxc7sDvtPi67nKBN3oKhKkvtTAVY/WS07vLd9ITfBxSdjKu+6zaBsAffkeMIJbj tInw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=7t/2hBzkGE2FuWGhPFMgSIueDjtcOTTLwFTzLicufH0=; b=s1EAeyjmczNoJS3C183Xkr/eW6y4i5OLGPhtTcH7HMhTyGkeTYrjvSr0VrSAFtTECL dsX9T/5udJfUy9iJouJAgLayEtK2aRBmtkfaKQuZfACiLDzvNh795AYjc1wolBhYlOxG 5dTezS0m0jsQ2EmD9ObLG84z91+KkqES2z2cmrwGJNclojC7qjr4TWaKYLbdFYUplQzE J8swTfs0CLW05W/jsGZB9d7gjc9Z5NDjWgpmfrmCSdyF9sl1P9RbQRQVdA2Fpm3RoHyC 2FIrl8foYbxZdekc2KWICabOh2LYamysL7BlxJ2z4CSpWODW0uKrS9bmgX4mk1GLpXwF rAQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=M8VtUxkw; 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=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8si1012815oif.218.2020.04.07.12.07.03; Tue, 07 Apr 2020 12:07:19 -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=@nvidia.com header.s=n1 header.b=M8VtUxkw; 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=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726901AbgDGTGC (ORCPT + 99 others); Tue, 7 Apr 2020 15:06:02 -0400 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:14419 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726719AbgDGTGB (ORCPT ); Tue, 7 Apr 2020 15:06:01 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 07 Apr 2020 12:05:48 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 07 Apr 2020 12:06:01 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 07 Apr 2020 12:06:01 -0700 Received: from DRHQMAIL107.nvidia.com (10.27.9.16) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 7 Apr 2020 19:06:00 +0000 Received: from [10.2.171.175] (10.124.1.5) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 7 Apr 2020 19:05:59 +0000 Subject: Re: [RFC PATCH v6 6/9] media: tegra: Add Tegra210 Video input driver To: Dmitry Osipenko , , , , , , CC: , , , , , 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> <6014fee9-ce97-7ced-f2ba-82176b8b36db@gmail.com> From: Sowjanya Komatineni Message-ID: <55ca95a0-41d9-a071-ab9d-08d26b3f8698@nvidia.com> Date: Tue, 7 Apr 2020 12:05:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <6014fee9-ce97-7ced-f2ba-82176b8b36db@gmail.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To DRHQMAIL107.nvidia.com (10.27.9.16) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1586286348; bh=7t/2hBzkGE2FuWGhPFMgSIueDjtcOTTLwFTzLicufH0=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Transfer-Encoding: Content-Language; b=M8VtUxkwY4lt7B0+68GJzxSBImPxb9H/gfjuA+dKsjvSpuoQavo9IR3cdWt2JMBrG HKdD1OGl3acnmDWMe9ZPflMVWi9J8wsjbl6+KRBvFhQhUZeMbfWExwhyedr5bWJZvX akWNxOPL2ufAyt/bybX4OMkPnA3okeZzehS6b0KfVR0FRJkk8wPXtw6AQ2JUGMvZzu h1P8qm+PcfnTL+KvhW/inCEftVsuWkW0xsuhzH4wpmpYQQu+TcAw+HhVOktgMHBFj8 hKx62HbzhxQu2zL/zVFrabC/J1Suce7z3p6Z1lQ+oOF3C5dZMdRYM/H3/e+Oko7ccq K/L2d7j1BudTA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/6/20 9:11 AM, Dmitry Osipenko wrote: > External email: Use caution opening links or attachments > > > 06.04.2020 18:41, Sowjanya Komatineni =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> 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 =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >>> ... >>>> +static int tegra_vi_tpg_channels_alloc(struct tegra_vi *vi) >>>> +{ >>>> + struct tegra_vi_channel *chan, *tmp; >>>> + unsigned int port_num; >>>> + unsigned int nchannels =3D vi->soc->vi_max_channels; >>>> + int ret =3D 0; >>>> + >>>> + for (port_num =3D 0; port_num < nchannels; port_num++) { >>>> + /* >>>> + * Do not use devm_kzalloc as memory is freed immediatel= y >>>> + * 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 =3D 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=3Dtrue. >> 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. Hans/Thierry, Can you please comment on this?