Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp424709lqr; Wed, 5 Jun 2024 09:48:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXsJL7A+qx1tw8uXbh74+fOAx6hQ6S+HMVti5trqg9upu3aSonpnb0Uhp2KFmTKk5tnoJBjGiNVsCjTcDQl9JZQiTqW3KO+vJFhwo9YpQ== X-Google-Smtp-Source: AGHT+IHe4GMo9FNK4sQ5MSbjiqFJG41EQZFqduF+s+e6R4bY9xAYSLvUiAb/2iVu2qnurIEDjdEC X-Received: by 2002:ac8:584e:0:b0:43a:f80f:425b with SMTP id d75a77b69052e-4402b5aa879mr32560181cf.10.1717606102846; Wed, 05 Jun 2024 09:48:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717606102; cv=pass; d=google.com; s=arc-20160816; b=0eBmciVJpHYl+NXWeVrc4AhhcJvW2bCSjcvZuKccrVpBel9z10TVQTMIZGEg1M0W5T a+RS3DDW51jO2LJE/KNdHp8tYqPuLzh9i4NIEAkzg2ccwVLZoS4XvevzA+9ZMDYBuOPi Z3joo0SU4sywVV+16Nj+LMsBY3REYdCMDpHtjN2TWaPorRcFDQXiwvCaesoDfw4xDt+H 8F2JgT/N+Wd3Np8/UNl5K9jNptL9gEpyZzW1TPam6DqBAg7ISbIowvJRbqjinPtEvefI +ZUODzrRRlKC6n15jzqaZM62yMFsdKE5cQKKrOpR0MtHpbOmOgXvGSFYlIrf1nG2S0+R zztw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Sy8IyTf9mqvpYa5qUP0eJiWGfhaQAqvgS6Uul5RkQbw=; fh=Y3Ai051nKTwCoOoXOqQS6OHG4B00BrcH+Tku7vr3gwc=; b=OmdO7PinciZFSwS+3ELkyym3kSPRCKuTL70HHhWuC2opoMKnlsMA2Jb2IY1TBWYWvO 3nC8dzkqasfej3qgjrgLLN41rev0T56YOOCQ66JXt7m0FDPvhPKizdCD6UmAbe4joxQM ZCBJuu3qoduhoLvKStLn5S92sBvxb4SqJjG3dctkRrF7iuucLE16CMlKa0FR5ZtkQLdO x6tT1yeQZZ4Wwx51I4vdFYQlloisrwm5KaPB5VFE1xRmQcbrfC0j4mgNoz2PR281M7TY v6DTYNhc1speNqvskDZA4kqOcCkOLVJOzWlh7uKr+gqVH28wexi7+fLV1vYiIqMJvG9E 4wiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=12NS9nwY; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-202928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202928-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43ff23ac2fdsi145133451cf.12.2024.06.05.09.48.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 09:48:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=12NS9nwY; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-202928-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202928-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8F60D1C22E2D for ; Wed, 5 Jun 2024 16:48:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08CFF188CD6; Wed, 5 Jun 2024 16:48:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="12NS9nwY" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A679F3211; Wed, 5 Jun 2024 16:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717606095; cv=none; b=cjT896z7gSUPfzUjCNeO2srRbRsNAX68wJjAtuRC0seVef3ds6+lSNl0prZLo9qIofr8dlF4eY8DC53pma1VSh/sPxlEdNeP4kJaYBFXO5eihr82/eqcqiZEKqa+b8MLPA+rn+HZMD3WJwbiAze8TC2OpguPcSjcIfRooS0cyY4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717606095; c=relaxed/simple; bh=wHtGfezfsNTTRs+YiPxLytTLRj3+4i1IKUQga7xWP+8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Dx/o01UaypsQ+U+/E6z8UObaq2OEl/e41X1VgZUkrK0ni6MjnfGg/0zyeCbQl3pmgv71bqwGI/JZ9x9XebHddJ+NJtGOzw3jGvj70dAT67KWcr7YDhnJX0F44PAeL+gulgUY6vRaOXpc78V4IZAns5RYes1aThj9CcUXdXWvIeU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=12NS9nwY; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=Sy8IyTf9mqvpYa5qUP0eJiWGfhaQAqvgS6Uul5RkQbw=; b=12 NS9nwYp9aHzjlrNI33SUIFY2Inj0vvOE/J9QploqMIpPOZjjfzeySLtZryZGwYGbtDV/x633u7K/x hBwivNh3bSUIcPXBUPM43vgIFfrK475NuCwugJaFd/NmpRiNETQYE0ynbUsYuFb/U3y0miBHdId+G JpQWriJeUL+YjsI=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1sEto2-00Gvnd-A4; Wed, 05 Jun 2024 18:48:10 +0200 Date: Wed, 5 Jun 2024 18:48:10 +0200 From: Andrew Lunn To: =?iso-8859-1?B?Q3Pza+Fz?= Bence Cc: Vladimir Oltean , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, trivial@kernel.org, Heiner Kallweit , Russell King Subject: Re: [RFC PATCH 2/2] net: include: mii: Refactor: Use BIT() for ADVERTISE_* bits Message-ID: <1c4d8c46-3124-4a90-bc50-788cc3883d93@lunn.ch> References: <20240605121648.69779-1-csokas.bence@prolan.hu> <20240605121648.69779-1-csokas.bence@prolan.hu> <20240605121648.69779-2-csokas.bence@prolan.hu> <20240605121648.69779-2-csokas.bence@prolan.hu> <20240605141342.262wgddrf4xjbbeu@skbuf> <52b9e3f4-8dd4-4696-9a47-0dc4eb59c013@prolan.hu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <52b9e3f4-8dd4-4696-9a47-0dc4eb59c013@prolan.hu> On Wed, Jun 05, 2024 at 04:47:27PM +0200, Cs?k?s Bence wrote: > Hi! > > On 6/5/24 16:13, Vladimir Oltean wrote: > > On Wed, Jun 05, 2024 at 02:16:49PM +0200, Cs?k?s, Bence wrote: > > > Replace hex values with BIT() and GENMASK() for readability > > > > > > Cc: trivial@kernel.org > > > > > > Signed-off-by: "Cs?k?s, Bence" > > > --- > > > > You can't use BIT() and GENMASK() in headers exported to user space. > > > > I mean you can, but the BIT() and GENMASK() macros themselves aren't > > exported to user space, and you would break any application which used > > values dependent on them. > > > > I thought the vDSO headers (which currently hold the definition for `BIT()`) > *are* exported. Though `GENMASK()`, and the headers which would normally > include vdso/bits.h, might not be... But then again, is uapi/linux/mii.h > itself even exported? uapi .... I would expect everything below that is considered exported. Take a look at the sources for mii-tool.c: if (bmcr & BMCR_ANENABLE) { if (bmsr & BMSR_ANEGCOMPLETE) { if (advert & lkpar) { strcat(buf, (lkpar & LPA_LPACK) ? "negotiated" : "no autonegotiation,"); strcat(buf, media_list(advert & lkpar, bmcr2 & lpa2>>2, 1)); strcat(buf, ", "); } else { strcat(buf, "autonegotiation failed, "); } } else if (bmcr & BMCR_ANRESTART) { strcat(buf, "autonegotiation restarted, "); } } else { sprintf(buf+strlen(buf), "%s Mbit, %s duplex, ", ((bmcr2 & (ADVERTISE_1000HALF | ADVERTISE_1000FULL)) & lpa2 >> 2) ? "1000" : (bmcr & BMCR_SPEED100) ? "100" : "10", (bmcr & BMCR_FULLDPLX) ? "full" : "half"); } strcat(buf, (bmsr & BMSR_LSTATUS) ? "link ok" : "no link"); So they are actually used as well. Try compiling this with your changes made. Andrew