From patchwork Tue Feb 11 17:28:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 13970383 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 34C6A2638B7 for ; Tue, 11 Feb 2025 17:28:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739294918; cv=none; b=QA7bttYlRKF+LlIHLLhGXOPXxbMSxOMq/g9Rr4SEQ86owogFRYazd2ffHUkhe2nU+0LAEdE8P8rFxWpau0fMAScbmuu+iTVnUUI4wxUfieTFWv17f9o/gtvXeg6MJj+7erLEVKoqlTvsspxV9C4OMsEf1QMiKBq1pU3Y7Ftbwq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739294918; c=relaxed/simple; bh=qoSrX8iU6ZsOmDdt2vcxpMmdn8e+H5V+wLsqMb+WXTw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SLTEMaWHp3QHe5N72n1tdxe8UCY2KUlGJd5G/KnYS4G/YYo4jXHqw3E49nufnRXbCvakhI9Ex9VHA2oPZYiFtHC+9L4AqqIpfkbOLw/4KuXJJNwihFO4aj6l59+4TIhtgs5q1AX9gbpZGIMd3FXUpdmOXTaHjPVBUvRqfOXTDho= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=y9oJn1wC; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="y9oJn1wC" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-38dd935a267so2392368f8f.1 for ; Tue, 11 Feb 2025 09:28:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1739294914; x=1739899714; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gDYe4zVCJHl1J7zmO8YwQPUsImFhukXxkzdj3E5Ja/8=; b=y9oJn1wCsG4K6N8aS8zVpx2euAnURw53bpvU5J72B6SdnV3rTo3/zaGE/PLWRU0gCR EK+V/5R1Vej4pCLJiiz1nKaRW2luafXyqkkqJOO4ZSW2CdFRVzEgrw0LurULR74TqnZ7 vIOuc/p8vpe0vInVnjFmBXsp88p6C1J5Cl9VI5J/ubq/xVmz4truem+BRshVBAl57OjX NUV19o9sE5ftLd4KDCtv8i71KEE2uNnnLlz3CfLM3qLJOdGuTZmNu+nfVmpavMEVUKPg qTopGu6ZfPRzwi3eLJ0cAO/87gFLYfpfCJY6JI6BaHM3a7jX6VbQL8rwGAU4Swngdlig IR7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739294914; x=1739899714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gDYe4zVCJHl1J7zmO8YwQPUsImFhukXxkzdj3E5Ja/8=; b=Pwpu0bzRF6wqhbxu8R7Hf/kZ8jWzHQbj7TonzIORedyswESYG3vji/+mihAcAYuhUV /CfG/J6zgWqJ2EqPazxdiaHQxrMO8cmCjC4gEKAgh2wH7j8Ekx0YqMU1V9JWh7bQQKEC d0vOlg8y5z96vNsEZYMRHO1O19lLeNE/B2z3KD2Yas3219aQ8priNvwf6YA65K9zeagn ITtEux6v2HemgQaOJg4o8a7RNHzHgtUUbE5osXomz4/y84XSYX9yf3vztF+1m43sT/2n h4Vj61OSYQlgygQCGN8ncqeuSEEftkw04jrWaA+r/B9mPxj15O6hRMKz2Eq8OXbKonx2 Wc6w== X-Forwarded-Encrypted: i=1; AJvYcCXtEuQtxh9zJK7adTarQ6GERatXx+ihi7y4EdvCsWLOAHGOWkp3mUBy0xnrej/spjZBSNg=@lists.linux.dev X-Gm-Message-State: AOJu0YxniDNEyYMlb/p3O+bATQSPdvDj3HoR9q5vXAmR5wWjME7EOd/Q EeXkqJDyzyH0pQHx6XXDmjRzbdH02tt+RYYKR50hZpmEv4wFzpsqAK4mSO2ldRQ= X-Gm-Gg: ASbGncuzFhul6y3uCLnxDYghfyTAtO4wTKDA0xl1xaZWY7gtOuJFDa6Ee9nfWtRUnDc jm/uz+Ojf46X6VboHUo6lrkv24F7Kvwh8zeHtKl4n1OUDj15Wo1QaG/zxmYODryeBCAPQk6DxWz bG9/xgOVpN7ma0d3IE5s44fGw+YLSjAWJ0gpI61B9tBdYDQADs5JKXrcSOycKNM7wTeYrCSk/i9 ODVn55Xg//ZW/Kdf25cknBGzMTwbJZfJVPIKWEOSWPZp1EJiMOunzG4VPriFHAlRjTjXcN95G8H kGZdKwaf604LzdEcDw== X-Google-Smtp-Source: AGHT+IHFkzaOXapiWN4/SxKHetf09scMUxofFapehDhsYxM6Mf+yjBALSpgOHKp7OlGFg6yNQWYZRQ== X-Received: by 2002:a5d:5f8b:0:b0:38d:cf33:31a1 with SMTP id ffacd0b85a97d-38de92887dbmr644098f8f.23.1739294914574; Tue, 11 Feb 2025 09:28:34 -0800 (PST) Received: from toaster.lan ([2a01:e0a:3c5:5fb1:fc0c:6c04:7ae0:c5c2]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-38dc6c80df2sm13691082f8f.18.2025.02.11.09.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2025 09:28:34 -0800 (PST) From: Jerome Brunet To: Greg Kroah-Hartman , Dave Ertman , Ira Weiny , "Rafael J. Wysocki" , Stephen Boyd , Arnd Bergmann , Danilo Krummrich , Conor Dooley , Daire McNamara , Philipp Zabel , Douglas Anderson , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Bryan O'Donoghue , Vladimir Kondratiev , Gregory CLEMENT , =?utf-8?q?Th=C3=A9o_Lebrun?= , Michael Turquette , Abel Vesa , Peng Fan , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Kevin Hilman , Martin Blumenstingl Cc: Jerome Brunet , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, dri-devel@lists.freedesktop.org, platform-driver-x86@vger.kernel.org, linux-mips@vger.kernel.org, linux-clk@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org Subject: [PATCH v3 4/7] platform: arm64: lenovo-yoga-c630: use the auxiliary device creation helper Date: Tue, 11 Feb 2025 18:28:01 +0100 Message-ID: <20250211-aux-device-create-helper-v3-4-7edb50524909@baylibre.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250211-aux-device-create-helper-v3-0-7edb50524909@baylibre.com> References: <20250211-aux-device-create-helper-v3-0-7edb50524909@baylibre.com> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2003; i=jbrunet@baylibre.com; h=from:subject:message-id; bh=qoSrX8iU6ZsOmDdt2vcxpMmdn8e+H5V+wLsqMb+WXTw=; b=owEBbQKS/ZANAwAKAeb8Dxw38tqFAcsmYgBnq4g4/dIaY7N0MjawcCtYO6owHszhAtyjcgr7D 3Gd3AdMv6qJAjMEAAEKAB0WIQT04VmuGPP1bV8btxvm/A8cN/LahQUCZ6uIOAAKCRDm/A8cN/La hR9uEACtV/xHFmThUeYWuRuZeLIZDjRSGPPZEm0NF1IUEyqMa+/w0GkdSU2I/GhBRDekpL969e+ flE7DvZyypim/I0FZ9+E91BhWYhmSRaSfH/9/AKcVVKiogJILw22nAQLwHQAU4pI9XrwljjuAbt MSgI6Qhm5jlq1GlYCQ/hou9AbHVR9B2Oe4/YFrBkUNxEblpZLIcnrsPVO2FY5baXHpZvJ2k5CAZ MSpgdClj9yIkdl580XYiAPYYvwvjElVhwesa1zzt/XSJ1Idm/YRnZRAjDFe/uief6LxhKmzn8Cq PTKk6exeDtcsIhy2ONXg2237HCo0rho1EMRdeb/E1B5sDTqLMLKfHFYyvFYva/imfWDg260QPE8 SB0ucc4PEGbCTcI28Hh+JdOrNP9ChRaJgfsOqR+3qLLQgWYBJ5ScIXYmp0UW91AvMrtqrwf9ySl UBWBVpazEhLxSaE9ItQoc2xzaUOqL71se/uZnoCaqvztP8gDdl+8GXSP2/fps5dhBhhCYQi0gi2 n4q1VatCARnM9Gq2nM8qG9+sE/r+6AOa9faLGrXdf3ZP5y7Z1f9I1TqXigFb/dco4k7vTWAFo3Z /tSZVYtq1SnEy4BRJqk9nLxSPeko3sbBy6g+ly8JaELAzWpBynghDBX7iUt8qUwY3k22TI1x6Zi chvp+TE0JiJbh2Q== X-Developer-Key: i=jbrunet@baylibre.com; a=openpgp; fpr=F29F26CF27BAE1A9719AE6BDC3C92AAF3E60AED9 The auxiliary device creation of this driver is simple enough to use the available auxiliary device creation helper. Use it and remove some boilerplate code. Signed-off-by: Jerome Brunet --- drivers/platform/arm64/lenovo-yoga-c630.c | 42 +++---------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/drivers/platform/arm64/lenovo-yoga-c630.c b/drivers/platform/arm64/lenovo-yoga-c630.c index 1f05c9a6a89d5ee146144062f5d2e36795c56639..921a93d4ea39ac54344cc964e2805e974cc7e808 100644 --- a/drivers/platform/arm64/lenovo-yoga-c630.c +++ b/drivers/platform/arm64/lenovo-yoga-c630.c @@ -191,50 +191,16 @@ void yoga_c630_ec_unregister_notify(struct yoga_c630_ec *ec, struct notifier_blo } EXPORT_SYMBOL_GPL(yoga_c630_ec_unregister_notify); -static void yoga_c630_aux_release(struct device *dev) -{ - struct auxiliary_device *adev = to_auxiliary_dev(dev); - - kfree(adev); -} - -static void yoga_c630_aux_remove(void *data) -{ - struct auxiliary_device *adev = data; - - auxiliary_device_delete(adev); - auxiliary_device_uninit(adev); -} - static int yoga_c630_aux_init(struct device *parent, const char *name, struct yoga_c630_ec *ec) { struct auxiliary_device *adev; - int ret; - - adev = kzalloc(sizeof(*adev), GFP_KERNEL); - if (!adev) - return -ENOMEM; - - adev->name = name; - adev->id = 0; - adev->dev.parent = parent; - adev->dev.release = yoga_c630_aux_release; - adev->dev.platform_data = ec; - ret = auxiliary_device_init(adev); - if (ret) { - kfree(adev); - return ret; - } - - ret = auxiliary_device_add(adev); - if (ret) { - auxiliary_device_uninit(adev); - return ret; - } + adev = devm_auxiliary_device_create(parent, name, ec, 0); + if (IS_ERR(adev)) + return PTR_ERR(adev); - return devm_add_action_or_reset(parent, yoga_c630_aux_remove, adev); + return 0; } static int yoga_c630_ec_probe(struct i2c_client *client)