linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Thomas Huth <thuth@redhat.com>,
	Gustavo Padovan <gustavo@padovan.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Sean Paul <seanpaul@chromium.org>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org
Cc: borntraeger@de.ibm.com, Farhan Ali <alifm@linux.ibm.com>,
	linux-kernel@vger.kernel.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [PATCH 2/2] drm: Make the DRM code compilable without CONFIG_I2C
Date: Fri, 13 Apr 2018 16:04:36 +0300	[thread overview]
Message-ID: <87woxbdzq3.fsf@intel.com> (raw)
In-Reply-To: <1523612456-14827-3-git-send-email-thuth@redhat.com>

On Fri, 13 Apr 2018, Thomas Huth <thuth@redhat.com> wrote:
> Selecting CONFIG_HDMI for S390 is inappropriate - there is no real
> graphic hardware on this architecture. The drm subsystem is only
> enabled here for using the virtual graphics card "virtio-gpu". So
> it should be possible to compile the drm subsystem also without
> CONFIG_I2C. Tweak the Makefile to only compile the affected files
> with CONFIG_I2C=y and disable some I2C-related code in drm_edid.c.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  drivers/gpu/drm/Kconfig    |  4 ++--
>  drivers/gpu/drm/Makefile   | 16 +++++++++-------
>  drivers/gpu/drm/drm_edid.c | 10 +++++++---
>  3 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 298a518..c9df67f 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -10,8 +10,8 @@ menuconfig DRM
>  	select DRM_PANEL_ORIENTATION_QUIRKS
>  	select HDMI if !S390
>  	select FB_CMDLINE
> -	select I2C
> -	select I2C_ALGOBIT
> +	select I2C if !S390
> +	select I2C_ALGOBIT if !S390
>  	select DMA_SHARED_BUFFER
>  	select SYNC_FILE
>  	help
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 16fd8e3..4cf53ba 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -7,10 +7,9 @@ drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
>  		drm_context.o drm_dma.o \
>  		drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
>  		drm_lock.o drm_memory.o drm_drv.o \
> -		drm_scatter.o drm_pci.o \
> +		drm_scatter.o drm_pci.o drm_info.o \
>  		drm_sysfs.o drm_hashtab.o drm_mm.o \
>  		drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \
> -		drm_info.o drm_encoder_slave.o \
>  		drm_trace_points.o drm_global.o drm_prime.o \
>  		drm_rect.o drm_vma_manager.o drm_flip_work.o \
>  		drm_modeset_lock.o drm_atomic.o drm_bridge.o \
> @@ -20,6 +19,7 @@ drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
>  		drm_dumb_buffers.o drm_mode_config.o drm_vblank.o \
>  		drm_syncobj.o drm_lease.o
>  
> +drm-$(CONFIG_I2C) += drm_encoder_slave.o
>  drm-$(CONFIG_HDMI) += drm_hdmi.o
>  drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
>  drm-$(CONFIG_DRM_VM) += drm_vm.o
> @@ -32,11 +32,13 @@ drm-$(CONFIG_AGP) += drm_agpsupport.o
>  drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o
>  drm-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o
>  
> -drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \
> -		drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \
> -		drm_kms_helper_common.o drm_dp_dual_mode_helper.o \
> -		drm_simple_kms_helper.o drm_modeset_helper.o \
> -		drm_scdc_helper.o drm_gem_framebuffer_helper.o
> +drm_kms_helper-y := drm_crtc_helper.o drm_probe_helper.o \
> +		drm_plane_helper.o drm_atomic_helper.o \
> +		drm_gem_framebuffer_helper.o drm_kms_helper_common.o \
> +		drm_simple_kms_helper.o drm_modeset_helper.o
> +
> +drm_kms_helper-$(CONFIG_I2C) += drm_dp_helper.o drm_dp_mst_topology.o \
> +		drm_dp_dual_mode_helper.o drm_scdc_helper.o
>  
>  drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
>  drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 3820763..0d0d5af 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1467,11 +1467,14 @@ bool drm_edid_is_valid(struct edid *edid)
>  static int
>  drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
>  {
> -	struct i2c_adapter *adapter = data;
> -	unsigned char start = block * EDID_LENGTH;
>  	unsigned char segment = block >> 1;
>  	unsigned char xfers = segment ? 3 : 2;
> -	int ret, retries = 5;
> +	int ret = -1;
> +
> +#if IS_ENABLED(CONFIG_I2C)

So I don't know if the patches are worth it, I'll let others decide, but
no matter what the conditional build needs to be *outside* of function
bodies. The #else branch would then contain just:

#else
static inline int
drm_do_probe_ddc_edid(void *data, u8 *buf, unsigned int block, size_t len)
{
        return -1;
}
#endif /* CONFIG_I2C */


BR,
Jani.

> +	struct i2c_adapter *adapter = data;
> +	unsigned char start = block * EDID_LENGTH;
> +	int retries = 5;
>  
>  	/*
>  	 * The core I2C driver will automatically retry the transfer if the
> @@ -1512,6 +1515,7 @@ bool drm_edid_is_valid(struct edid *edid)
>  			break;
>  		}
>  	} while (ret != xfers && --retries);
> +#endif	/* CONFIG_I2C */
>  
>  	return ret == xfers ? 0 : -1;
>  }

-- 
Jani Nikula, Intel Open Source Technology Center

  reply	other threads:[~2018-04-13 13:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-13  9:40 [PATCH 0/2] drm: Make it compilable without CONFIG_HDMI and CONFIG_I2C Thomas Huth
2018-04-13  9:40 ` [PATCH 1/2] drm: Move CONFIG_HDMI-dependent code to a separate file Thomas Huth
2018-04-13  9:40 ` [PATCH 2/2] drm: Make the DRM code compilable without CONFIG_I2C Thomas Huth
2018-04-13 13:04   ` Jani Nikula [this message]
2018-04-13 14:32 ` [PATCH 0/2] drm: Make it compilable without CONFIG_HDMI and CONFIG_I2C Daniel Vetter
2018-04-13 14:46   ` Thomas Huth
2018-04-13 14:53     ` Daniel Vetter

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=87woxbdzq3.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=alifm@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gustavo@padovan.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=seanpaul@chromium.org \
    --cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).