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 X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84E7DC2D0CE for ; Tue, 21 Jan 2020 14:26:33 +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 65D882070C for ; Tue, 21 Jan 2020 14:26:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 65D882070C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 049A46ED17; Tue, 21 Jan 2020 14:26:30 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A7546ED15; Tue, 21 Jan 2020 14:26:28 +0000 (UTC) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2020 06:26:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,346,1574150400"; d="scan'208";a="215552065" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga007.jf.intel.com with SMTP; 21 Jan 2020 06:26:25 -0800 Received: by stinkbox (sSMTP sendmail emulation); Tue, 21 Jan 2020 16:26:24 +0200 Date: Tue, 21 Jan 2020 16:26:24 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Jani Nikula Message-ID: <20200121142624.GA13686@intel.com> References: <20200121105331.6825-1-jani.nikula@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200121105331.6825-1-jani.nikula@intel.com> X-Patchwork-Hint: comment User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [Intel-gfx] [PATCH 1/2] drm: support feature masks in drm_core_check_feature() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Tue, Jan 21, 2020 at 12:53:30PM +0200, Jani Nikula wrote: > Allow a mask of features to be passed to drm_core_check_feature(). All > features in the mask are required. > = > Signed-off-by: Jani Nikula > --- > include/drm/drm_drv.h | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > = > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h > index cf13470810a5..51b486d1ee81 100644 > --- a/include/drm/drm_drv.h > +++ b/include/drm/drm_drv.h > @@ -826,16 +826,18 @@ static inline bool drm_dev_is_unplugged(struct drm_= device *dev) > /** > * drm_core_check_feature - check driver feature flags > * @dev: DRM device to check > - * @feature: feature flag > + * @feature: feature flag(s) ^ missing 's' > * > * This checks @dev for driver features, see &drm_driver.driver_features, > * &drm_device.driver_features, and the various &enum drm_driver_feature= flags. > * > - * Returns true if the @feature is supported, false otherwise. > + * Returns true if all features in the @feature mask are supported, false same here > + * otherwise. > */ > -static inline bool drm_core_check_feature(const struct drm_device *dev, = u32 feature) > +static inline bool drm_core_check_feature(const struct drm_device *dev, = u32 features) > { > - return dev->driver->driver_features & dev->driver_features & feature; > + return features && (dev->driver->driver_features & dev->driver_features= & > + features) =3D=3D features; Could maybe do with an extra variable? u32 supported =3D driver->driver_features & dev->driver_features; return features && (features & supported) =3D=3D features; Series is Reviewed-by: Ville Syrj=E4l=E4 > } > = > /** > -- = > 2.20.1 > = > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- = Ville Syrj=E4l=E4 Intel _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx