您好,这个补丁开始有如下编译报错。

cp arch/arm64/configs/hulk_defconfig .config && make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CC [M]  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.o
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c: In function ‘hibmc_connector_get_modes’:
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:63:44: error: implicit declaration of function ‘to_hibmc_connector’; did you mean ‘obj_to_connector’? [-Werror=implicit-function-declaration]
  struct hibmc_connector *hibmc_connector = to_hibmc_connector(connector);
                                            ^~~~~~~~~~~~~~~~~~
                                            obj_to_connector
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:63:44: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:65:49: error: dereferencing pointer to incomplete type ‘struct hibmc_connector’
  edid = drm_get_edid(connector, &hibmc_connector->adapter);
                                                 ^~
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c: In function ‘hibmc_connector_destroy’:
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:103:44: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
  struct hibmc_connector *hibmc_connector = to_hibmc_connector(connector);
                                            ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:105:34: error: dereferencing pointer to incomplete type ‘struct hibmc_connector’
  i2c_del_adapter(&hibmc_connector->adapter);
                                  ^~
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c: In function ‘hibmc_vdac_init’:
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:178:49: error: ‘struct hibmc_drm_private’ has no member named ‘connector’
  struct hibmc_connector *hibmc_connector = &priv->connector;
                                                 ^~
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:179:37: error: ‘struct hibmc_drm_private’ has no member named ‘encoder’
  struct drm_encoder *encoder = &priv->encoder;
                                     ^~
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:180:52: error: dereferencing pointer to incomplete type ‘struct hibmc_connector’
  struct drm_connector *connector = &hibmc_connector->base;
                                                    ^~
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:184:8: error: implicit declaration of function ‘hibmc_ddc_create’; did you mean ‘hibmc_dumb_create’? [-Werror=implicit-function-declaration]
  ret = hibmc_ddc_create(dev, hibmc_connector);
        ^~~~~~~~~~~~~~~~
        hibmc_dumb_create
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:200:8: error: implicit declaration of function ‘drm_connector_init_with_ddc’; did you mean ‘drm_connector_list_iter_end’? [-Werror=implicit-function-declaration]
  ret = drm_connector_init_with_ddc(dev, connector,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
        drm_connector_list_iter_end
At top level:
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c:125:1: warning: ‘hibmc_connector_init’ defined but not used [-Wunused-function]
 hibmc_connector_init(struct hibmc_drm_private *priv)
 ^~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
scripts/Makefile.build:303: recipe for target 'drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.o' failed
make[5]: *** [drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.o] Error 1
scripts/Makefile.build:544: recipe for target 'drivers/gpu/drm/hisilicon/hibmc' failed
make[4]: *** [drivers/gpu/drm/hisilicon/hibmc] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/gpu/drm/hisilicon' failed
make[3]: *** [drivers/gpu/drm/hisilicon] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:1070: recipe for target 'drivers' failed
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs....

On 2021/9/18 11:11, Gou Hao wrote:
From: Andrzej Pietrasiewicz <andrzej.p@collabora.com>

mainline inclusion
from mainline-v5.14.0-rc7
commit e1a29c6c59553d80a8e17d63494c65a13fb8e241
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I469VQ
CVE: NA

--------------------------------

Add generic code which creates symbolic links in sysfs, pointing to ddc
interface used by a particular video output. For example:

ls -l /sys/class/drm/card0-HDMI-A-1/ddc
lrwxrwxrwx 1 root root 0 Jun 24 10:42 /sys/class/drm/card0-HDMI-A-1/ddc \
	-> ../../../../soc/13880000.i2c/i2c-2

This makes it easy for user to associate a display with its ddc adapter
and use e.g. ddcutil to control the chosen monitor.

This patch adds an i2c_adapter pointer to struct drm_connector. Particular
drivers can then use it instead of using their own private instance. If a
connector contains a ddc, then create a symbolic link in sysfs.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d470def6cd661b777faeee67b5838a4623c4010e.1564161140.git.andrzej.p@collabora.com

Signed-off-by: gouhao <gouhao@uniontech.com>
---
 drivers/gpu/drm/drm_sysfs.c |  8 ++++++++
 include/drm/drm_connector.h | 11 +++++++++++
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index ecb7b3300..52879b001 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -15,6 +15,7 @@
 #include <linux/device.h>
 #include <linux/kdev_t.h>
 #include <linux/gfp.h>
+#include <linux/i2c.h>
 #include <linux/err.h>
 #include <linux/export.h>
 
@@ -287,6 +288,9 @@ int drm_sysfs_connector_add(struct drm_connector *connector)
 	/* Let userspace know we have a new connector */
 	drm_sysfs_hotplug_event(dev);
 
+	if (connector->ddc)
+		return sysfs_create_link(&connector->kdev->kobj,
+				 &connector->ddc->dev.kobj, "ddc");
 	return 0;
 }
 
@@ -294,6 +298,10 @@ void drm_sysfs_connector_remove(struct drm_connector *connector)
 {
 	if (!connector->kdev)
 		return;
+
+	if (connector->ddc)
+		sysfs_remove_link(&connector->kdev->kobj, "ddc");
+
 	DRM_DEBUG("removing \"%s\" from sysfs\n",
 		  connector->name);
 
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
index 97ea41dc6..d8f4e66fb 100644
--- a/include/drm/drm_connector.h
+++ b/include/drm/drm_connector.h
@@ -40,6 +40,7 @@ struct drm_property;
 struct drm_property_blob;
 struct drm_printer;
 struct edid;
+struct i2c_adapter;
 
 enum drm_connector_force {
 	DRM_FORCE_UNSPECIFIED,
@@ -998,6 +999,16 @@ struct drm_connector {
 	 * [0]: progressive, [1]: interlaced
 	 */
 	int audio_latency[2];
+
+	/**
+	 * @ddc: associated ddc adapter.
+	 * A connector usually has its associated ddc adapter. If a driver uses
+	 * this field, then an appropriate symbolic link is created in connector
+	 * sysfs directory to make it easy for the user to tell which i2c
+	 * adapter is for a particular display.
+	 */
+	struct i2c_adapter *ddc;
+
 	/**
 	 * @null_edid_counter: track sinks that give us all zeros for the EDID.
 	 * Needed to workaround some HW bugs where we get all 0s