Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3161694ybi; Fri, 5 Jul 2019 02:59:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3+sjrQHC4BY3f1xs5COcq4Rvotc6qAoAqToUiVdUc/E5CYlUTwKyZqXKWzA5fnx9NqVa0 X-Received: by 2002:a63:f501:: with SMTP id w1mr4480790pgh.444.1562320756760; Fri, 05 Jul 2019 02:59:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562320756; cv=none; d=google.com; s=arc-20160816; b=ztQC3b0SF+sZbt8TK4/pf5dUu0KdWZJJEW5bnwps6r+TveabBTRfh8f6FnifWe04jf ob2tYwk1gDlSYEcN8d85kZqfYto1py0VjGzBedb/gYyAHvkVAShhRkMnR9l5/YBUCUAX GAIGi+6wE7jj+ltTpp4hJL5dFgkD1pCif07j0wmAAOjL6gy9j0yBVai0VOMdIPSxCGoc zRooSMGTuqfgJUjLQzB6jj37i7ODXKovgbRRsIdntmjVqb23I9LKoAePYuyMb4Nu+8i5 2LqBVMQWg1Rfz1J8hOcTNOnDe01Pk4jqwBy6YpsbhHRyM8UPPiG8RXb8A3I7WSz7/j/x gorQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:cc:to:subject:from:dkim-signature:dkim-filter; bh=/YVEsi66lwSu49bAR68WZXj+/SwnNGXKt6i6wK82uC4=; b=ac8otF+hto9CjfB2CJ2CkZG5z4c5wUpBxlBYGL0e9G6xY9hfT4Wriz52PtVv1QiZ4s SYyX7C/pNVlSb86fxEGnMVDEIJriomHseWboK7u8RRtzxbBgPQro3pOYsDmBAgdOdMdl JL4hXxo8n+p7dQAm1/P0u4anhjfda+o976Bs/k6yWZz+sKWTI5E/fO+WaMJjZiKA7ieE Szcb0zsJRmkjWvviHG/EOJS1kvoja+cZRutGDeU8D17xqRlb8CJe7OiKtc99bLS0/8FU 8FLxju+bTMo5F114f7f7TC2AyvdI3LwflEcFOohSAULsTIxTH6SQWxsvoocxLCFkEHoM SuIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=UWTmyRWz; 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=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e19si7559588pjp.49.2019.07.05.02.59.02; Fri, 05 Jul 2019 02:59:16 -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=@samsung.com header.s=mail20170921 header.b=UWTmyRWz; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727661AbfGEJpI (ORCPT + 99 others); Fri, 5 Jul 2019 05:45:08 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:43298 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726568AbfGEJpH (ORCPT ); Fri, 5 Jul 2019 05:45:07 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190705094505euoutp01b88a34a5eda67a76e7b2e3d1f6f86846~uea0Zka792530625306euoutp01p for ; Fri, 5 Jul 2019 09:45:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190705094505euoutp01b88a34a5eda67a76e7b2e3d1f6f86846~uea0Zka792530625306euoutp01p DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1562319905; bh=/YVEsi66lwSu49bAR68WZXj+/SwnNGXKt6i6wK82uC4=; h=From:Subject:To:Cc:Date:In-Reply-To:References:From; b=UWTmyRWzjp6s4EtXnq7uS2j8SCKun9gu8B9V0Jfo2PAUOYim2QdN1IIl4o2AI7s8H Rh9lLJ/EJFHvRiruZ3TY93wVnawVIIJ9yLGTnB2aYDx/I6ccROj9Mt8NcOsLpefCXZ kHm2DwKWKJP+WWidpaQH9Fm1C8TGD+gQf+pyFZcA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190705094503eucas1p11a6774d62daff12e73144934008fdb9e~ueay9Vr1R2639526395eucas1p1v; Fri, 5 Jul 2019 09:45:03 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 3B.D3.04325.F1C1F1D5; Fri, 5 Jul 2019 10:45:03 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20190705094502eucas1p18b0fc7460ad84d6cc55f64d416bc91c9~ueayMWPah0076400764eucas1p11; Fri, 5 Jul 2019 09:45:02 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190705094502eusmtrp2459a396d075eba54453395d48519ea68~ueax92Cjk1904119041eusmtrp2_; Fri, 5 Jul 2019 09:45:02 +0000 (GMT) X-AuditID: cbfec7f5-b8fff700000010e5-e4-5d1f1c1fa1e0 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 06.84.04146.E1C1F1D5; Fri, 5 Jul 2019 10:45:02 +0100 (BST) Received: from [106.120.51.74] (unknown [106.120.51.74]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190705094501eusmtip231c460c06efaa00064f19d611405d35a~ueaw1lyA81553915539eusmtip2c; Fri, 5 Jul 2019 09:45:01 +0000 (GMT) From: Andrzej Hajda Subject: Re: [PATCH v3 01/22] drm: Include ddc adapter pointer in struct drm_connector To: Thomas Zimmermann , Andrzej Pietrasiewicz , dri-devel@lists.freedesktop.org Cc: kernel@collabora.com, Alex Deucher , =?UTF-8?Q?Christian_K=c3=b6nig?= , "David (ChunMing) Zhou" , David Airlie , Daniel Vetter , Dave Airlie , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Sean Paul , Inki Dae , Seung-Woo Kim , Krzysztof Kozlowski , Philipp Zabel , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-tegra@vger.kernel.org Message-ID: Date: Fri, 5 Jul 2019 11:44:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <9e65f3c0-941d-d04c-5745-6b3a2965b990@suse.de> Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA01Se0xTVxz29D56aaw7FE1/cQTiVRMfEWUzeOITzZLd/bclZhqVSZUbNPJw LbgpJjhxBhg4KBGldFgUlFQzsC1oIUBSxVodVER8MLF1KBsEfLbKVGC9XMz47zvfd77f7/tO Dkdp/mBnc7vTMkR9mi6FZ1V0w7V/vUuiI6MTlnWe+oQUdngUpLvHoiClD5sYUl37k5Kc7XtE k2Ff6DjeUEyRqoCXIXeCz1li/rsdEaOviCb2jgKGWI87aeL11ilJXnGVktj67jKkuLVdSboa zSzpy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YuP8su8XlXXPYLC43X2S0+PTgP7PFjPP7mCw6v8xis1j4 cSuLxYOX+xkt7t47wWLxd/smFou7k48wWrzYIm4xY/JLNostbyayOsh5tF76y+Yxb021x467 Sxg99n5bwOIxu2Mmq8emVZ1sHtu/PWD1mHcy0ON+93Emj81L6j36/xp4HN91i93j/b6rbB59 W1Yxemw+Xe3xeZNcgECUnk1RfmlJqkJGfnGJrVK0oYWRnqGlhZ6RiaWeobF5rJWRqZK+nU1K ak5mWWqRvl2CXsa+3Z4Fm8Urzj3az9zA+Eaoi5GTQ0LAROJL2xrGLkYuDiGBpYwSe97eZoVI iEvsnv+WGcIWlvhzrYsNoug1o8S/t91sIAk2AU2Jv5tvgtnCAhESnb8uMIMUiQg0MkocXrGc CcRhFljKIbH2/XsWiPZNzBIPdn1iAWnhFbCTmNS7GqiFg4NFQEVi7yszkLAo0KRJ13ZClQhK nJz5BMzmFLCW2Nm3G+w8ZgF1iT/zLjFD2PISzVtnQ9niEreezGeawCg0C0n7LCQts5C0zELS soCRZRWjSGppcW56brGhXnFibnFpXrpecn7uJkZg+tp27OfmHYyXNgYfYhTgYFTi4U1gk4sV Yk0sK67MPcQowcGsJML7/bdMrBBvSmJlVWpRfnxRaU5q8SFGU6DfJjJLiSbnA1NrXkm8oamh uYWlobmxubGZhZI4b4fAwRghgfTEktTs1NSC1CKYPiYOTqkGxkZzE35zr6nO7g1rfa1aygL3 +UnM95w8/U3Pu5x5syOOz5/dwNF+KK380V+PQxUh67++XlNbkfs36tv3BdtDRG/fj3rpIeo7 vyFT9WvwOcGfAvvmTuCaOcsq9PdtHT7fcPO3jL3eP3Tn523/c1A06/9SnqSF5v8Kfc+e/X7T dPKu1AUqfGLnvimxFGckGmoxFxUnAgB/3OWEdQMAAA== X-CMS-MailID: 20190705094502eucas1p18b0fc7460ad84d6cc55f64d416bc91c9 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190701144119epcas1p211ec60b63f3c6ae02392e2ae67f1a4ba X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190701144119epcas1p211ec60b63f3c6ae02392e2ae67f1a4ba References: <3fb19371-db7d-f9dc-31a7-1ccd126f6784@collabora.com> <9b03d145-ec50-927c-55a8-dff1cd51d655@suse.de> <9e65f3c0-941d-d04c-5745-6b3a2965b990@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01.07.2019 16:41, Thomas Zimmermann wrote: > Hi > > Am 01.07.19 um 15:27 schrieb Andrzej Pietrasiewicz: >> Hi Thomas, >> >> Thank you for your comments. Please see inline. >> >> W dniu 30.06.2019 o 10:12, Thomas Zimmermann pisze: >>> Hi >>> >>> I like the idea, but would prefer a more structured approach. >>> >>> Setting connector->ddc before calling drm_sysfs_connector_add() seems >>> error prone. The dependency is not really clear from the code or >>> interfaces. >>> >>> The other thing is that drivers I mostly work on, ast and mgag200, have >>> code like this: >>> >>>    struct ast_i2c_chan { >>>     struct i2c_adapter adapter; >>>     struct drm_device *dev; >>>     struct i2c_algo_bit_data bit; >>>    }; >>> >>>    struct ast_connector { >>>     struct drm_connector base; >>>     struct ast_i2c_chan *i2c; >>>    }; >>> >>> It already encodes the connection between connector and ddc adapter. >>> >>> I suggest to introduce struct drm_i2c_adapter >>> >>>    struct drm_i2c_adapter { >>>     struct i2c_adapter base; >>>     struct drm_connector *connector; >>>    }; >>> >>> and convert drivers over to it. Ast would look like this: >>> >>>    struct ast_i2c_chan { >>>     struct drm_i2c_adapter adapter; >>>     struct i2c_algo_bit_data bit; >>>    }; >>> >> There are few flavors of these drivers. In some of them >> the i2c_adapter for ddc is allocated and initialized by >> the driver, which must provide a place in memory to hold >> the adapter. ast is an example of this approach. >> >> But there are others, such as for example exynos_hdmi.c. >> It gets its ddc adapter with of_find_i2c_adapter_by_node() >> and merely stores a pointer to it, while not managing the >> memory needed to hold the i2c_adapter. > I see. > >> Do you have any idea how to accommodate these various >> flavors of drivers in the scheme you propose? > Something like > > struct drm_i2c_adapter { > struct i2c_adapter *adapter; > struct drm_connector *connector; > }; > > with adapter either being allocated dynamically or acquired via > of_find_i2c_adapter_by_node(); with separate init and finish functions > for each variant. But it looks like over-abstraction to me. Without > prototyping the idea, I cannot say if it's worth the effort. > > For something more simple, maybe just have a function to attach an i2c > adapter to a connector: > > drm_connector_attach_i2c_adapter(connector, i2c_adapter) > > which sets the connector's ddc pointer and creates the sysfs entry if > the connector's entry is already present. I am not sure if such function is really necessary. Assigning ddc field before connector registration seems to be much simpler and quite standard - many fields are initialized this way. Reviewed-by: Andrzej Hajda  -- Regards Andrzej > Best regards > Thomas > >> Andrzej >> >>