Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp314466pxf; Wed, 24 Mar 2021 05:57:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIgIhHyqvHKIFdgafrKRaeN9vnkh6Md33kZ5yEUeMMe6iohp05n0gkBeBFysvs4QUDCYr5 X-Received: by 2002:a17:906:4c56:: with SMTP id d22mr3680170ejw.426.1616590669276; Wed, 24 Mar 2021 05:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616590669; cv=none; d=google.com; s=arc-20160816; b=RDQmh9I0bChNGANrKc+He6NRxG1Zk45Ov3sjUAwxLUWM2xQcYDPoDyjkXriWq5Aely X4MBrmW6R6PelyzqbZr4R4refgDPls7zPHD8dnesyFN6AlKyrgjQ6LFS5IDaBPUaUxoo Z/zTz9oXucniIQIwvJRF0zYL221yn8l7uWpGaQHPB1HyvvR2MbPg3diiGyatAxqXeRm8 zLYadPkCbSIf/pvyplTiHOpld0R+JMO2etNSQPWMMU/pLMefpoYk+rjavrAB0CfEOIK4 f++QsnE81sXntgCoE4gNqmarOvH6uNd8TUVqxyaVbQ6YhzGzHs3Lj+zBd0P6/F3TDf+b m94g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=S9XD7LgutIthWxyh0z5JZ2FaeGZvIL8c4hnddAnFY7Q=; b=aDGUzC8sbyby/MOL1jW6KGB5SWOIbr1jtFGu9NS6K7eQWtIHw4OadzGpb2KmDUwLSX 8A8UhboAbIJ/3f0aLhz2GzBsGK3lZqb7/AAQgfcsVXSnqQVDUFdm1ILZJiRQemkkJqy4 eLyHSDrgYOkBrxIvnSwon4PDjmmEydgzXZJVJrtxPgmgDkHlEndVxKPPXumOSFOFKyhO ZEtr4+9AQky0mQZPz9ManYUBHbrVKx9B0/rw1tYoM1fHiRs0M7TgymCsUYTPpmLdU/NF TlOkGzG8/qKpWUUMZQjYwVVOp1b5oJAP6ZMqSAtWbXz5RG0f+D3VKg0iFmxGSAaxDAVm DshQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=rHtXaN5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si1619402ejg.74.2021.03.24.05.57.26; Wed, 24 Mar 2021 05:57:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=rHtXaN5h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234795AbhCXM4j (ORCPT + 99 others); Wed, 24 Mar 2021 08:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234394AbhCXM4B (ORCPT ); Wed, 24 Mar 2021 08:56:01 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85A25C0613DE for ; Wed, 24 Mar 2021 05:56:01 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id z1so27546933edb.8 for ; Wed, 24 Mar 2021 05:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=S9XD7LgutIthWxyh0z5JZ2FaeGZvIL8c4hnddAnFY7Q=; b=rHtXaN5hln2lNri4GKEYgFoML7CrNJGGG1rbRnRtjn6+dujoAalkv/r5bc4YpXj5Cl DgpHKHWpHsaj+oxL/GVFrHP6X6jHORAjYLcW8eWFiYdzNQ2OhDp+ZeVuw7cEXVHktoPh hEy1lqSNBb3W/gD7945+zLJ9s4dgRdDAI1sp2/SgiS2XWs9ZWd9xl7ki66IBex54VU1E pQJj939l1XAxfi/Osv89Di4fDbcPf4zde4l3IXwRPEym+O/Ax3peiaL4xCOubhomRWTq s4qK/dL8GotwGws6o5p8wdtGlKoGucYAh2WJZCxcpQrHGP/SxnfzOe9WmerXLNTzgeSa 8U4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=S9XD7LgutIthWxyh0z5JZ2FaeGZvIL8c4hnddAnFY7Q=; b=U1Bncc7LlZEqdXz7Tvc6j3iIFiKsmiRGW3PANf3m+/exQTb+bOyVOnA/Q3iCxX+P5r iXV2fRLSj1uwGa8MyCRY7x59jV7gYsu/CJEJ4j7Iew7YZOvX/LUJ9jjG4rHtvwb3TQna Bl2mQ2eG+XNk0CAAWcEMWsOEr+iG5SxCMWAA/0CBVcdvJgOUgFvcJz+EBqYinvy13Rkg syCKfFY/zqrh5+uTDWteMdy/fYS/fLKG4E/uk1rMhsLIQwepbWhcptNogNEQc/8epwAk hEBRghpnhco/Acuys2NX6I6yfuiKXiYJg7k8cjGmu09PAcLvDdVwUE/IIxvdN/Gy5Q55 QLBA== X-Gm-Message-State: AOAM532Czo0dllEHLCTIysx67WEhjtIWHif+pSs5RE+DVgt09mBh6pAp 6+s7ELy5vtNag22kGrRhwGk+wg== X-Received: by 2002:a05:6402:2552:: with SMTP id l18mr3211824edb.71.1616590560162; Wed, 24 Mar 2021 05:56:00 -0700 (PDT) Received: from localhost.localdomain ([5.2.193.191]) by smtp.gmail.com with ESMTPSA id fi11sm880282ejb.73.2021.03.24.05.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 05:55:59 -0700 (PDT) From: Alexandru Ardelean To: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: coproscefalo@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, jic23@kernel.org, linux@deviqon.com, Alexandru Ardelean Subject: [PATCH 00/10] platform/x86: toshiba_acpi: move acpi add/remove to device-managed routines Date: Wed, 24 Mar 2021 14:55:38 +0200 Message-Id: <20210324125548.45983-1-aardelean@deviqon.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This changeset tries to do a conversion of the toshiba_acpi driver to use only device-managed routines. The driver registers as a singleton, so no more than one device can be registered at a time. My main intent here is to try to convert the iio_device_alloc() and iio_device_register() to their devm_ variants. Usually, when converting a registration call to device-managed variant, the init order must be preserved. And the deregistration order must be a mirror of the registration (in reverse order). This change tries to do that, by using devm_ variants where available and devm_add_action_or_reset() where this isn't possible. Some deregistration ordering is changed, because it wasn't exactly mirroring (in reverse) the init order. For the IIO subsystem, the toshiba_acpi driver is the only user of iio_device_alloc(). If this changeset is accepted (after discussion), I will propose to remove the iio_device_alloc() function. While I admit this may look like an overzealous effort to use devm_ everywhere (in IIO at least), for me it's a fun/interesting excercise. Alexandru Ardelean (10): platform/x86: toshiba_acpi: bind life-time of toshiba_acpi_dev to parent platform/x86: toshiba_acpi: use devm_add_action_or_reset() for singleton clear platform/x86: toshiba_acpi: bind registration of miscdev object to parent platform/x86: toshiba_acpi: use device-managed functions for input device platform/x86: toshiba_acpi: register backlight with device-managed variant platform/x86: toshiba_acpi: use devm_led_classdev_register() for LEDs platform/x86: toshiba_acpi: use device-managed functions for accelerometer platform/x86: toshiba_acpi: use device-managed for wwan_rfkill management platform/x86: toshiba_acpi: use device-managed for sysfs removal platform/x86: toshiba_acpi: bind proc entries creation to parent drivers/platform/x86/toshiba_acpi.c | 249 +++++++++++++++++----------- 1 file changed, 150 insertions(+), 99 deletions(-) -- 2.30.2