From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (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 8BBC943900F for ; Tue, 28 Apr 2026 12:46:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777380411; cv=none; b=ksPZRIyWr/kanMU23q3zGqth+2eT1AN7eCPYJkz63KgvCBX8qHguJYjjZVMW5R8gml9GFqEzHkuhv5BY7oRwZ9cq5c30ERcWBNWsSja6/vaI3PhGlwCBF91y4PfoTcKXOWDjfIVokIbkTNYiuQLi8NMH2vW0fH/rTYP3Wrm7HWc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777380411; c=relaxed/simple; bh=qXWvLFrVuKWOBW2pcZQhwtDbG9cDzAI52pDnhk2glsE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=K83/BVpIJC6u9KS1FkFbWFFrtZ3VnMwtO2IY/0sap2sIfjMI/+iaXe7qryF/7H0KFt52Mp+kfFoTx2dIVR/NAT9mTHg8rtMmi7yrUG2Y39YAM1+/IWclHNh6czquLO6TvegenLKYnfAQ/2WFwfXYruW/Pc2BHTQ1JXwGdNpa/iw= 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=oFcACVPF; arc=none smtp.client-ip=209.85.167.178 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oFcACVPF" Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-47c35be030dso120687b6e.0 for ; Tue, 28 Apr 2026 05:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1777380407; x=1777985207; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ToBwHoXJwZlCxVtdIewDU7S2LH8f7E9EYRhrN9/3Z4c=; b=oFcACVPFgIO9hnRAym+C4DBl3TyL1Xt5HJjKpxm9ephqfCq6qRjdPnrHgw++1cm2ZP NwfvRlsOr+yS1+gxZysH/t0MoESGelfqo8z8iGBliI1RiHG9CWTFpeJSqP+0vDlMzY/g XYImc4jiESuZkChCwDm9putF8PHUAqC3C2T8WCwmSHIYvOBlodIECPm2x8X94VXZihKs eRBmvh9qDAUFUE5UsIK3IsdOgst8tPpoE9U3Vs+7QCqGqa4Tq6uWe22XPf2HwmLrYxKw GnQP5sIxxWiv/IhYxz2Kh9SaO676tPMfey4jiC3HKQbz0rmg9HQHicT34uuMQJGsIt0r Tf/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777380407; x=1777985207; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ToBwHoXJwZlCxVtdIewDU7S2LH8f7E9EYRhrN9/3Z4c=; b=hmk6KHvpghrDDn16nfA589Crv5CyplIqwTIMQEM21n1tNmmg+CMyDnD8YPm4Q9ZdaE sQLiI/o1ZqTSOHcoe8dvgLEFVSil7/adyt9gybFfoBYbJtE5ccscAjliBX7TW0DUUB3y kCFqQuVg6tc6gbgyMOamylizfY4mB0n5eh12R5TwtuYkhNtD6KJqe2xT7pqvXJOszgCp XRT/Wk59kU3kTvOBEwTOA92ULrk/THIBtSR8YmrkqwTqApEB8ObgqHHuOwPju/g8Hml4 KobrNFI0/IDp1GFhdmUoUMuuHDpEYnY3UQwAhAe/hj4qnVNuq57dcbwjKYv7E7LZsNbO TXnw== X-Forwarded-Encrypted: i=1; AFNElJ8N1A7cLjxQbRbbWWDlYxSnbBEbhUS7RZKlbO2CBP5q3lH8IzjbCVrZQZypQwz9VAqUHAowRoW9KZGwlVk=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7LSNy2kCUNtioxHtprGMeB2j/CjpM5nyk+Rbqqg0yZd8oSKFt Nv5ccpKcETL4KiY8XX/u5oeIcPxsM5ZefptqunkbUCetczvTeL9Dy8sP X-Gm-Gg: AeBDietkH3EYJ+CxL7BEZ3PqVeTquXIa96Y7Fn5bQF6vQc9aEilGwT5w5gViaO5HHzE XtpIf5PVKfV0OwqDjkB3ywODsbxKqizHm9q7/Y080QUcSJUUJO8hMblcvqV1WT8XSq4zFQq++oa of2NNl6Vv1uW4AIRfSQWpssnUgWUio5DR74M1BQUErhM6CbQma32TqddbmOtcrThpbXrCkPScdM mWsay6wqrBulmPApNv9UcC58RC0lig93Ef4ppRvzFxqsq731xZlkbA3RwOysPv0L87SzmEwl5vs cAqLb0fFwPafCkNEPWKvixW37kTcc07g6eqNvUmbKzhPHLi5T7f6ZXfJyzQwgTHXx6cPyc8OKqb T49FXbweWv6oaLTpDifBEDij+58/Z0+3ron7SzTEtSnwauzRSNuXUg0NZeEcRCn9jBV9jMB4BiQ 8h67CyhAF9ByULg617366/Sj77+3DmJI1in6Gebjrth9PSxMxsVufA03xHzsrij2RGyDeerT4gZ oJ5DVY= X-Received: by 2002:a05:6808:4fe0:b0:475:be6f:aa with SMTP id 5614622812f47-47c28e8701emr1487727b6e.19.1777380406655; Tue, 28 Apr 2026 05:46:46 -0700 (PDT) Received: from linuxescape.lan (23-88-128-2.fttp.usinternet.com. [23.88.128.2]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7de986a5601sm1683041a34.19.2026.04.28.05.46.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2026 05:46:46 -0700 (PDT) From: Maxwell Doose To: songqiang1304521@gmail.com, jic23@kernel.org Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/4] iio: magnetometer: rm3100: Modernize locking and control flow Date: Tue, 28 Apr 2026 07:46:40 -0500 Message-ID: <20260428124644.49707-1-m32285159@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The goal of this patch series is to replace the manual mutex_lock() and mutex_unlock() calls in rm3100-core.c with their more modern counterparts, guard(mutex)() and scoped_guard(). I've also done some minor cleanups, removing what are now redundant gotos, and enabling direct returns. Following feedback on recent commits, I've learned that it's a better idea to split changes to be more atomic, and I've done that here in case any particular change *somehow* causes a build regression. The changes have been test-compiled however, and according to make, smatch, and sparse, should be sound. === Changelog === v2: - Added small style fixes per Andy's suggestions (Adding blank lines, moving an if statement in a scoped_guard block). - Switched out scoped_guard() for guard(mutex)() in certain commits. - Fixed error in commit 4 where deadlocks could occur, as goto ignores __attribute__((cleanup)). This has been fixed by the above. Maxwell Doose (4): iio: magnetometer: rm3100: Use guard(mutex)() in rm3100_read_mag() iio: magnetometer: rm3100: Use scoped_guard() in rm3100_get_samp_freq() iio: magnetometer: rm3100: Use guard(mutex)() in rm3100_set_samp_freq() iio: magnetometer: rm3100: Use guard(mutex)() in rm3100_trigger_handler() drivers/iio/magnetometer/rm3100-core.c | 63 ++++++++++---------------- 1 file changed, 24 insertions(+), 39 deletions(-) -- 2.53.0