From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 DE8C31DE3C5; Tue, 29 Oct 2024 10:12:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730196755; cv=none; b=fCUFrm2RNSczgSb/IVbp9HiFULhalc/82qMUM2AA2QX9+fYK61MOvOpjg17qyuZF1vags1jDRBPZQtgyeTzqI+OQwr+IWjJYChST+5PKJJ6YcolTQoCEN3HIe8b7x9TJyBiGL2SzLnrrZVXyZdGw65vnUMtwWIbuHLlxOAxpylE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730196755; c=relaxed/simple; bh=UUL67haHwTZSyVGSKpJ3dDGaIGH82aeC1HUYikM7ht4=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=aSQxP994iWGqtNfsAunQAqGEdDPRol2wUghvWoxropKS43hJmcN+2ewSV6Br2dw4koJxTUNbGobx37QBA0KNJ/ceOW6FEmq8DAQrJPL9hIsmU4KVcwFaImOmyXiZRUKtHXmfmmZQ2E9veCXYj4R9eHhLp1KTokQsBWyF02l1pew= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=iLIA1vDv; arc=none smtp.client-ip=198.175.65.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="iLIA1vDv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730196755; x=1761732755; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=UUL67haHwTZSyVGSKpJ3dDGaIGH82aeC1HUYikM7ht4=; b=iLIA1vDvAx0SIHZaNv8xFHKBuQCX7n0IZQChUUviREwlvSj6Gy3wKQtK 12l0feGsYNI+ArdEfbeLNmnOuneUo2Y8+nB9utfTz6ovYw7keqJv7SdGK iSLWQPredEWXBluiRHdiSRs+zQ/7DWKNxz3zSDlzHj/CPYqgj8cPFHlEj z3r7S7YdPzLqlBwUvDYfRKz5UXMGJx3papcHzVnDW+2cSZqe/aRDW6gkF 9HDimuizJzp/OL/tqdybdyB91ldRhVFl7yzj6LZ6OZLWhoOqR7D3qQGwK TuFYD0a2FF3ZqIOABCveIT1ykVAWA1UKG/cSM3DkOgrkjJBBRpQ9btIaK g==; X-CSE-ConnectionGUID: C9esSJ37S8yu6sDr7wEWtQ== X-CSE-MsgGUID: vjzzluheQnKsv3R1av9eQQ== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="30016119" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="30016119" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 03:12:34 -0700 X-CSE-ConnectionGUID: w2Dq1ufURcu3Uixl6B014g== X-CSE-MsgGUID: nqgzNDGLQtOYDmPFkf90yQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,241,1725346800"; d="scan'208";a="81546469" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.244.83]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2024 03:12:26 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Tue, 29 Oct 2024 12:12:23 +0200 (EET) To: Mario Limonciello cc: Hans de Goede , "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , Shyam Sundar S K , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , Alexis Belmonte , =?ISO-8859-15?Q?Uwe_Kleine-K=F6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz Subject: Re: [PATCH v2 05/15] ACPI: platform_profile: Move sanity check out of the mutex In-Reply-To: <20241028020131.8031-6-mario.limonciello@amd.com> Message-ID: <911429e0-3807-255a-4ab5-d89c6d6ce0d7@linux.intel.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> <20241028020131.8031-6-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Sun, 27 Oct 2024, Mario Limonciello wrote: > The sanity check that the platform handler had choices set doesn't > need the mutex taken. Move it to earlier in the registration. > > Tested-by: Matthew Schwartz > Signed-off-by: Mario Limonciello > --- > drivers/acpi/platform_profile.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c > index 0c60fc970b6e8..c20256bb39579 100644 > --- a/drivers/acpi/platform_profile.c > +++ b/drivers/acpi/platform_profile.c > @@ -180,6 +180,12 @@ int platform_profile_register(struct platform_profile_handler *pprof) > { > int err; > > + /* Sanity check the profile handler field are set */ > + if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || > + !pprof->profile_set || !pprof->profile_get) { While moving the line, please change the misleading indentation too (you'd have probably done it based on my comment on v1 too but since this series has changed things a bit, I'm noting it also against this patch). -- i. > + return -EINVAL; > + } > + > mutex_lock(&profile_lock); > /* We can only have one active profile */ > if (cur_profile) { > @@ -187,13 +193,6 @@ int platform_profile_register(struct platform_profile_handler *pprof) > return -EEXIST; > } > > - /* Sanity check the profile handler field are set */ > - if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || > - !pprof->profile_set || !pprof->profile_get) { > - mutex_unlock(&profile_lock); > - return -EINVAL; > - } > - > err = sysfs_create_group(acpi_kobj, &platform_profile_group); > if (err) { > mutex_unlock(&profile_lock); >