Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1832351imm; Thu, 23 Aug 2018 09:27:42 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxpytWCKy0NPnTM4zdYShcwlxURgGZsZx1FAeHxdVQeHXEbc1icyhrT1tbhnHCjliizhm5s X-Received: by 2002:a63:bd41:: with SMTP id d1-v6mr26602755pgp.309.1535041662358; Thu, 23 Aug 2018 09:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535041662; cv=none; d=google.com; s=arc-20160816; b=OrIA7jlaOyfEc0CpU+7AZdkWYGqjh/yIivvJT22UvtI1BYm9dnksChh1Mbi7tnf+Fg r4HHNtmbNDnVJQxgKCwpx/L3jZiQhCt4sanUysDtF9cnMa2OUDAM/2nzLWqZ/WWjFiNZ fTiTVhNVkfosZlNa9a/wEll6rHxNovOJYsEKezcMkTlMFSmJiWK8JZiQA9zICSd2ek/N cPWvACOw+zyvhFDestoBjPjXPuW6oRjaERXVd23+6bFIozKtgtYwgzrSR7qklILUGBI1 uymYMMfT3zKA8e3/Dg6VJ4LchlS+Ym/yR2Lw4VAsjAmEI1AjMEm6YchD6Aa+JhGPsEKp +NSw== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=PR+wcPJskNfR1EAymPGP5LsKDIP//2yxf1uFMHMFqSs=; b=z4Tdq0QZoV/L3BlL0rHjMcmfQahe72LeMGWWrmVp98dnXPQEHauxeUUrBxydQfXpLC Ya6IGY8jK7KIWz9WRxzsffztRxmzxOoKvWbrsUih/T+ndk+GZHjaqIIdRk3mcssXhOL0 iZy0s+LUWrBt1zvHVqCl8k0fDPsFbflczuaiEninbL4tk8SiV8RS+cg6WlxnNz/yVqQd LXr9vjxxGSNVGDxJ8uI+3vztYFR8YINl23Ui9P0tnRXZGg2dPLiBYPbLbn5vM5y67VP/ /vSN797G/GVO1c2AprrCKsCWfPbl2YmB0OF6ANelHlc2QQBvx0AZeGjtLmVAMvQsDZMk JKjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EGb8rmqq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8-v6si3917469pli.355.2018.08.23.09.27.27; Thu, 23 Aug 2018 09:27:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EGb8rmqq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732414AbeHWSEs (ORCPT + 99 others); Thu, 23 Aug 2018 14:04:48 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40854 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729381AbeHWSEs (ORCPT ); Thu, 23 Aug 2018 14:04:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PR+wcPJskNfR1EAymPGP5LsKDIP//2yxf1uFMHMFqSs=; b=EGb8rmqqdYKZ2yz73rp6DjCHH 4Bv1NaQQIcxs0bDV6N57kcBooQ2vmuIBz18K7G5+VlVgO7p2FwLPevtuVR1WbBqsdV1cE0jr2sihf 21Y+MlXcQGKeAFj0rx/U6lKUO9P5LcTFoxWbwkea058Z1PCEkgdfsTu/g/ZbpxZJhbnngTBdKE/N6 +rrwxDatzQeVm7fEa+XfS9i8yx6qbsHYkOGcblvhpxl1FIy9yxSXS8jCoGV7dhkQweJ0bzJaF7siE 7zsO3BM4e//zvWF/sic4LHPDyUdX8RlI67CtoNj5KxRZHeSMaKbSN0hPZaCfjB3ELDMdpVCkey8bL 3V85zVFKw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsqhB-0007SU-LH; Thu, 23 Aug 2018 14:34:45 +0000 Date: Thu, 23 Aug 2018 07:34:45 -0700 From: Matthew Wilcox To: Brian Starkey Cc: Daniel Vetter , Eric Engestrom , Alexandru-Cosmin Gheorghe , Jonathan Corbet , Dave Airlie , Linux Doc Mailing List , Linux Kernel Mailing List , dri-devel , Sean Paul , Liviu Dudau , Ayan Kumar Halder Subject: Re: [PATCH] drm/fourcc: Add DOC: overview comment Message-ID: <20180823143445.GA26109@bombadil.infradead.org> References: <20180821161611.10424-1-brian.starkey@arm.com> <20180821162639.GA21697@bombadil.infradead.org> <20180821164416.GA11553@e107564-lin.cambridge.arm.com> <20180822145924.GA13763@intel.com> <20180822155732.GA39066@e107564-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180822155732.GA39066@e107564-lin.cambridge.arm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 22, 2018 at 04:57:33PM +0100, Brian Starkey wrote: > On Wed, Aug 22, 2018 at 05:11:55PM +0200, Daniel Vetter wrote: > > On Wed, Aug 22, 2018 at 4:59 PM, Eric Engestrom > > wrote: > > > On Tuesday, 2018-08-21 17:44:17 +0100, Brian Starkey wrote: > > > > On Tue, Aug 21, 2018 at 09:26:39AM -0700, Matthew Wilcox wrote: > > > > > Can you turn them into enums? This seems to work ok: > > I'm not sure that swapping out explicit 32-bit unsigned integers for > enums (unspecified width, signed integers) is necessarily a good idea, > it seems like Bad Things could happen. > > The C spec says: > > "the value of an enumeration constant shall be an integer constant > expression that has a value representable as an int" > > Which likely gives us 4 bytes to play with on all machines > that run Linux, but if drm_fourcc.h is ever going to be some kind of > standard reference, making it non-portable seems like a fail. > > And even if you do have 4 bytes in an enum, signed integers act > differently from unsigned ones, and compilers do love to invoke the UB > clause... I think you're exaggerating how much latitude C compilers have here. Further down in 6.7.2.2, it says: Each enumerated type shall be compatible with char, a signed integer type, or an unsigned integer type. The choice of type is implementation-defined, but shall be capable of representing the values of all the members of the enumeration. So if we include an integer which isn't representable in a plain int, then the compiler _must_ choose a larger type. It could choose a signed-64-bit type rather than an unsigned-32-bit type, but I can't imagine any compiler being quite so insane.