Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp436763pxb; Wed, 3 Nov 2021 06:44:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBNNC2yBM5R4EcLf8EBXOm7Prr0gWgxUQFMEfo/36LaCHv33lVWwERfsNE3+cxuuQ71uCF X-Received: by 2002:a05:6638:d16:: with SMTP id q22mr25603255jaj.35.1635947049153; Wed, 03 Nov 2021 06:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635947049; cv=none; d=google.com; s=arc-20160816; b=PYPcSYqvon2z2nQ61fnEZXhXh/F3UXxjJSWQPPS3CZrDzfaWh6UJOfrVlMt3KrBu3G LddGZclV6wfPhrk6plX1Yo6UhbGTlUZzjoYtxCZnQUxmkdEz7WVdP2OA7ICmkNMVu66+ 9a9gkwDmBMmg9ZYIgn5YHoDv81XmKr/Ix4jugKS3X4kPLQasx7AGtFqfEm0Ggr8Pn9yL na/ujysXPhNTpEnyvecDNw4rezgymp0XxVNfWA1x10JqT8txRJ0VUSLnlgdJ83Grh0Fq YRhqqwpy+hfDHu+Dxyv/F2QTfNqsMAzSaZskQN1TdpvbjJs3a+Kg70qFjCCd3dZq9B+s Nhgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from; bh=Ofkifm7yw2IhSzCo07hhZ32e7+DL9J24mElLGMBn96U=; b=KMc3uxuLLisxcMwo6dRF5PKP3uXh9MtFpDr7vI1xu4F5sGzz+AP7Za+sG8dBHG+33K iIK5BrA38M+XgGuHw0Tg2WBdjBGNTk2MAllYMpu0HriqOTo/Dpi/E3ak0bEFsVMwX/X1 c3EAat8RJk9IlVUEcCO6JexW3fQcuJrsRbnX0j5UHx2lXtRvPID79nRmhJ+V0MxHZnPd OBx8CqVlq6h2gyGdrUBDmFFWa/DaxTpOtOklOGTR62RHfqXbrR4ytwcL8Eg8aZ3MkJJ0 LVPKJ9TM2z81K/YWCV6bZBKUS1sQ/SdjafGfXRJXk6M/eBdM0Xasu1Rfd9bEY2DhaHUj yd5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b14si4297849ilv.20.2021.11.03.06.43.57; Wed, 03 Nov 2021 06:44:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231476AbhKCNno (ORCPT + 99 others); Wed, 3 Nov 2021 09:43:44 -0400 Received: from mga01.intel.com ([192.55.52.88]:11862 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230282AbhKCNnn (ORCPT ); Wed, 3 Nov 2021 09:43:43 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10156"; a="255122386" X-IronPort-AV: E=Sophos;i="5.87,205,1631602800"; d="scan'208";a="255122386" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2021 06:41:06 -0700 X-IronPort-AV: E=Sophos;i="5.87,205,1631602800"; d="scan'208";a="489568012" Received: from bmagdala-mobl.ger.corp.intel.com (HELO localhost) ([10.251.215.42]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2021 06:41:02 -0700 From: Jani Nikula To: Javier Martinez Canillas , linux-kernel@vger.kernel.org Cc: Pekka Paalanen , dri-devel@lists.freedesktop.org, David Airlie , Daniel Vetter , Michel =?utf-8?Q?D=C3=A4nzer?= , Javier Martinez Canillas , Peter Robinson , Thomas Zimmermann , Neal Gompa Subject: Re: [RESEND PATCH 4/5] drm: Add a drm_drv_enabled() helper function In-Reply-To: <20211103123206.1041442-1-javierm@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20211103123206.1041442-1-javierm@redhat.com> Date: Wed, 03 Nov 2021 15:41:00 +0200 Message-ID: <87o871bbmb.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 03 Nov 2021, Javier Martinez Canillas wrote: > DRM drivers can use this to determine whether they can be enabled or not. > > For now it's just a wrapper around drm_modeset_disabled() but having the > indirection level will allow to add other conditions besides "nomodeset". > > Suggested-by: Thomas Zimmermann > Signed-off-by: Javier Martinez Canillas Can't see i915 trivially using this due to the drm_driver parameter. Please let's not merge helpers like this without actual users. BR, Jani. > --- > > drivers/gpu/drm/drm_drv.c | 21 +++++++++++++++++++++ > include/drm/drm_drv.h | 1 + > 2 files changed, 22 insertions(+) > > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c > index 8214a0b1ab7f..70ef08941e06 100644 > --- a/drivers/gpu/drm/drm_drv.c > +++ b/drivers/gpu/drm/drm_drv.c > @@ -975,6 +975,27 @@ int drm_dev_set_unique(struct drm_device *dev, const char *name) > } > EXPORT_SYMBOL(drm_dev_set_unique); > > +/** > + * drm_drv_enabled - Checks if a DRM driver can be enabled > + * @driver: DRM driver to check > + * > + * Checks whether a DRM driver can be enabled or not. This may be the case > + * if the "nomodeset" kernel command line parameter is used. > + * > + * Returns: > + * True if the DRM driver is enabled and false otherwise. > + */ > +bool drm_drv_enabled(const struct drm_driver *driver) > +{ > + if (drm_modeset_disabled()) { > + DRM_INFO("%s driver is disabled\n", driver->name); > + return false; > + } > + > + return true; > +} > +EXPORT_SYMBOL(drm_drv_enabled); > + > /* > * DRM Core > * The DRM core module initializes all global DRM objects and makes them > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index 0cd95953cdf5..48f2b6eec012 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -598,5 +598,6 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev) > > int drm_dev_set_unique(struct drm_device *dev, const char *name); > > +bool drm_drv_enabled(const struct drm_driver *driver); > > #endif -- Jani Nikula, Intel Open Source Graphics Center