Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp876342ybr; Fri, 22 May 2020 23:54:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGezcWxMSi3WDvMDs55axwm0arwSLhGEznx4fYil5qA0dWFmklEkbKzlrtXUqGMOwxBjhh X-Received: by 2002:a17:906:d148:: with SMTP id br8mr10703795ejb.356.1590216876563; Fri, 22 May 2020 23:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590216876; cv=none; d=google.com; s=arc-20160816; b=yiZGIgM0eEsJlwKOne4mHF5rDOHnPFQQ48dBGvIWYutoA3BKLgA/4f/OGSQ8qqlAh3 lWipGQ8egcFi3IE6UvBtsJzKz7UwxfzrX5NY6DF8APqR+5rtt1QLVSaSHb7bmDQ+g2ZR klZCzRMW9DGbVmst2vUTjqbpgkQbGXpjt/d2uTvgKPNRG7w3vBBnd80CJ9Gdh0RGyBvZ UAqqK/62jIsSvhCRvb+CHXAkJFFqXIn0tgjBTT/whyGN8tetl1JPcezXgSqpNBGjayAy qzNU6cQu+agKQY61onSh7Hw5XSRAeSapV67fYQKQQ3P9WqNDQzIiI7ajEv7Z6aSMvz2t wUOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=NpNzKiRERZoLVhj+jDvGzomV5rdbxMN4yOkmuyXrsqc=; b=qrigfamqDqhTPfNDwS8J4cALrhl3MMGGHV1Vle3LZSs3oRRgIOPG5HN7GIY0L54Kzn pIZxN8PK49MNOHjFQ8EwHm+Ki0STx94BgPkrPS8esnU4JZJnCwGb6bgPJOnnC2o1CqG2 FlL22iJAm+G34+2n8dE1WrGn+HFBbea/UpU+QpoYgy/OLnN4LcuGa9bwyw67w2DGN8dY ldr6KuzO2CeZDGC/h9kCdVi5uX3W54pEnv25tFsNXVzNch6eXCugVPqyDpaOGNjSWkG/ ubsLON4S2Nic7wMPp7nh1Ctc0D1ZbulyqJP/ohop9m5dzI8KitGut6D78ebchXblVXTx /yCQ== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si5723138eds.254.2020.05.22.23.53.31; Fri, 22 May 2020 23:54:36 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387663AbgEWGso (ORCPT + 99 others); Sat, 23 May 2020 02:48:44 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37297 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387466AbgEWGso (ORCPT ); Sat, 23 May 2020 02:48:44 -0400 Received: by mail-pl1-f195.google.com with SMTP id x10so5304787plr.4; Fri, 22 May 2020 23:48:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=NpNzKiRERZoLVhj+jDvGzomV5rdbxMN4yOkmuyXrsqc=; b=dfSjIyfKRCEdcQDSYFHtXy52a4IusV7vOl3zfbH0GuzpOUbLjPhksRISHxozp792wY /eELU7qVZEOyRRBXJ3y/cGXu/A9fNm3cXpZT7PklU/LxySn/PgilSup+KaXxR8LK6Zap OERMiyxxeKiVBoEb/+E9C8eiT9QvC7IsOT4Gcc3vmiI3tfDobU1B10Kbs1bdDQzFtJmb HB7IQGUHXoBB6n4aTYfVxpaTJt8m0910imxNLzBlsInYg6+Hk9o17ZpA+TJyjMwJ/FbH ncPunslXALS8j98l6ujGrIEWnQq5MgxZFkosMW4eVS67RaGLfn1nCGOFkXBk6BIo5fok jHUw== X-Gm-Message-State: AOAM532uAwFwhKytexhN2ubbcKHf2qpUF7TwlDXvuz2WIv3141EjCWl3 1mNkz0yOVw0Y07vzJ4WIwgI= X-Received: by 2002:a17:902:82c9:: with SMTP id u9mr18209345plz.179.1590216523391; Fri, 22 May 2020 23:48:43 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id k24sm8362342pfk.134.2020.05.22.23.48.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 23:48:42 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 32F45404B0; Sat, 23 May 2020 06:48:41 +0000 (UTC) Date: Sat, 23 May 2020 06:48:41 +0000 From: Luis Chamberlain To: Greg Kroah-Hartman Cc: Scott Branden , David Brown , Alexander Viro , Shuah Khan , bjorn.andersson@linaro.org, Shuah Khan , Arnd Bergmann , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-fsdevel@vger.kernel.org, BCM Kernel Feedback , Olof Johansson , Andrew Morton , Dan Carpenter , Colin Ian King , Kees Cook , Takashi Iwai , linux-kselftest@vger.kernel.org, Andy Gross Subject: Re: [PATCH] firmware_loader: change enum fw_opt to u32 Message-ID: <20200523064841.GJ11244@42.do-not-panic.com> References: <20200522214658.12722-1-scott.branden@broadcom.com> <20200522224508.GE11244@42.do-not-panic.com> <20200522230025.GG11244@42.do-not-panic.com> <20200523060548.GA3124611@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200523060548.GA3124611@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 23, 2020 at 08:05:48AM +0200, Greg Kroah-Hartman wrote: > On Fri, May 22, 2020 at 11:00:25PM +0000, Luis Chamberlain wrote: > > On Fri, May 22, 2020 at 03:49:05PM -0700, Scott Branden wrote: > > > Hi Luis, > > > > > > On 2020-05-22 3:45 p.m., Luis Chamberlain wrote: > > > > On Fri, May 22, 2020 at 02:46:58PM -0700, Scott Branden wrote: > > > > > /** > > > > > - * enum fw_opt - options to control firmware loading behaviour > > > > > + * fw_opt - options to control firmware loading behaviour > > > > > * > > > > > * @FW_OPT_UEVENT: Enables the fallback mechanism to send a kobject uevent > > > > > * when the firmware is not found. Userspace is in charge to load the > > > > > @@ -33,15 +33,13 @@ > > > > > * the platform's main firmware. If both this fallback and the sysfs > > > > > * fallback are enabled, then this fallback will be tried first. > > > > > */ > > > > > -enum fw_opt { > > > > > - FW_OPT_UEVENT = BIT(0), > > > > > - FW_OPT_NOWAIT = BIT(1), > > > > > - FW_OPT_USERHELPER = BIT(2), > > > > > - FW_OPT_NO_WARN = BIT(3), > > > > > - FW_OPT_NOCACHE = BIT(4), > > > > > - FW_OPT_NOFALLBACK_SYSFS = BIT(5), > > > > > - FW_OPT_FALLBACK_PLATFORM = BIT(6), > > > > > -}; > > > > > +#define FW_OPT_UEVENT BIT(0) > > > > > +#define FW_OPT_NOWAIT BIT(1) > > > > > +#define FW_OPT_USERHELPER BIT(2) > > > > > +#define FW_OPT_NO_WARN BIT(3) > > > > > +#define FW_OPT_NOCACHE BIT(4) > > > > > +#define FW_OPT_NOFALLBACK_SYSFS BIT(5) > > > > > +#define FW_OPT_FALLBACK_PLATFORM BIT(6) > > > > Everything looked good up to here. The enum defines each flag. > > > > We just want to use an enum for *one* flag represetnation, not > > > > a bundle. > > > > > > I do not know exactly what you are looking for then.? The FW_OPT_* > > > values are OR'd together in the code.? You still want the fw_opt enum > > > above left in place entirely and then the values used in OR'd > > > together? > > > > Yes, exactly. If they are combined then we just use a u32 to represent > > these are then flags combined. An enum represents just *one* flag, not > > a set which are OR'd together. Let me know if this is still not clear. > > If this is the case, why have an enum at all? What difference is it > from a #define like was done here? If used on a switch to test for cases the compiler will error if you miss one, and it is easier to use kdoc for them. Luis