All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Tian Tao <tiantao6@hisilicon.com>,
	airlied@linux.ie, daniel@ffwll.ch, kraxel@redhat.com,
	alexander.deucher@amd.com, tglx@linutronix.de,
	dri-devel@lists.freedesktop.org, xinliang.liu@linaro.org
Subject: Re: [RFC] drm/connector: Set the default callback function for drm_connector_funcs
Date: Fri, 8 Jan 2021 09:12:38 +0100	[thread overview]
Message-ID: <d8e3cdca-79dd-2c41-27c1-b09a45670976@suse.de> (raw)
In-Reply-To: <1610092442-36168-1-git-send-email-tiantao6@hisilicon.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 3541 bytes --]

Hi

Am 08.01.21 um 08:54 schrieb Tian Tao:
> The member functions of drm_connector_funcs are not specific to each
> manufacturer's driver, so drm_connector_funcs is allowed to use default
> values, which prevents all drivers from setting the same member
> functions for drm_connector_funcs.

I don't think that's a good idea.

> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>   drivers/gpu/drm/drm_connector.c                  | 7 ++++++-
>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | 1 -
>   include/drm/drm_connector.h                      | 2 +-
>   3 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 98b6ec4..356d8a3 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -25,6 +25,7 @@
>   #include <drm/drm_encoder.h>
>   #include <drm/drm_utils.h>
>   #include <drm/drm_print.h>
> +#include <drm/drm_probe_helper.h>
>   #include <drm/drm_drv.h>
>   #include <drm/drm_file.h>
>   #include <drm/drm_sysfs.h>
> @@ -216,7 +217,7 @@ void drm_connector_free_work_fn(struct work_struct *work)
>    */
>   int drm_connector_init(struct drm_device *dev,
>   		       struct drm_connector *connector,
> -		       const struct drm_connector_funcs *funcs,
> +		       struct drm_connector_funcs *funcs,

Drivers cannot legally declare the funcs instance as static const. 
Having static const allows for write protected pages.

>   		       int connector_type)
>   {
>   	struct drm_mode_config *config = &dev->mode_config;
> @@ -228,6 +229,10 @@ int drm_connector_init(struct drm_device *dev,
>   		(!funcs->atomic_destroy_state ||
>   		 !funcs->atomic_duplicate_state));
>   
> +	if (!funcs->fill_modes)
> +		funcs->fill_modes = &drm_helper_probe_single_connector_modes;

It's not clear that this is really the correct function for this driver.

Best regards
Thomas

> +
> +
>   	ret = __drm_mode_object_add(dev, &connector->base,
>   				    DRM_MODE_OBJECT_CONNECTOR,
>   				    false, drm_connector_free);
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> index c76f996..7d3b662 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
> @@ -64,7 +64,6 @@ static const struct drm_connector_helper_funcs
>   };
>   
>   static const struct drm_connector_funcs hibmc_connector_funcs = {
> -	.fill_modes = drm_helper_probe_single_connector_modes,
>   	.destroy = hibmc_connector_destroy,
>   	.reset = drm_atomic_helper_connector_reset,
>   	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 1922b27..4810583 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -1561,7 +1561,7 @@ struct drm_connector {
>   
>   int drm_connector_init(struct drm_device *dev,
>   		       struct drm_connector *connector,
> -		       const struct drm_connector_funcs *funcs,
> +		       struct drm_connector_funcs *funcs,
>   		       int connector_type);
>   int drm_connector_init_with_ddc(struct drm_device *dev,
>   				struct drm_connector *connector,
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2021-01-08  8:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08  7:54 [RFC] drm/connector: Set the default callback function for drm_connector_funcs Tian Tao
2021-01-08  8:12 ` Thomas Zimmermann [this message]
2021-01-08  8:58   ` Daniel Vetter
2021-01-08 13:07   ` Jani Nikula
2021-01-08 15:16 ` kernel test robot
2021-01-08 15:17 ` kernel test robot
2021-01-08 23:32 ` kernel test robot

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=d8e3cdca-79dd-2c41-27c1-b09a45670976@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tiantao6@hisilicon.com \
    --cc=xinliang.liu@linaro.org \
    /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.