Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2056249pxb; Thu, 4 Nov 2021 13:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+RKYrC6/c9KoJFnUnEmRV1ZjZU4SdK6y4xluWLWQFeU2SaBgR0zQscHICa8P3ciJFN44m X-Received: by 2002:aa7:dc13:: with SMTP id b19mr57214690edu.145.1636056860156; Thu, 04 Nov 2021 13:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636056860; cv=none; d=google.com; s=arc-20160816; b=pN+83+aysOqbC6AOxpFLo2RCdNbnFQjmmPPBCRvIic8tjAGp1QDKngBE6OUs45sh8Y pZccFyjXOOAJMyn+IYj03vVMlKN4/NEvXQPio/tFbOGXCM9XogXVlsOji64gGqqUpljq AAy/ZH9p8+BSFBgqYfI7FN3CQzpr0mqvKesWCWCPilQysl0Rh3QtFgkKxcKaFfvhSpnR j3jAn+9VEGxSm18NevI5jmqMpVqDAf/SY0D1QQXkG5XrS6RosrFV/3eTRjJNH6xIchZT 1kI0Uk8gcOdl6HFV15d70bd9mhgnclqZEqwX/pnJ/+wygi+DUVsf6Zox4wWr0q7aWpJj Bjqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=WRdrRlX7d6jR9XJ1WlJwuA/7L4WdNGNHCwwgPSMtrew=; b=OJh1rVr27pqGKIAEqeK2syQjPXNKZihp8N+zy3a5mbmN61zTk0TGLKwK+86d2oLmzx U5flotq84o+i5rbfAPh/vzN4JJZxrajDVl2VUMqCpwh3tk6MgIFtzHOSLGLJnl5/xpSC qHCN+HzL0QWtmUAXErKp3XAy3+darK5m578lM5xxvFhvmY8RFbotJvD6vFzffCrbsSPo ArxlhvK0fwvPRgNnSjOd7nf7w2Qu7XJceskvRDb5QkKMDSpC81QMGG5ca8icsEHtqwtV SiqoSWQkM5UxUUzrtDLMveXcvOk45IaN1BDm6X/khwhMnNtNCjZmWzWWvyGEcfuZVdu/ KuUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="dDewa/Lt"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qa43si12195470ejc.76.2021.11.04.13.13.52; Thu, 04 Nov 2021 13:14:20 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="dDewa/Lt"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232166AbhKDUL7 (ORCPT + 99 others); Thu, 4 Nov 2021 16:11:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44632 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232167AbhKDUL6 (ORCPT ); Thu, 4 Nov 2021 16:11:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636056559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WRdrRlX7d6jR9XJ1WlJwuA/7L4WdNGNHCwwgPSMtrew=; b=dDewa/LtGBJX7ac4fwngfqrK3V0fYBgwe+JLjd8GGTEQ1eZqtvHimZmHkNb2MWId6OpMe4 HTZd/hQxjMhhf1/oCMVhZIyNr1OO3vGG7gUcU+MqTAZyqMZM+UmA92DYXS5vxkJy3HaJHG WZC+ZVdbavgqa5ilcXPTOemEuhnqZWQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-125-CyVjZpq5NbmvRtCbemev9w-1; Thu, 04 Nov 2021 16:09:18 -0400 X-MC-Unique: CyVjZpq5NbmvRtCbemev9w-1 Received: by mail-wr1-f69.google.com with SMTP id j12-20020adf910c000000b0015e4260febdso1399277wrj.20 for ; Thu, 04 Nov 2021 13:09:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=WRdrRlX7d6jR9XJ1WlJwuA/7L4WdNGNHCwwgPSMtrew=; b=cQIb5tEQ3Q8xNncN8Fjk6N7x3Qk3MnMiA7OON8Agy45urCSTByWYNPP9Q2bG5z4IPW T54GQmaQ6280ErlaZUrVJgieYC4sapPeWmqDuNMpdv19Yhev5GrYEmeRTpr624EFd4XK CxSl1n9ELh3aW0UOAvWN3z4fRjQaCTUCQdRQIlJ2qxGuXAtTcdAErHj2ttuSViA2T/yy 9jJyJQVYIe3ZPkyW0IHksNWM7XhmgeBxHBPP7m5ZUdhN8DTFTl7d0/9hIQsZ6BgrqiA+ Eepz1MBgNk/8bHFRXa/wWdW665l/NJEgZriVtmkef/7oEcwGcoVEhWt7q7e3Rq8X1BqQ AsKA== X-Gm-Message-State: AOAM532y0AgFEkslA5Eka11Qf+aeWq20Wol8ROQ7GkSELFi9jUVLyBBS 30jW4zQ80tE7RIdGuCxliwpjYpsyhxKdb/RCASnXijnRLcHDCg7PyxPnFhEnO5bB6l1FCvlPx4C 4Ud9mi0HCqkAyAI5vUSmCB+dt X-Received: by 2002:a1c:ed03:: with SMTP id l3mr26040179wmh.86.1636056557044; Thu, 04 Nov 2021 13:09:17 -0700 (PDT) X-Received: by 2002:a1c:ed03:: with SMTP id l3mr26040146wmh.86.1636056556830; Thu, 04 Nov 2021 13:09:16 -0700 (PDT) Received: from [192.168.1.128] ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id z15sm6028960wrr.65.2021.11.04.13.09.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Nov 2021 13:09:16 -0700 (PDT) Message-ID: <0c07f121-42d3-9f37-1e14-842fb685b501@redhat.com> Date: Thu, 4 Nov 2021 21:09:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled Content-Language: en-US To: Jani Nikula , linux-kernel@vger.kernel.org Cc: =?UTF-8?Q?Michel_D=c3=a4nzer?= , Thomas Zimmermann , Daniel Vetter , Peter Robinson , Pekka Paalanen , Alex Deucher , Ben Skeggs , Chia-I Wu , =?UTF-8?Q?Christian_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 References: <20211104160707.1407052-1-javierm@redhat.com> <20211104160707.1407052-2-javierm@redhat.com> <87ilx7ae3v.fsf@intel.com> From: Javier Martinez Canillas In-Reply-To: <87ilx7ae3v.fsf@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Jani, On 11/4/21 20:57, Jani Nikula wrote: > 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! */ > } > It used to return a bool in v2 but Thomas suggested an int instead to have consistency on the errno code that was returned by the callers. I should probably name that function differently to avoid confusion. But I think you are correct and this change is caused too much churn for not that much benefit, specially since is unclear that there might be another condition to prevent a DRM driver to load besides nomodeset. I'll just drop this patch and post only #2 but making drivers to test using the drm_check_modeset() function (which doesn't have a name that implies a bool return). > > BR, > Jani. > > > Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat