Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp135644lqp; Fri, 12 Apr 2024 12:44:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXhg4VgzsrRTyMZQRYFhNAyF0yoVUVzLJKiIf9uqbQt2y9ZGu0Wa1QLHWNFZdfTwiMTjaiGL7FT/29aie3sIDJ6e9nSqCHZznzH7/HfmQ== X-Google-Smtp-Source: AGHT+IGqNvHOimUmJXHP2Ol6xuhv3nC/l/o4nuRgzkrUKwNAHup8A/1vw8W9XvFRI8YjPDp6R8XP X-Received: by 2002:a05:620a:4606:b0:78e:c817:8f7c with SMTP id br6-20020a05620a460600b0078ec8178f7cmr6986204qkb.35.1712951049814; Fri, 12 Apr 2024 12:44:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712951049; cv=pass; d=google.com; s=arc-20160816; b=KHrwKoI55BfbXoi6NKM86l9c70ONH3h4xLQObcctwAhaswMKlQivkD9UImFfIFUSYO b1Ykz1dTkEU0oIjekYNr/WRX1jZdPpdP1U6aFhv4+adSQ8G7W5vAfnuB7dax7HolE3La apeTDbXbcoNqYaiJK1s/lZck0PKaY6gugB69zLpzg5SiYc+kXS3rmxaHIfUj1ASNHHoB BsR81xPfcMbAK55JOqFFwNihhiWQGOykPp4I5PyGL3RK9vafWrWznh8THqiDpCYWWVj4 VPN6YfClw7Lm1Z5BRUYxUnAPhJcf+JZLNJVnaORd+tp7HFQKFJBH59pK6B3JE6kC0FJk qU2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=IoHqwPR/3f4QWQcrX8xBsgDz0K3wdj+JCIyUfWJkskQ=; fh=7IDoRNsk5ss7N5YW0A8N+9ep+CvnH7pklhum/0HPyLg=; b=QtEE8OlQD/UPeUj6iKDZORC2qYwe0AaX12vYAuMSzwwNAhBldI/c1jmd9DL+YoY5FY 2EF3thNOvqTPsFlqh3CfDddomzTK4orHqBZ2min7B26V+dllnzQmr4FxI+depUKKmnny OuZv5fKRVj5EwhFv3//lpfrVGebO9GRVMHyKNfR30hVfY8HZmY+P4s11y8JNIY9HQgrV SAebS1UghWWCnUPXEC0XbhGaSL7DUzMruSCQtqbgWG8TFZx1d5vEPc5F0OuDc9q4MiBj hl8O91EpH5qAzZt+lBxdzCRKw/c/AVsiB0XIt5DLCaYJyAwPU/jeV1oHh16LxsF58CU9 zHwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=o1XEbJT4; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-wireless+bounces-6270-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6270-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j10-20020a37ef0a000000b0078d63ec8e2esi3808197qkk.550.2024.04.12.12.44.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 12:44:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6270-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=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=o1XEbJT4; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-wireless+bounces-6270-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6270-linux.lists.archive=gmail.com@vger.kernel.org" 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 7CD7E1C210E5 for ; Fri, 12 Apr 2024 19:44:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6536150984; Fri, 12 Apr 2024 19:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="o1XEbJT4" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F07214F9EE for ; Fri, 12 Apr 2024 19:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712951044; cv=none; b=RV8OK45vTd7ZpdpvfywKQ7bn3lbgK3MDeqI/K6h8p8cONT78SBrK+qk9ALAYNkQeMXJ0MXtxuYR30ZbdvcC+hVouuRs90Yf9Y499EjSKYIyZ4xlcQk+HnvHbdsPmVgQ8c739CAeYq7H37h7Z89+Wtmm+963Gi5uMBspcCijjzrc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712951044; c=relaxed/simple; bh=IoHqwPR/3f4QWQcrX8xBsgDz0K3wdj+JCIyUfWJkskQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=sQ4peKZEwg0MeetPj7yLNY5LBUuDnJyNGCMrAVr4MPB6uG+LKquJxmkCPoA9Sbo7faPCPX1ebmW2ygN7G2iqzcq7XoxY7U134Ah9W6B2r64ZNkDq9NGDFG1fsjHy2bUCvWDQt8JEb9u9ear9pLJLozSDoVqSdD6IZ1x1t9LXFI8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=o1XEbJT4; arc=none smtp.client-ip=209.85.208.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2d895138ce6so14218481fa.0 for ; Fri, 12 Apr 2024 12:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1712951041; x=1713555841; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IoHqwPR/3f4QWQcrX8xBsgDz0K3wdj+JCIyUfWJkskQ=; b=o1XEbJT4Cmt4ccmKqmqOe0yb9OeSKxSXA697Tx2X0tLZnxWnUBkxqvwOSlgj8neIgH MM/NWit0lbN0ulumwtrtQmEDOEnt3+FxdjkD0ZKa3ZYmGDS+OPxv23ctSp+A1oAJ9DTv 1lyJROZI1WK4z4tbE7ycYX0aWYS7vkrjaK8VzwxQzHyUxphN9TtiDEFYyGCYtVf8H2SC hY4vFV6OnC7SgQo6D1LvBu+L3hOLnAbVaoq2d1D3MRgcPbiwJhXEoBuixNIUKWg5fOfJ 8wP21uNnQqxSiH49RxIOgsm3jhatq6HQn7quAL8nuua/G8Kcg7fts4PHhf29R86R/Z2+ Cymg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712951041; x=1713555841; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IoHqwPR/3f4QWQcrX8xBsgDz0K3wdj+JCIyUfWJkskQ=; b=VHwdyxUTo4ngCR/0Iqpqssk633uJvtfaEUUV5txjpxW2O2aiKsg0MgB0ApWNU6mgMN ZEBkVQeLeP+vUGNKwWhVuwFAJcev/F2N6mOjkUujhamQuV69e21Ja0LQ8zldVmv17HJI u3BqEmyx1LaUOEVx6ZarfNZ5IoeP93gy68fYKHGcoes2vCCotavuLN9ut+lSYtpPdnID 2cs8LTSaKTvLsoWqtQ5GBJPw7xVoYcUJce9A8UmDqaz9Ng1nPefEuxNVzhyZ95mBifG+ ibo+adEXtk7Fvr6JKjv9oTjxSgrGE/uLRdZjWkQxSoZl8PTLnT69HdAl3uvjwbiqwgAF ahMg== X-Forwarded-Encrypted: i=1; AJvYcCVuk87VTwfx/xEBxXSMkXWlqIcbGmOqsgFpSMIvLGnuMRnyklf5UHti2GGmruCilxuOSwB+928U6ZWik7xEDKjLbXDWS6DvZ0/2VX2bYhQ= X-Gm-Message-State: AOJu0YyHdOAxe2HBr7UVpURl+Zv5mrhF+mgXBNQyoRCBD1UoxJVe6ZdN cyuxoCFwmD+iqmZMRo/x7BEbz2Wzz4jriddidrUMA5q9hirM5ijeT3XMZHqgjmf2WR+nyl3SqmS VpAMNYv8Z4eWoj3kL9ziKASzvA2+ClZhxyedE6g== X-Received: by 2002:a2e:a370:0:b0:2d8:8b7:76e3 with SMTP id i16-20020a2ea370000000b002d808b776e3mr2331884ljn.11.1712951041199; Fri, 12 Apr 2024 12:44:01 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240408231727.396452-1-andriy.shevchenko@linux.intel.com> <20240408231727.396452-2-andriy.shevchenko@linux.intel.com> In-Reply-To: From: Bartosz Golaszewski Date: Fri, 12 Apr 2024 21:43:50 +0200 Message-ID: Subject: Re: [PATCH v2 1/2] gpiolib: Fix a mess with the GPIO_* flags To: Andy Shevchenko Cc: Linus Walleij , Bartosz Golaszewski , Kent Gibson , linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, Mika Westerberg , Arend van Spriel , Kalle Valo , Charles Keepax Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 12, 2024 at 5:25=E2=80=AFPM Andy Shevchenko wrote: > > On Fri, Apr 12, 2024 at 10:20:24AM +0200, Linus Walleij wrote: > > On Tue, Apr 9, 2024 at 1:17=E2=80=AFAM Andy Shevchenko > > wrote: > > > > > The GPIO_* flag definitions are *almost* duplicated in two files > > > (with unmatches OPEN_SOURCE / OPEN_DRAIN). Moreover, some code relies > > > on one set of definitions while the rest is on the other. Clean up > > > this mess by providing only one source of the definitions to all. > > > > > > Fixes: b424808115cb ("brcm80211: brcmsmac: Move LEDs to GPIO descript= ors") > > > Fixes: 5923ea6c2ce6 ("gpio: pass lookup and descriptor flags to reque= st_own") > > > Fixes: fed7026adc7c ("gpiolib: Make use of enum gpio_lookup_flags con= sistent") > > > Fixes: 4c0facddb7d8 ("gpio: core: Decouple open drain/source flag wit= h active low/high") > > > Fixes: 69d301fdd196 ("gpio: add DT bindings for existing consumer fla= gs") > > > Signed-off-by: Andy Shevchenko > > > > The way the line lookup flags ("lflags") were conceived was through > > support for non-DT systems using descriptor tables, and that is how > > enum gpio_lookup_flags came to be. > > > > When OF support was added it was bolted on on the side, in essence > > assuming that the DT/OF ABI was completely separate (and they/we > > sure like to think about it that way...) and thus needed translation fr= om > > OF flags to kernel-internal enum gpio_lookup_flags. > > > > The way *I* thought about this when writing it was certainly that the > > DT bindings was a separate thing ( didn't even exist > > at the time I think) and that translation from OF to kernel-internal > > lflags would happen in *one* place. > > > > The main reasoning still holds: the OF define is an ABI, so it can > > *never* be changed, but the enum gpio_lookup_flags is subject to > > Documentation/process/stable-api-nonsense.rst and that means > > that if we want to swap around the order of the definitions we can. > > > > But admittedly this is a bit over-belief in process and separation of > > concerns and practical matters may be something else... > > Got it. But we have a name clash and the mess added to the users. > I can redo this to separate these entities. > > Note, that there is code in the kernel that *does* use > #include > for Linux internals. > Well, then they are wrong. We should convert them to using linux/gpio/machine.h first. Or even put these defines elsewhere depending on what these drivers are using it for in general. Maybe machine.h is not the right place. Then once that's figured out, we can start renaming the constants. IIUC include/dt-bindings/ headers should only be used by DT sources and code that parses the OF properties. But it seems to me that we need to inspect these users, we cannot just automatically convert them at once, this is asking for trouble IMO. Bart