All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
	dri-devel@lists.freedesktop.org
Cc: "Y.C. Chen" <yc_chen@aspeedtech.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Neil Armstrong" <narmstrong@baylibre.com>,
	"David Airlie" <airlied@linux.ie>,
	"Douglas Anderson" <dianders@chromium.org>,
	"Andrzej Hajda" <a.hajda@samsung.com>,
	"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
	"Benjamin Gaignard" <benjamin.gaignard@linaro.org>,
	kernel@collabora.com, "Fabio Estevam" <festevam@gmail.com>,
	"David (ChunMing) Zhou" <David1.Zhou@amd.com>,
	linux-samsung-soc@vger.kernel.org,
	"Joonyoung Shim" <jy0922.shim@samsung.com>,
	linux-rockchip@lists.infradead.org,
	"Vincent Abriou" <vincent.abriou@st.com>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Maxime Ripard" <maxime.ripard@bootlin.com>,
	"Chen-Yu Tsai" <wens@csie.org>, "Kukjin Kim" <kgene@kernel.org>,
	"NXP Linux Team" <linux-imx@nxp.com>, "CK Hu" <ck.hu@mediatek.co>
Subject: Re: [PATCH v5 02/24] drm: Add drm_connector_init() variant with ddc
Date: Mon, 29 Jul 2019 11:42:43 +0300	[thread overview]
Message-ID: <875znlp6yk.fsf@intel.com> (raw)
In-Reply-To: <53f5ded2971235e5b63c9a3ed4ed8bccf10c78f2.1563960855.git.andrzej.p@collabora.com>

On Wed, 24 Jul 2019, Andrzej Pietrasiewicz <andrzej.p@collabora.com> wrote:
> Allow passing ddc adapter pointer to the init function. Even if
> drm_connector_init() sometime in the future decides to e.g. memset() all
> connector fields to zeros, the newly added function ensures that at its
> completion the ddc member of connector is correctly set.
>
> Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
> ---
>  drivers/gpu/drm/drm_connector.c | 19 +++++++++++++++++++
>  include/drm/drm_connector.h     |  5 +++++
>  2 files changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 068d4b05f1be..06fbfc44fb48 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -296,6 +296,25 @@ int drm_connector_init(struct drm_device *dev,
>  }
>  EXPORT_SYMBOL(drm_connector_init);
>  
> +int drm_connector_init_with_ddc(struct drm_device *dev,
> +				struct drm_connector *connector,
> +				const struct drm_connector_funcs *funcs,
> +				int connector_type,
> +				struct i2c_adapter *ddc)

Playing the devil's advocate here a bit. What if you end up adding
another thing you need to initialize like this? Are you going to need
three more functions to account for the combinations? Init with ddc,
with foo, with ddc and foo? So I generally frown upon interfaces like
this.

If everyone thinks this is the way to go, I'm not going to stand in the
way, but personally I'd rather switch over all of i915 to a new version
of drm_connector_init() that just takes another parameter.

BR,
Jani.


