From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 689D3C433FE for ; Fri, 5 Nov 2021 13:48:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22C52611AE for ; Fri, 5 Nov 2021 13:48:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 22C52611AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53A716E5B0; Fri, 5 Nov 2021 13:48:55 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id E94836E044 for ; Fri, 5 Nov 2021 09:48:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636105725; 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=TDCxTaiuFN2oEnFyA/uNKzyzy5BqHnuVtliUgcTwAYg=; b=HayoG0/8luKyjZgIu7u9U0hzYTq9t12JTgi6P7R6h/VlxpMDVPY99NxDpi8hnJLzCHscm7 ekamenkWUedWjh0Sj0OZ6gyw9tvNkezTDadwdmPCEtTXgNFDKPrXOydHE3uszUJNUiQQgI XP+m9uGnXnegtmYEV2C22gUQEqCWXT0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-243-0GJ0kl1BMIupH2JXK6esdQ-1; Fri, 05 Nov 2021 05:48:41 -0400 X-MC-Unique: 0GJ0kl1BMIupH2JXK6esdQ-1 Received: by mail-wm1-f70.google.com with SMTP id z137-20020a1c7e8f000000b0030cd1800d86so3138350wmc.2 for ; Fri, 05 Nov 2021 02:48:41 -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=TDCxTaiuFN2oEnFyA/uNKzyzy5BqHnuVtliUgcTwAYg=; b=N6QjWPMrqPYVY3QLeJsdSTlY3v3Hrpw8qdbzfErzZ2Jn8FzkLsd3qlsaJA1Qn9YJUo /a8fdN9MTZScr6cCFcNc0dL9teL59CTRa9fHMBYMcgoSs4a7Fcnq8dDPxyMsg37bZXaB cnwj4f0GFwJJyCMuceXGsUWmuzHXv8J7pN8cu/cjrWbVj8tynTa74x5LWvTwYnnKGE8I 7LKbaY8ih8slFJi1bq50qhG319H8uVsIgnbX+2Re1r5MpbHa3W9zlTEHObA1CDDYiCdf +vt3sYqb762nOMqKVgDgwQZeDPTNYYCZfjxMGpY8lHJ5Sw7P+apo1wiPKU/2cXqIqRFi f8vg== X-Gm-Message-State: AOAM531KYPi9d0Sf+AE50zZ6pN36FMU2aM68j43bmNfWRMxSbyF4P8Pw Ffsg2tcSwjki3Gjp1vloH3Av5k4CZPFyU7nSofHvVahfs//C/T48y+XZ/jJSIhpBANJi/fhAD8l rGGjWMSoWI3+Wo13lzucviBb/IA== X-Received: by 2002:a05:6000:1043:: with SMTP id c3mr47457546wrx.64.1636105720564; Fri, 05 Nov 2021 02:48:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAy5NPgcgZDunmEq87tVcIv6+r2xtRAUkaFqPrEIO+dNAeu5S620buzaYA0spdyOnq5mk7Jw== X-Received: by 2002:a05:6000:1043:: with SMTP id c3mr47457520wrx.64.1636105720304; Fri, 05 Nov 2021 02:48:40 -0700 (PDT) Received: from [192.168.1.128] ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id u20sm6503643wmq.6.2021.11.05.02.48.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Nov 2021 02:48:39 -0700 (PDT) Message-ID: <38dbcc8f-2f95-6846-537f-9b85468bfa87@redhat.com> Date: Fri, 5 Nov 2021 10:48:38 +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 To: Thomas Zimmermann , Jani Nikula , linux-kernel@vger.kernel.org References: <20211104160707.1407052-1-javierm@redhat.com> <20211104160707.1407052-2-javierm@redhat.com> <87ilx7ae3v.fsf@intel.com> <0c07f121-42d3-9f37-1e14-842fb685b501@redhat.com> From: Javier Martinez Canillas In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=javierm@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Fri, 05 Nov 2021 13:48:53 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Pan, Xinhui" , Pekka Paalanen , Hans de Goede , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, Rodrigo Vivi , amd-gfx@lists.freedesktop.org, Gurchetan Singh , Ben Skeggs , VMware Graphics , Gerd Hoffmann , spice-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, Alex Deucher , Dave Airlie , =?UTF-8?Q?Christian_K=c3=b6nig?= , virtualization@lists.linux-foundation.org, intel-gfx@lists.freedesktop.org, =?UTF-8?Q?Michel_D=c3=a4nzer?= , Peter Robinson Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" Hello Thomas, On 11/5/21 09:43, Thomas Zimmermann wrote: > Hi > > Am 04.11.21 um 21:09 schrieb Javier Martinez Canillas: >> 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) > > Jani mentioned that i915 absolutely wants this to run from the > module_init function. Best is to drop the parameter. > Ok. I now wonder though how much value would add this function since it will just be a wrapper around the nomodeset check. We talked about adding a new DRIVER_GENERIC feature flag and check for this, but as danvet mentioned that is not really needed. We just need to avoid testing for nomodeset in the simpledrm driver. Do you envision other condition that could be added later to disable a DRM driver ? Or do you think that just from a code readability point of view makes worth it ? >>>> +{ >>>> + if (vgacon_text_force()) { >>>> + DRM_INFO("%s driver is disabled\n", driver->name); >>>> + return -ENODEV; >>>> + } > > If we run this from within a module_init function, we'd get plenty of > these warnings if drivers are compiled into the kernel. Maybe simply > remove the message. There's already a warning printed by the nomodeset > handler. > Indeed. I'll just drop it. >>>> + >>>> + 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. > > Yes, please. > drm_driver_check() maybe ? Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat