From patchwork Thu Feb 1 18:00:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Davis X-Patchwork-Id: 13541525 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 86D36C48BF7 for ; Thu, 1 Feb 2024 18:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=awh4L/FvuKTUk4LCovxuQcQcm/YmAlMhgCuKLpIU3pA=; b=h33vjsiOW17n/nlN6AkQl5WDfz +F2S1Hgz4OoExtaDZ1ggb14jqXwDE9M0slzWmDYtyQOqgJVNVRABZ1O9lZmTLUo9t2yMguizLFCka TfTM6ID2Qc1k5aftdl1TkyWRuiMfWITnffEmP93PDv3JUbP4dieXq/Elv7Ck59DE/bLPOwrw2LURz wUWbovgYoMeRmv0VsQ8xMOgYFOd5BDeLH6P87bZMg/Fve3+zmsLDjUUs/cuLw7n0K4DXUswPKUJ2v lxxGJmkz2yg+7/ZohJ58XCkQi1AKWZhl11itF1cVkp/25QMLPfQfWgojG9iwcG0WMbj8M+DeJRlvb HZTJPp5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVbOi-00000008ufZ-2eJv; Thu, 01 Feb 2024 18:02:48 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVbNP-00000008tVJ-26f8; Thu, 01 Feb 2024 18:01:32 +0000 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 411I16NW127754; Thu, 1 Feb 2024 12:01:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1706810466; bh=awh4L/FvuKTUk4LCovxuQcQcm/YmAlMhgCuKLpIU3pA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=w1pNiTRgiYLJ3cK7YvY8c2Pa4edi510sVdoaT8seLl/gN9yEbfAU6Nl/gX2KqZhQO jQpE3eI6pz/LFdKE9c6sgY5455FAfFmj3+bpt38atd6cneNOvWGhnDOl3+cEWWiOyv Xws7a6m7Jn2cXLLzac0mfvROnKD1dLeI5pESMkco= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 411I16oq120370 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 1 Feb 2024 12:01:06 -0600 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 1 Feb 2024 12:01:06 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 1 Feb 2024 12:01:06 -0600 Received: from lelvsmtp6.itg.ti.com ([10.249.42.149]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 411I12Gj117221; Thu, 1 Feb 2024 12:01:06 -0600 From: Andrew Davis To: Sebastian Reichel , Manivannan Sadhasivam , Cristian Ciocaltea , Florian Fainelli , Ray Jui , Scott Branden , Bjorn Andersson , Konrad Dybcio , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , , Andrew Davis Subject: [PATCH 05/18] power: reset: tps65086-restart: Remove unneeded device data struct Date: Thu, 1 Feb 2024 12:00:49 -0600 Message-ID: <20240201180102.70395-6-afd@ti.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240201180102.70395-1-afd@ti.com> References: <20240201180102.70395-1-afd@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240201_100128_017341_9F5B0A01 X-CRM114-Status: GOOD ( 11.87 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org We only need one member of the struct tps65086_restart, pass that tps65086_restart_notify() directly. Remove that struct and its allocation. Signed-off-by: Andrew Davis --- drivers/power/reset/tps65086-restart.c | 35 ++++++-------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/drivers/power/reset/tps65086-restart.c b/drivers/power/reset/tps65086-restart.c index 82d7a761a0385..6976dbcac74fa 100644 --- a/drivers/power/reset/tps65086-restart.c +++ b/drivers/power/reset/tps65086-restart.c @@ -9,19 +9,14 @@ #include #include -struct tps65086_restart { - struct device *dev; -}; - static int tps65086_restart_notify(struct sys_off_data *data) { - struct tps65086_restart *tps65086_restart = data->cb_data; - struct tps65086 *tps65086 = dev_get_drvdata(tps65086_restart->dev->parent); + struct tps65086 *tps65086 = data->cb_data; int ret; ret = regmap_write(tps65086->regmap, TPS65086_FORCESHUTDN, 1); if (ret) { - dev_err(tps65086_restart->dev, "%s: error writing to tps65086 pmic: %d\n", + dev_err(tps65086->dev, "%s: error writing to tps65086 pmic: %d\n", __func__, ret); return NOTIFY_DONE; } @@ -36,27 +31,13 @@ static int tps65086_restart_notify(struct sys_off_data *data) static int tps65086_restart_probe(struct platform_device *pdev) { - struct tps65086_restart *tps65086_restart; - int ret; - - tps65086_restart = devm_kzalloc(&pdev->dev, sizeof(*tps65086_restart), GFP_KERNEL); - if (!tps65086_restart) - return -ENOMEM; - - tps65086_restart->dev = &pdev->dev; - - ret = devm_register_sys_off_handler(&pdev->dev, - SYS_OFF_MODE_RESTART, - SYS_OFF_PRIO_HIGH, - tps65086_restart_notify, - tps65086_restart); - if (ret) { - dev_err(&pdev->dev, "%s: cannot register restart handler: %d\n", - __func__, ret); - return -ENODEV; - } + struct tps65086 *tps65086 = dev_get_drvdata(pdev->dev.parent); - return 0; + return devm_register_sys_off_handler(&pdev->dev, + SYS_OFF_MODE_RESTART, + SYS_OFF_PRIO_HIGH, + tps65086_restart_notify, + tps65086); } static const struct platform_device_id tps65086_restart_id_table[] = {