From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1734FC433EF for ; Thu, 30 Jun 2022 00:31:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbiF3Ab4 (ORCPT ); Wed, 29 Jun 2022 20:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbiF3Abz (ORCPT ); Wed, 29 Jun 2022 20:31:55 -0400 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B8832A27E for ; Wed, 29 Jun 2022 17:31:53 -0700 (PDT) Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 94B3183A1C; Thu, 30 Jun 2022 02:31:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1656549111; bh=tVLvSda3Qj47bsCkOqwNC9U/U5+2aIfXr0bDqC5Gudo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ihHv2IBGL3T09PJeJvJWZQbs0j3KbhQ4bqHnC5oiJoJmWzhaTpXXC8VWcct88hacp UNCgWvFz0KZ1MBX1pd/YonrdYUjpsRKN+zqic0/XSjizx06QMmOrrtjfb1O/jpUzv9 63KJDlS/+POpvbmpICOSk69H+9fbbTxSQ9pgHQViw5q79xgJHygB2hcqIUlKuj109Y 1gIThpfN7e9f1ZMD4HH4S0MT4x9pvo89syLejckJCbX7usrOJPLinQ3m7vKClom1Vz RhUx8zLxqlhFsAfgFpLBmLMqHpgvtZREVlYb18K/xWytD0ADLYoPrjTAHm+UsJ0zBQ TD8AocgD4lJqA== Message-ID: Date: Thu, 30 Jun 2022 02:31:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v2] media: stm32: dcmi: Switch to __v4l2_subdev_state_alloc() Content-Language: en-US To: Tomi Valkeinen , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, Alain Volmat , Alexandre Torgue , Amelie DELAUNAY , Hugues FRUCHET , Philippe CORNU , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org References: <20220627174156.66919-1-marex@denx.de> <3ef88906-188d-52a6-c3bf-647bc4e36732@xs4all.nl> <32f04271-4a9a-3291-cf36-ead0383db9ca@ideasonboard.com> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On 6/29/22 15:19, Tomi Valkeinen wrote: > On 29/06/2022 15:39, Marek Vasut wrote: >> On 6/29/22 14:26, Tomi Valkeinen wrote: >> >> [...] >> >>>>> Perhaps the best way to solve this is just to remove the underscores >>>>> from __v4l2_subdev_state_alloc, and change all the drivers which >>>>> create >>>>> temporary v4l2_subdev_states to use that (and the free) functions. And >>>>> also create the helper macro which can be used in those cases where >>>>> the >>>>> call is simple (the state is not modified or accessed by the caller). >>>> >>>> As long as we prevent any new driver from using that API, that's fine >>>> with me. >>> >>> An alternative would be to keep the v4l2_subdev_state as a local >>> variable (allocated in the stack), and add a new function, >>> v4l2_subdev_state_local_init() or such. The function would initialize >>> the given state, expecting the allocatable fields to be already >>> allocated (state->pads, which in the above cases points to another >>> local variable, i.e. stack). >>> >>> This would prevent the need of a free call, which, while not complex >>> as such, might cause a bigger amount of changes in some cases to >>> handle the error paths correctly. >>> >>> Of course, if the above-mentioned macro works, then that's the >>> easiest solution. But that won't work for all drivers. >> >> Don't you think a driver fix shouldn't involve "rework the subsystem" >> requirement to be applicable ? > > No, but we should think what's the best way to do the fix, if the fix > is controversial. Otherwise we might just break things even worse. > Adding the macro seems like a much better way, and far from "rework the > subsystem". Granted, this was just a quick edit without testing so it may > fail miserably... > > Can you try this out? It seems to work as well. How shall we proceed ? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A3B4C43334 for ; Thu, 30 Jun 2022 00:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=V0Dt/zzy+Y4/RoeiRaLDBFiF0OjcxPoUcZgtYduKpBo=; b=h0ZhquzGWR9CRC rz0r2ll3hucNgC2e33hF2EHtDrBXez0ctRND0Eyyq+VQHXFqM9aKbqry3NkCLqcXfpQesi1inIOuM iLCPObGWPqxuITx05vMog579z8aZE04wjB2HcZAPygAjuDGP/i8MipABld2plXPVJBlVIT8TeFFKz AwianxYRmIiMrvTmR+NMrZXTXEEbjt3sCVoQq2dc3jg6nZqLSWYHhz4yEH9TGiaT6I9Qm1ktMkmm0 BWMEPPquPxFijUBOw784bKJFau6ThWiebOASRIdZhkoxgePAfXLvr5g4lpCCuwQ77YhAI0N9MsygJ Ni3UwpTaQbd/XXyBxD4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6i6F-00EYQM-Dh; Thu, 30 Jun 2022 00:32:03 +0000 Received: from phobos.denx.de ([2a01:238:438b:c500:173d:9f52:ddab:ee01]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6i6A-00EYPA-Eh for linux-arm-kernel@lists.infradead.org; Thu, 30 Jun 2022 00:32:01 +0000 Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 94B3183A1C; Thu, 30 Jun 2022 02:31:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1656549111; bh=tVLvSda3Qj47bsCkOqwNC9U/U5+2aIfXr0bDqC5Gudo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ihHv2IBGL3T09PJeJvJWZQbs0j3KbhQ4bqHnC5oiJoJmWzhaTpXXC8VWcct88hacp UNCgWvFz0KZ1MBX1pd/YonrdYUjpsRKN+zqic0/XSjizx06QMmOrrtjfb1O/jpUzv9 63KJDlS/+POpvbmpICOSk69H+9fbbTxSQ9pgHQViw5q79xgJHygB2hcqIUlKuj109Y 1gIThpfN7e9f1ZMD4HH4S0MT4x9pvo89syLejckJCbX7usrOJPLinQ3m7vKClom1Vz RhUx8zLxqlhFsAfgFpLBmLMqHpgvtZREVlYb18K/xWytD0ADLYoPrjTAHm+UsJ0zBQ TD8AocgD4lJqA== Message-ID: Date: Thu, 30 Jun 2022 02:31:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v2] media: stm32: dcmi: Switch to __v4l2_subdev_state_alloc() Content-Language: en-US To: Tomi Valkeinen , Laurent Pinchart Cc: Hans Verkuil , linux-media@vger.kernel.org, Alain Volmat , Alexandre Torgue , Amelie DELAUNAY , Hugues FRUCHET , Philippe CORNU , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org References: <20220627174156.66919-1-marex@denx.de> <3ef88906-188d-52a6-c3bf-647bc4e36732@xs4all.nl> <32f04271-4a9a-3291-cf36-ead0383db9ca@ideasonboard.com> From: Marek Vasut In-Reply-To: X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220629_173158_842799_A1CF1054 X-CRM114-Status: GOOD ( 16.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/29/22 15:19, Tomi Valkeinen wrote: > On 29/06/2022 15:39, Marek Vasut wrote: >> On 6/29/22 14:26, Tomi Valkeinen wrote: >> >> [...] >> >>>>> Perhaps the best way to solve this is just to remove the underscores >>>>> from __v4l2_subdev_state_alloc, and change all the drivers which >>>>> create >>>>> temporary v4l2_subdev_states to use that (and the free) functions. And >>>>> also create the helper macro which can be used in those cases where >>>>> the >>>>> call is simple (the state is not modified or accessed by the caller). >>>> >>>> As long as we prevent any new driver from using that API, that's fine >>>> with me. >>> >>> An alternative would be to keep the v4l2_subdev_state as a local >>> variable (allocated in the stack), and add a new function, >>> v4l2_subdev_state_local_init() or such. The function would initialize >>> the given state, expecting the allocatable fields to be already >>> allocated (state->pads, which in the above cases points to another >>> local variable, i.e. stack). >>> >>> This would prevent the need of a free call, which, while not complex >>> as such, might cause a bigger amount of changes in some cases to >>> handle the error paths correctly. >>> >>> Of course, if the above-mentioned macro works, then that's the >>> easiest solution. But that won't work for all drivers. >> >> Don't you think a driver fix shouldn't involve "rework the subsystem" >> requirement to be applicable ? > > No, but we should think what's the best way to do the fix, if the fix > is controversial. Otherwise we might just break things even worse. > Adding the macro seems like a much better way, and far from "rework the > subsystem". Granted, this was just a quick edit without testing so it may > fail miserably... > > Can you try this out? It seems to work as well. How shall we proceed ? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel