From patchwork Tue Oct 10 12:19:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 150728 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp154213vqb; Tue, 10 Oct 2023 05:20:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEl2ZPjvNGNYmtVl5pBfhiCeNxfLJgeTAoH0fM8V0v5BxWIddAJAl8eBrV6tSjb0szGtdVr X-Received: by 2002:a05:6a20:3c89:b0:161:2df0:eadf with SMTP id b9-20020a056a203c8900b001612df0eadfmr18483616pzj.24.1696940404101; Tue, 10 Oct 2023 05:20:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696940404; cv=none; d=google.com; s=arc-20160816; b=mUGe6td7k8jjNMRPVkhzqpNRNm2D7jZI0KCI2fk2dBWGLkAMxxg4pAJBPsxmcwvJOG 5n0P9imN2f5UEpEJ8T5Vczq7G9a717uop3g4UdeoURPVSWoCjk0wg1VANyMshwDCylUD Ed7kc+DVJOKVUITYR4K6ip++cLYb+dDPx5dfbVjL7/OrbpJiArbaVK0KdBIgJOpn57Fe E7FCNp91ZMkVsWhjo7Ukc3AlPw2dOkLcgtyDtE8PKjjYRSp1C734VnmVAukvdZzeJznQ haa3cmCHF+EpIsxyD/ZGph3L9g/4+Zd68KGl16m88G7ivjYDzY0w7OVnT+3SsU5uzWT2 34Xg== 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=HgMFBZpZg4YAWv9hA928Akj5lifcYMHNCkpezYqKcvk=; fh=8xhZaWrcsa9KVDITBp6xbCTfVkf+prxeestuu29D3YI=; b=mXMWeeJsb+QCzQVCpqguPiLDu7+i8HL4vlWTdiWXbWl86qI6biNDm1lxs/C3zdS+PA vg5F+EvzBIYsQDj3R+fnGbLJnJG7nX9UmJffim6ob0B4tgsYZ/yjM5e2bkxrIjYTyWje T9awD1o9x6ty4LryqKax6gXrScBGjZKfLznJZsTDAn0eHulewsVdqFIIV4x4ZXpfw6h8 F7gtXFyFsyjp7IlRlyv4ostV7kCcKiJbdRVj+LF+yGMCwAFKQYivjS8Ek93HGrtBDrOZ RgcgjVh3eRskqn9htU2mcGpZpK1jRs2TnrYkXYuf1VZVQ/1XM7EHAppK+eEJxmGgN8+V QI6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ZtH63OGK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id kf5-20020a17090305c500b001c61acd5be6si11241993plb.209.2023.10.10.05.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 05:20:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ZtH63OGK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id C5A33826EC76; Tue, 10 Oct 2023 05:20:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231719AbjJJMTt (ORCPT + 20 others); Tue, 10 Oct 2023 08:19:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbjJJMTq (ORCPT ); Tue, 10 Oct 2023 08:19:46 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D90EBAF; Tue, 10 Oct 2023 05:19:45 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 06E3366072E7; Tue, 10 Oct 2023 13:19:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696940384; bh=YFh6qAUpCGl4Tk3sMb7K34FQqqhAH7T1fXGALRzD3k0=; h=From:To:Cc:Subject:Date:From; b=ZtH63OGKpty6eflEjW+Hc+DyiqtTtvDe+vaHEwIHH9UvKBXF2u9qRo1u7LVGPvm+4 okBCkmXNPGkAylmlpTOjydnze7Cmncqoo6unKdlJk70vJt9BTiKP9weIGJagqXlBBU 7QQjO5KhICVGQkRls9zJ/cx8pTmibuDPCm+GoQ7zBZ0NnnXNpa5SHocOnDMQSOxO3B x5kW8VF+I0jJxII5gEC2UqLHMHerhzI8RkGxsbb8+sagZwHgfdJMuuzhpSOoVSJtpL pSMavBFtR23l6Mxk5EyOfVT4JtAzCRQxg7aR/+eFEdTVRPsnuZ8+V40oKjF83C/irp CC/I9CVrEZhsQ== From: AngeloGioacchino Del Regno To: jic23@kernel.org Cc: lars@metafoo.de, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, ruanjinjie@huawei.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, wenst@chromium.org, kernel@collabora.com Subject: [PATCH] iio: adc: mt6577_auxadc: Fix kernel panic on suspend Date: Tue, 10 Oct 2023 14:19:40 +0200 Message-ID: <20231010121940.159696-1-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 05:20:00 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779370981241512899 X-GMAIL-MSGID: 1779370981241512899 Commit a2d518fbe376 ("iio: adc: mt6577_auxadc: Simplify with device managed function") simplified the driver with devm hooks, but wrongly states that the platform_set_drvdata(), platform_get_drvdata() are unused after the simplification: the driver data is infact used in .suspend() and .resume() PM callbacks, currently producing a kernel panic. Reintroduce the call to platform_set_drvdata() in the probe function Fixes: a2d518fbe376 ("iio: adc: mt6577_auxadc: Simplify with device managed function") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Alexandre Mergnat Reviewed-by: Markus Schneider-Pargmann --- drivers/iio/adc/mt6577_auxadc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c index 370b84c2d0ba..3343b54e8e44 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -293,6 +293,7 @@ static int mt6577_auxadc_probe(struct platform_device *pdev) mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC, MT6577_AUXADC_PDN_EN, 0); mdelay(MT6577_AUXADC_POWER_READY_MS); + platform_set_drvdata(pdev, indio_dev); ret = devm_add_action_or_reset(&pdev->dev, mt6577_power_off, adc_dev); if (ret)