Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2041616pxb; Thu, 4 Nov 2021 12:59:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIIuLvvJfjhMgm6wP9uK9WZHq5gj+hKifCKS9nQcD3i0nUZrXcVd/Sw8caM4IOvfBHlY1I X-Received: by 2002:a05:6402:280f:: with SMTP id h15mr41055831ede.286.1636055990556; Thu, 04 Nov 2021 12:59:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636055990; cv=none; d=google.com; s=arc-20160816; b=WH438JqM3QbrYPRG7/VMBrLQTJh4yL5qkMwnviTok3AMkVKd1p8rZiL4gReEhmBjt6 cLRs5HUp3FTBuW/9aiL00p5xOdqbiET872mQyjsPH3ffEgqm2Ma5xwM8MkI6M8KKkn/S e17K4c4RH1RI37pSLIwFsEPqh2fNOqMoeXFRezYRYbEqqxaHle2iLotk+Op6ZQcONX3L iajTWTwXcv/FfDUz4fJrDfRzUlheQA85uO+urMKQDWn0Ag7pxDOnaCK4QcLt/4VEH/3t V8adLPWt6uzBaXSpL4nWs/mtaDli2tforDMhaRmYPfJXRIwhjzCliZNP21cuqtx77ktl NX0Q== 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=6lw2UFi8H1SI5CwvZ7L50evPjLnyaGKmx+BCu55EDMo=; b=XVhY4s+BEjNjZFhdz+SdXP4FXaNNmTscojg256R9WH0AguZmSFmmZUs/n8UWZTYOrF uz8YpAFpsMzJsbYPyS2/lCfzbrgHmRZbaF+wY3NiJ+bG+V9aXmrenJNQSDxSujH17QW5 CjkENOs3XIk2umD0wuaE6TSBvS0n7HfO/EATDrv/0lnWUHyr7xJbjKE9ghiJWCcSTHPL crNl7j3ZNuGfWvfIHWdnYrEfbevn6WcZwyALSWU2IymryddaRwFoCKS13sNoOv6KDrwO z1B+xGJ6NOKNskpk0R1D0fBvAGdyL4IB/i+G3lkUAiR9r83TSnu2DLc6MizI9mskmMjq MV6A== 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 h23si1821895edv.47.2021.11.04.12.59.25; Thu, 04 Nov 2021 12:59:50 -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 S231206AbhKDT77 (ORCPT + 99 others); Thu, 4 Nov 2021 15:59:59 -0400 Received: from mga05.intel.com ([192.55.52.43]:33932 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbhKDT76 (ORCPT ); Thu, 4 Nov 2021 15:59:58 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10158"; a="317985239" X-IronPort-AV: E=Sophos;i="5.87,209,1631602800"; d="scan'208";a="317985239" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2021 12:57:19 -0700 X-IronPort-AV: E=Sophos;i="5.87,209,1631602800"; d="scan'208";a="501676017" Received: from mihaelac-mobl.ger.corp.intel.com (HELO localhost) ([10.249.32.21]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2021 12:57:11 -0700 From: Jani Nikula To: Javier Martinez Canillas , linux-kernel@vger.kernel.org Cc: Michel =?utf-8?Q?D=C3=A4nzer?= , Thomas Zimmermann , Daniel Vetter , Peter Robinson , Pekka Paalanen , Javier Martinez Canillas , Alex Deucher , Ben Skeggs , Chia-I Wu , Christian =?utf-8?Q?K=C3=B6nig?= , Daniel Vetter , Dave Airlie , David Airlie , Gerd Hoffmann , Gurchetan Singh , Hans de Goede , Joonas Lahtinen , Maarten Lankhorst , Maxime Ripard , "Pan\, Xinhui" , Rodrigo Vivi , VMware Graphics , Zack Rusin , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, spice-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled In-Reply-To: <20211104160707.1407052-2-javierm@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20211104160707.1407052-1-javierm@redhat.com> <20211104160707.1407052-2-javierm@redhat.com> Date: Thu, 04 Nov 2021 21:57:08 +0200 Message-ID: <87ilx7ae3v.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 04 Nov 2021, Javier Martinez Canillas wrote: > +/** > + * 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. > + * > + * Return: 0 on success or a negative error code on failure. > + */ > +int drm_drv_enabled(const struct drm_driver *driver) > +{ > + if (vgacon_text_force()) { > + DRM_INFO("%s driver is disabled\n", driver->name); > + return -ENODEV; > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_drv_enabled); The name implies a bool return, but it's not. if (drm_drv_enabled(...)) { /* surprise, it's disabled! */ } BR, Jani. -- Jani Nikula, Intel Open Source Graphics Center