Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757504AbeAINgY (ORCPT + 1 other); Tue, 9 Jan 2018 08:36:24 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:56481 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753913AbeAINgX (ORCPT ); Tue, 9 Jan 2018 08:36:23 -0500 From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Cc: Brian Norris , Doug Anderson , hl@rock-chips.com, linux-rockchip@lists.infradead.org, David Airlie , Jeffy Chen , Philippe Cornu , linux-kernel@vger.kernel.org, Yannick Fertre , Nickey Yang , mka@chromium.org, Vincent Abriou Subject: Re: [PATCH] drm/bridge/synopsis: stop clobbering drvdata Date: Tue, 09 Jan 2018 15:36:53 +0200 Message-ID: <15815822.Bd0fLxLFzJ@avalon> Organization: Ideas on Board Oy In-Reply-To: <20171128182121.GA116479@google.com> References: <20171128010538.119114-1-briannorris@chromium.org> <1743921.AofnJoQ8Rz@avalon> <20171128182121.GA116479@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Brian, On Tuesday, 28 November 2017 20:21:23 EET Brian Norris wrote: > On Tue, Nov 28, 2017 at 02:51:46PM +0200, Laurent Pinchart wrote: > > Hi Brian, > > > > Thank you for the patch. > > > > I'd mention dw-mipi-dsi in the subject line as the directory contains the > > dw-hdmi driver as well that this patch doesn't touch. > > Yep. Does it need another tag in the subject? e.g., '.../dw-mipi-dsi:'? > > > On Tuesday, 28 November 2017 03:05:38 EET Brian Norris wrote: > >> Bridge drivers/helpers shouldn't be clobbering the drvdata, since a > >> parent driver might need to own this. > > > > By parent driver I assume you mean a glue driver that binds to the SoC- > > specific compatible string for the DSI transmitter. > > Indeed. Nickey picked this up for his Rockchip driver submission, but > maybe we should reword the commit message a bit. How about "drm: dw-mipi-dsi: Stop clobbering drvdata" ? > >> Instead, let's return our > >> 'dw_mipi_dsi' object and have callers pass that back to us for removal. > >> > >> Signed-off-by: Brian Norris > > > > Wouldn't it be cleaner to embed the dw_mipi_dsi structure in the parent- > > specific data structure (struct dw_mipi_dsi_stm and struct > > dw_mipi_dsi_rockchip when the "[PATCH v3 0/5] Update ROCKCHIP DSI driver > > that uses dw-mipi-dsi bridge" patch series will land) instead of > > allocating it dynamically ? We would then have a single object to track. > > I suppose we could do that too. But that would require exposing the > whole layout of 'struct dw_mipi_dsi' to users. Do we want to sacrifice > the enforced separation for a little bit of nicer object handling? I certainly don't think we should go for spaghetti code with all objects accessing each other :) On the other hand, we're talking about C code, and we thus have no way to enforce access restrictions in the compiler, so it's a lost battle anyway. I don't see an issue with exposing the object in the sense of moving its definition to a header file if it results in cleaner code. I think we need to trust developers not to abuse internal APIs, and if they do, catch it during review. > Also, this was modeled a bit after the similar rework needed to untangle > the drvdata handling in the Rockchip analogix DP driver vs. the analogix > bridge DP code: > > [PATCH v6 03/10] drm/bridge: analogix: Do not use device's drvdata > https://patchwork.kernel.org/patch/10015875/ -- Regards, Laurent Pinchart