Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2051714lqz; Tue, 2 Apr 2024 06:07:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWUTlCJ6/LjZJdndUlVtYxgnoh5yo7NFjC6JmOms1FSpgl+6sRdgLAFkwiQnkC7dAPlKZM6gavvxiicVM1nV4sLEEzVcbxtzLR1Iy307Q== X-Google-Smtp-Source: AGHT+IHX48ZgHzSmFdlLNv5pTbeCKE41SuAB/CFcTiDjkZ2WA4VVYHWe2eBvOd9A3QNZWbZMZrsP X-Received: by 2002:a05:622a:4d3:b0:434:39f3:8cb5 with SMTP id q19-20020a05622a04d300b0043439f38cb5mr1269464qtx.24.1712063224603; Tue, 02 Apr 2024 06:07:04 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e18-20020ac85992000000b004315f70a831si11770082qte.333.2024.04.02.06.07.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 06:07:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=ah3OVEvh; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-127995-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127995-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 CBCB91C2247C for ; Tue, 2 Apr 2024 13:07:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF35983A1D; Tue, 2 Apr 2024 13:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ah3OVEvh" Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 373BA7D07A; Tue, 2 Apr 2024 13:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712063206; cv=none; b=JwKcETz8a4ZNU59f6XR03VlgN8QF8osMcxkn4LlbHL9oal/lVJTivRMcaKrTl+PBOB9B8HgJbtOJkeyN9ZgcgfBJFnuqBzWN9vBtujQDScu8ehKZe2ipY8W/SvYMbDI1wvQuiHGRNJYL+LomTzBjc3hov1b64ZTPSiV3LItMsKo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712063206; c=relaxed/simple; bh=iB2gSDbR2dkyx4edtpLxbP9l7fU0ngFgBmwg4Y7zQVk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=aU8tGqBUWAiOQDL65fq955bzmIrn8CS4t2Ce6s6hHS/HoUyUa7CA+sNTrNu3MC25NZBfd2S4PH4rGARdCjMx9L4VLstJvG1L1k7EcWtxYBOYfPujiSjs6105nBOZqKeA2Ra9HiILfPaXAgfev6ufZqbbFCf/dMOnst+6lX4lFB8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ah3OVEvh; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a4a387ff7acso616868266b.2; Tue, 02 Apr 2024 06:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712063203; x=1712668003; 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=f65VZK2taIgLTzjNB/2fmY7WG5Qnc3EYR1bvxekrFWY=; b=ah3OVEvhNQxVFJ0es031qCw//Xh8+YF/V7+tlVK6k9Dpda+5j7tKMzQl8zUIBrOMpY aYzMTTrPKqLzkRrSg27XKyC8WXugXbS22igHW6GjfsfOCqbp73VQ+ctqEqbdFW1puMAO Cnfy9brY1WyMzeVkZQPDEKBkZ4K5x35Ju+36k2u7thzkgeDuf4t8O+qMR890YArpYKIW x60BnfHbGtuP0k8FYFGi4zRc03xaZ6fPOiN0paAWPUrDfBzRpdifHq5yKHuWvMz59UHL zRypvKjvPAV5vOSIkMBCZTIH8uO0vRLTKM4kAFYzsw0pMxBLOspzy2KPyFynGa7bAn37 NBLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712063203; x=1712668003; 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=f65VZK2taIgLTzjNB/2fmY7WG5Qnc3EYR1bvxekrFWY=; b=CRG3LbQDkcw5oQpsDrbt3BIFvgWTKb7sGjzu/z/VQUBtWBrp9lXubwnTvRBt14yE+4 BoC3kLfgFPFXjfS9asCY0IRPNF6brJHby5Pi8TXKF4Bfd9c+jHQPIKdHeOyqo4a8Gf2E xWrP0TgMkeTokzm08hFRIGkMuF1B5hw2nWBUUT6d53AOnuKtq4hEhl5zSrqHf0bluhdU ed+kDkkVGtQuSWU7oO0yA5knTrJNRB5RJXNU0JoE1sG3vqIDQyJvw0VRQR+QKi+eKTBF DkWH+fkql4wIWy8adBqU5qJy7SpizkStOXjCtmAbHlXj0adx99LYDG+tUJQQNoNrA6A/ 2Elg== X-Forwarded-Encrypted: i=1; AJvYcCXvT/OTE83N6VlSnbhYVX5m4oIMuSSUKfI3kQEkXFoZ5fx9llGcgp63Ut01X166bUIP/kewPdIWT2jXMAhnptDHTGPJTSZHV/9jz8gNIVdn8HDOj3+uiEMCENx6J63N4axDm9+10/G558+OLCXcwNrJrn7lNjyjHv/yMfVhkH9X7OsQi4c= X-Gm-Message-State: AOJu0YxkaMfqCRaqgNaYTGGvrW5U6G9w75qhEk4CezSohcP9E1IIeKNW 0dTh5vaXlWllbKViIfsVPKbKzEwIJKrgbVJkjNVG5s+pNg1c0aNz1rDI4FKulGYOSoj6nhtGpH0 Ufxv+vXHmVGR6PeC3GOLNuZDyI/U= X-Received: by 2002:a17:907:7da0:b0:a4e:6957:de24 with SMTP id oz32-20020a1709077da000b00a4e6957de24mr4995499ejc.37.1712063203115; Tue, 02 Apr 2024 06:06:43 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240323-pinctrl-scmi-v6-0-a895243257c0@nxp.com> <20240323-pinctrl-scmi-v6-3-a895243257c0@nxp.com> In-Reply-To: From: Andy Shevchenko Date: Tue, 2 Apr 2024 16:06:06 +0300 Message-ID: Subject: Re: [PATCH v6 3/4] firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support To: Cristian Marussi Cc: Peng Fan , "Peng Fan (OSS)" , Sudeep Holla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Linus Walleij , Dan Carpenter , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-gpio@vger.kernel.org" , Oleksii Moisieiev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 2, 2024 at 10:48=E2=80=AFAM Cristian Marussi wrote: > On Sun, Mar 31, 2024 at 01:44:28PM +0000, Peng Fan wrote: > > > Sat, Mar 23, 2024 at 08:15:16PM +0800, Peng Fan (OSS) kirjoitti: .. > > > > +#include > > > > +#include > > > > +#include > > > > > > This is semi-random list of headers. Please, follow IWYU principle (i= nclude > > > what you use). There are a lot of inclusions I see missing (just in t= he context of > > > this page I see bits.h, types.h, and asm/byteorder.h). > > > > Is there any documentation about this requirement? > > Some headers are already included by others. The documentation here is called "a common sense". The C language is built like this and we expect that nobody will invest into the dependency hell that we have already, that's why IWYU principle, please follow it. > Andy made (mostly) the same remarks on this same patch ~1-year ago on > this same patch while it was posted by Oleksii. > > And I told that time that most of the remarks around devm_ usage were > wrong due to how the SCMI core handles protocol initialization (using a > devres group transparently). > > This is what I answered that time. > > https://lore.kernel.org/linux-arm-kernel/ZJ78hBcjAhiU+ZBO@e120937-lin/#t > > I wont repeat myself, but, in a nutshell the memory allocation like it > is now is fine: a bit happens via devm_ at protocol initialization, the > other is doe via explicit kmalloc at runtime and freed via kfree at > remove time (if needed...i.e. checking the present flag of some structs) This sounds like a mess. devm_ is expected to be used only for the ->probe() stage, otherwise you may consider cleanup.h (__free() macro) to have automatic free at the paths where memory is not needed. And the function naming doesn't suggest that you have a probe-remove pair. Moreover, if the init-deinit part is called in the probe-remove, the devm_ must not be mixed with non-devm ones, as it breaks the order and leads to subtle mistakes. > I'll made further remarks on v7 that you just posted. --=20 With Best Regards, Andy Shevchenko