Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1288379ybl; Mon, 2 Dec 2019 00:53:15 -0800 (PST) X-Google-Smtp-Source: APXvYqw/LNk9tBmm8TXVyHJfXIRRcsxTIB+NqJ/3MnVwDeVr2MXPv07CjiSVWXh9NpFVUkDa+IMS X-Received: by 2002:a17:906:12c6:: with SMTP id l6mr6464755ejb.53.1575276795217; Mon, 02 Dec 2019 00:53:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575276795; cv=none; d=google.com; s=arc-20160816; b=n3s35axNOkouGRsZnDCeX251lfQxOPA5JVQGz8tP4thnYVeXgCQgWmZGg7XMyHJ6Qq 8OnXUFVkaLq8uK/TIEhCZ7eYq/JQVPCk5I2C3vqtwTDe6ybmRZ5qEh3oE38HwF5UaI7U 60pbddH8NhCZDJ40Tb5jjEqEFLlVhVJ8MskH6Tfz/OZUY1R15zmfB0yDNUkTpxpZ3oWG fU5gFph50tRMNQgAHK/bE2V97+bV3K6qGQLkjhC4LVXyQmjbUJeBvvWejqVtMfqwB+Q7 zPTspyjInW30u9uuBEq8Hy0cEGUIPiICabQ5tK0Z21F+7f0viTFGOsGhS7wQf4wMF0H+ Dmmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=OTj1RBCZb2YMCeCoS+sNA0hsSD1PCx/KWXCN5P/k7WI=; b=KAXpaF6+RcisgFp9HlZg5dlnTRoeYoFXM4oem78k03Y6AKMBCwxOn3292YIqRBEJQV wxxGGVxSQNN5/MYlAKIu0yw+BiOi1ipax7EzVwfdK9+4w9aT6l1qqeEVrOWU3YH2qeDX knW45nFDZ6vZ4naCPO7rpsZmWOgpgqOCd4Y+ir08WTNEKIWaTWbPxyocV0RO6oOkGw9y QAyzApwGLBFGkD9bKXvz57IUYoVNi4j4ft8u8lvikWzBFPmHZ9ydYXMvRoo8c8RppxG3 0OOPephJp5ea/Hf/6U1062bLFkDffYopZ9wE0tW956iqZxl/Kz2gOWncSpgLngmZK+YR zFEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=lpXqgi6R; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y13si4699341edq.261.2019.12.02.00.52.51; Mon, 02 Dec 2019 00:53:15 -0800 (PST) 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=@ffwll.ch header.s=google header.b=lpXqgi6R; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726428AbfLBItl (ORCPT + 99 others); Mon, 2 Dec 2019 03:49:41 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55878 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726106AbfLBItl (ORCPT ); Mon, 2 Dec 2019 03:49:41 -0500 Received: by mail-wm1-f68.google.com with SMTP id a131so16460259wme.5 for ; Mon, 02 Dec 2019 00:49:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OTj1RBCZb2YMCeCoS+sNA0hsSD1PCx/KWXCN5P/k7WI=; b=lpXqgi6RxG7r8QtKa9tbrp1YCJngkhiNJXJ0eZoRoKbbZGYJNMc2FmmkfOnrrr+aIS K1uhIrJieHIHhZBmIuypHu8pQnp34Mat7kQLu7jS8EH2TNQt0FpWNQ7d4/1QPg8FQecZ n0Jj0Bz2KoQ0dcXy3jkwRHHXpzCWTivuBmcYs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=OTj1RBCZb2YMCeCoS+sNA0hsSD1PCx/KWXCN5P/k7WI=; b=oBQfFdooWIA9J/FkbmN98gI749yfOhlV/30VgxtA+NYe6emB03NumGo9GQHYCTxpm0 YnznIvpQ1u4vV7V7QevnaD56bATdrBmHxJjLKjz0tI1LxGdHOyxglMOP/aT0X1x3ZJlP 4Krhoze+LwfE4tdlgfQLoVX/vEgMJRruYu1s7TyVYeXSLil9wo6UPMa9X3fkCniPMFPE tY7B5iJGHZ2HNliM0XQPaIn5Ozqz8f3AMEe4hOQMPAKs+ZViud5nGKPqoa8czgPlotJS 2x00VT99cF10xcU1DziVPZUSpiuzG/Wc3RqO7bpRvF6cnGwE/fDsaq4oSKppUE2AP36W yhJg== X-Gm-Message-State: APjAAAUj8jC/e0hiIarC1LhvJMF3VpQT3bRw+z83DhO570UWrfnjCrB2 n8zBvUpmXxH+ZPaHD9Is53VW6w== X-Received: by 2002:a1c:4e03:: with SMTP id g3mr12747171wmh.22.1575276578020; Mon, 02 Dec 2019 00:49:38 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id a64sm25598619wmc.18.2019.12.02.00.49.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2019 00:49:37 -0800 (PST) Date: Mon, 2 Dec 2019 09:49:35 +0100 From: Daniel Vetter To: "james qian wang (Arm Technology China)" Cc: Mihail Atanassov , David Airlie , nd , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" Subject: Re: [01/30] drm: Introduce drm_bridge_init() Message-ID: <20191202084935.GW624164@phenom.ffwll.local> Mail-Followup-To: "james qian wang (Arm Technology China)" , Mihail Atanassov , David Airlie , nd , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" References: <20191126131541.47393-2-mihail.atanassov@arm.com> <20191202055459.GA25729@jamwan02-TSP300> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191202055459.GA25729@jamwan02-TSP300> X-Operating-System: Linux phenom 5.3.0-2-amd64 User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 02, 2019 at 05:55:06AM +0000, james qian wang (Arm Technology China) wrote: > On Tue, Nov 26, 2019 at 01:15:59PM +0000, Mihail Atanassov wrote: > > A simple convenience function to initialize the struct drm_bridge. > > > > Signed-off-by: Mihail Atanassov > > --- > > drivers/gpu/drm/drm_bridge.c | 29 +++++++++++++++++++++++++++++ > > include/drm/drm_bridge.h | 4 ++++ > > 2 files changed, 33 insertions(+) > > > > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c > > index cba537c99e43..cbe680aa6eac 100644 > > --- a/drivers/gpu/drm/drm_bridge.c > > +++ b/drivers/gpu/drm/drm_bridge.c > > @@ -89,6 +89,35 @@ void drm_bridge_remove(struct drm_bridge *bridge) > > } > > EXPORT_SYMBOL(drm_bridge_remove); > > > > +/** > > + * drm_bridge_init - initialise a drm_bridge structure > > + * > > + * @bridge: bridge control structure > > + * @funcs: control functions > > + * @dev: device > > + * @timings: timing specification for the bridge; optional (may be NULL) > > + * @driver_private: pointer to the bridge driver internal context (may be NULL) > > + */ > > +void drm_bridge_init(struct drm_bridge *bridge, struct device *dev, > > + const struct drm_bridge_funcs *funcs, > > + const struct drm_bridge_timings *timings, > > + void *driver_private) > > +{ > > + WARN_ON(!funcs); > > + > > + bridge->dev = NULL; > > + bridge->encoder = NULL; > > + bridge->next = NULL; > > + > > +#ifdef CONFIG_OF > > + bridge->of_node = dev->of_node; > > +#endif > > + bridge->timings = timings; > > + bridge->funcs = funcs; > > + bridge->driver_private = driver_private; > > Can we directly put drm_bridge_add() here. then > - User always need to call bridge_init and add together. > - Consistent with others like drm_plane/crtc_init which directly has > drm_mode_object_add() in it. Uh no, the trouble here is that drm_bridge_add should actually be called _register, because it publishes the bridge to the world. I think we even have a todo item to rename _add to _register ... Once that's done the bridge can't be changed anymore, all init code must have completed. So often you need a bit of code between _init() and _register(). drm_mode_object_add is different since for mode objects it doesn't publish it to the world, that's done with drm_dev_register and drm_connector_register. drm_mode_object_add just does a bit of internal house keeping. -Daniel > > James. > > +} > > +EXPORT_SYMBOL(drm_bridge_init); > > + > > /** > > * drm_bridge_attach - attach the bridge to an encoder's chain > > * > > diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h > > index c0a2286a81e9..d6d9d5301551 100644 > > --- a/include/drm/drm_bridge.h > > +++ b/include/drm/drm_bridge.h > > @@ -402,6 +402,10 @@ struct drm_bridge { > > > > void drm_bridge_add(struct drm_bridge *bridge); > > void drm_bridge_remove(struct drm_bridge *bridge); > > +void drm_bridge_init(struct drm_bridge *bridge, struct device *dev, > > + const struct drm_bridge_funcs *funcs, > > + const struct drm_bridge_timings *timings, > > + void *driver_private); > > struct drm_bridge *of_drm_find_bridge(struct device_node *np); > > int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, > > struct drm_bridge *previous); > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch