From patchwork Fri Jun 16 09:00:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 108954 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1188324vqr; Fri, 16 Jun 2023 02:09:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Eap0BwE2UMeW697mEGKnYqqr8h6g0MLspSG/ohvnssvm62eS2fXTLwF2mRu1EnuLQJGvo X-Received: by 2002:a05:6358:51cd:b0:123:1d38:db05 with SMTP id 13-20020a05635851cd00b001231d38db05mr986067rwl.6.1686906571354; Fri, 16 Jun 2023 02:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686906571; cv=none; d=google.com; s=arc-20160816; b=uoQKTLY+eKiLy9Tm7uLvR5Xl9D4vBarRvuU8iwv0PKLRNwcOEPOZXxYnzC3L08s+cn UBrI3n3PkMixc2jh0fmm4CgaEpB7iv7pDrJHaqABDWbq9MUeFHOoifyY77qKY8MNsinY GXco2MXNjyR6Mq/V297CrQ3yMYfWrODM1B0iU91Rm7Fl2F8GjuS4FexO4XWmE/TAk0bp XuzMixKaq59CcRsTgpubUUp0Pi+jaNJEvNGNzmQka84vULNbjKlB71smNeltiE7bI5AF btqIMcfk7M3TMx76L6adCBW4YVEGlEnxGHCaNMPklYxnRJuFa51T7xOOkG+3MSpsouhE 4Iuw== 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=f0admiXWKRoayf+ZUUoaw0/gDlQtXfjLqB69x3RLTvs=; b=iVuxg+zadBqULaPQlTEkbIFMTQrEQ/eVVVayjJYDPjsaspQ6HJX+2HuSP8jeyb1tj1 /eScOGjTSp5PW7xH8LGc68AVMpzHufAZRCyb9ER4sgCulOsOULzEuKhFWHSXV4vbolW1 +wgZnKEr8htgbKp5atUK6Jfcj8yFErKhtfSh4MY/TBX3x9Qxz6sVuRbnqpyzHJ0Xqknh +BjBwKHqj83v1O8kdTjBVVXBPwgJSbtgOCn5/ooreMRj2XKvUIsVfXfL9OM7OIgv7xro g1wu4TCKSCsa+WGzIYZJKwVzIJ3+VHGZc9zg96KkaMcXlvLb0pIzdDzaSmwKNXHFIAfv rWtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FtywWfZt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w22-20020a63af16000000b0054ff40bf1ccsi3604141pge.702.2023.06.16.02.09.17; Fri, 16 Jun 2023 02:09:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FtywWfZt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245619AbjFPJE1 (ORCPT + 99 others); Fri, 16 Jun 2023 05:04:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244352AbjFPJDy (ORCPT ); Fri, 16 Jun 2023 05:03:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B73A54493 for ; Fri, 16 Jun 2023 02:02:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E71262C11 for ; Fri, 16 Jun 2023 09:02:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6EF3C433C0; Fri, 16 Jun 2023 09:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686906122; bh=cVzo/h1du6EG71YMJA69ZOvL8XUo5XXroakRB2KzZho=; h=From:To:Cc:Subject:Date:From; b=FtywWfZtgsSj9FFvkPXXwo6WbvZLGQh+2L5ouZeJCIRq8qf+btEr6ccuQbacsOeo5 zwEcUnUrGyBg3M7mYLmj3cE9cC1xiuvjCZp7K09Tb3tPZ/LsFmp3t5T3SNEoGRhI4u A7Tv6H/7geI+qr66OvZ9gksTWXwg4/qycNf1TuY8IHG2a+GHYcrQBn6Yu7KYRicyuf svss8ubY8wrRBMqSn5QcK2POSanpEJmhtb3oE9N9i3FZAOi7EqUY+EcGNmBkB3ZfDs X6nfcGOd+NhgLFFkNEChAnaX2f7MdfxAX3OM/yXJOB+5EezGd6CHIao4CSb4XxqlZ+ PNkWceMMoDYXw== From: Arnd Bergmann To: Mark Brown Cc: Arnd Bergmann , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Ryan Lee , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] ASoC: max98388: fix unused function warnings Date: Fri, 16 Jun 2023 11:00:37 +0200 Message-Id: <20230616090156.2347850-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768849744882662361?= X-GMAIL-MSGID: =?utf-8?q?1768849744882662361?= From: Arnd Bergmann The PM functions are never referenced when CONFIG_PM_SLEEP is disabled: sound/soc/codecs/max98388.c:854:12: error: unused function 'max98388_suspend' [-Werror,-Wunused-function] static int max98388_suspend(struct device *dev) ^ sound/soc/codecs/max98388.c:864:12: error: unused function 'max98388_resume' [-Werror,-Wunused-function] static int max98388_resume(struct device *dev) Fix this by using the modern SYSTEM_SLEEP_PM_OPS() macro in place of the deprecated SET_SYSTEM_SLEEP_PM_OPS() version, and use pm_sleep_ptr() to hide the entire structure as well. On a related note, the of_match_ptr() and ACPI_PTR() macros have the same problem and would cause the device id table to be unused when the driver is built-in and the respective subsystems are disabled. This does not cause warnings unless -Wunused-const-variable is passed to the compiler, but it's better to just not use the macros at all here. Signed-off-by: Arnd Bergmann Acked-by: Randy Dunlap Tested-by: Randy Dunlap # build-tested --- sound/soc/codecs/max98388.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/max98388.c b/sound/soc/codecs/max98388.c index 8062a71150074..3d03c4bac6c55 100644 --- a/sound/soc/codecs/max98388.c +++ b/sound/soc/codecs/max98388.c @@ -873,7 +873,7 @@ static int max98388_resume(struct device *dev) } static const struct dev_pm_ops max98388_pm = { - SET_SYSTEM_SLEEP_PM_OPS(max98388_suspend, max98388_resume) + SYSTEM_SLEEP_PM_OPS(max98388_suspend, max98388_resume) }; static const struct regmap_config max98388_regmap = { @@ -998,9 +998,9 @@ MODULE_DEVICE_TABLE(acpi, max98388_acpi_match); static struct i2c_driver max98388_i2c_driver = { .driver = { .name = "max98388", - .of_match_table = of_match_ptr(max98388_of_match), - .acpi_match_table = ACPI_PTR(max98388_acpi_match), - .pm = &max98388_pm, + .of_match_table = max98388_of_match, + .acpi_match_table = max98388_acpi_match, + .pm = pm_sleep_ptr(&max98388_pm), }, .probe = max98388_i2c_probe, .id_table = max98388_i2c_id,