> +{
> +	int ret;
> +
> +	ret = drm_connector_init(dev, connector, funcs, connector_type);
> +	if (ret)
> +		return ret;
> +
> +	/* provide ddc symlink in sysfs */
> +	connector->ddc = ddc;
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL(drm_connector_init_with_ddc);
> +
>  /**
>   * drm_connector_attach_edid_property - attach edid property.
>   * @connector: the connector
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 33a6fff85fdb..937fda9c1374 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -1410,6 +1410,11 @@ int drm_connector_init(struct drm_device *dev,
>  		       struct drm_connector *connector,
>  		       const struct drm_connector_funcs *funcs,
>  		       int connector_type);
> +int drm_connector_init_with_ddc(struct drm_device *dev,
> +				struct drm_connector *connector,
> +				const struct drm_connector_funcs *funcs,
> +				int connector_type,
> +				struct i2c_adapter *ddc);
>  void drm_connector_attach_edid_property(struct drm_connector *connector);
>  int drm_connector_register(struct drm_connector *connector);
>  void drm_connector_unregister(struct drm_connector *connector);

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-07-29  8:42 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 13:59 [PATCH v5 00/24] Associate ddc adapters with connectors Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 01/24] drm: Include ddc adapter pointer in struct drm_connector Andrzej Pietrasiewicz
     [not found]   ` <e82d6aca4f8abc95834c8a36c101d153518bb1ac.1563960855.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-26  6:37     ` Sam Ravnborg
2019-07-26  8:08       ` Sam Ravnborg
2019-07-26  8:08         ` Sam Ravnborg
2019-07-26 12:18       ` Andrzej Pietrasiewicz
2019-07-26 12:18         ` Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 02/24] drm: Add drm_connector_init() variant with ddc Andrzej Pietrasiewicz
     [not found]   ` <53f5ded2971235e5b63c9a3ed4ed8bccf10c78f2.1563960855.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-24 17:16     ` Thomas Zimmermann
2019-07-24 17:16       ` Thomas Zimmermann
2019-07-24 17:16       ` Thomas Zimmermann
2019-07-26  6:35     ` Sam Ravnborg
2019-07-29  8:42   ` Jani Nikula [this message]
2019-07-24 13:59 ` [PATCH v5 03/24] drm/exynos: Provide ddc symlink in connector's sysfs Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 04/24] drm: rockchip: Provide ddc symlink in rk3066_hdmi sysfs directory Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 05/24] drm: rockchip: Provide ddc symlink in inno_hdmi " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 06/24] drm/msm/hdmi: Provide ddc symlink in hdmi connector " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 08/24] drm/mediatek: " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 09/24] drm/tegra: Provide ddc symlink in output " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 10/24] drm/imx: imx-ldb: Provide ddc symlink in connector's sysfs Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 11/24] drm/imx: imx-tve: " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 12/24] drm/vc4: Provide ddc symlink in connector sysfs directory Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 13/24] drm: zte: Provide ddc symlink in hdmi " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 14/24] drm: zte: Provide ddc symlink in vga " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 15/24] drm/tilcdc: Provide ddc symlink in " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 16/24] drm: sti: Provide ddc symlink in hdmi " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 17/24] drm/mgag200: Provide ddc symlink in " Andrzej Pietrasiewicz
     [not found]   ` <f86dfa1ed6e84ab8b36a0b2c24df897bdb957294.1563960855.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-24 17:17     ` Thomas Zimmermann
2019-07-24 13:59 ` [PATCH v5 18/24] drm/ast: " Andrzej Pietrasiewicz
2019-07-24 17:17   ` Thomas Zimmermann
2019-07-24 17:17     ` Thomas Zimmermann
2019-07-24 17:17     ` Thomas Zimmermann
2019-07-24 13:59 ` [PATCH v5 19/24] drm/bridge: dumb-vga-dac: " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 20/24] drm/bridge: dw-hdmi: " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 21/24] drm/bridge: ti-tfp410: " Andrzej Pietrasiewicz
2019-07-24 13:59 ` [PATCH v5 22/24] drm/amdgpu: " Andrzej Pietrasiewicz
     [not found] ` <cover.1563960855.git.andrzej.p-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-07-24 13:59   ` [PATCH v5 07/24] drm/sun4i: hdmi: Provide ddc symlink in sun4i hdmi " Andrzej Pietrasiewicz
2019-07-24 13:59   ` [PATCH v5 23/24] drm/radeon: Provide ddc symlink in " Andrzej Pietrasiewicz
2019-07-24 13:59   ` [PATCH v5 24/24] drm/i915: Provide ddc symlink in hdmi " Andrzej Pietrasiewicz
2019-07-24 14:19 ` ✗ Fi.CI.CHECKPATCH: warning for Associate ddc adapters with connectors (rev2) Patchwork
2019-07-24 16:37 ` ✓ Fi.CI.BAT: success " Patchwork
2019-07-24 19:47 ` ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875znlp6yk.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=David1.Zhou@amd.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=andrzej.p@collabora.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=ck.hu@mediatek.co \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=festevam@gmail.com \
    --cc=heiko@sntech.de \
    --cc=jonathanh@nvidia.com \
    --cc=jy0922.shim@samsung.com \
    --cc=kernel@collabora.com \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=narmstrong@baylibre.com \
    --cc=sam@ravnborg.org \
    --cc=vincent.abriou@st.com \
    --cc=wens@csie.org \
    --cc=yc_chen@aspeedtech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.