From patchwork Mon Feb 6 21:03:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 53514 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2464996wrn; Mon, 6 Feb 2023 13:14:59 -0800 (PST) X-Google-Smtp-Source: AK7set8bhywDZ3cV8hb1Cpbaku9zVEnCTmP9q0atdCn91xf0lpIOPHgnLyyzWdrpwgKewZamPYnl X-Received: by 2002:a17:902:d504:b0:198:b945:4108 with SMTP id b4-20020a170902d50400b00198b9454108mr492264plg.0.1675718099292; Mon, 06 Feb 2023 13:14:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675718099; cv=none; d=google.com; s=arc-20160816; b=H9ELv5VP+xLGXRZCnMq+6SEIEATf9cmQWd5r9A7M/tYCdG1daXpWjyvOMRgTPe0hII EaUwAGu4uYyf7Ni3h/nCSndZ0OR0E0HUxi9BpWnULIbH2lXxl2MMERtPUflmk4E9fr6q gY24gjACyJOZea+5FvMlMhjcYSflYncleTAA/8ySSY+HxuSOFSqZ0DmjYLgRP1ffv209 fCGnzXODUtBhIDOpvm1edm6fCIw8VAQkI1txKVWV298IBAn2BOgww0wCtPB+e+jZHQIJ ZCoJGsj9zN/O1v8XMF7oz1IsRUmX8QQXllfPC6fxbFFyLIpPgmldkFExPSHDFUlt9Nlr 7Mmg== 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=nDqcwgYfwv4lTDUs/q+Zq23g/jcLqlPNBpJQ3yHg2Q8=; b=VTKSMEw9k9OyzKx15HIY8WyErry7ztnqSRAx934egxzPrXndaVfh6b1IvZjGjftyAE B+5ffc7hYU9HL9Z4XmJHJ7UzeJixvIJ7HsmtgMXRCvEOCki4HInh6vKskxlWkur0VQ6n 7PGyxBhxocAIUj/jeY0sMqR7wu3Ea1iQ/abyeDQ6qoepl79K2wgbAi0phHSrdfZ/pF9V 4PgXjZWlwYSsXswxfU9aRMA676WkCVuWabj2rIds4yRkokS0p/1VeUnDiQuYjBUaMHd/ BCBU44YO3uDwoSFsNGJjaumcW+7E2KE4zuxKxeiNgfgzfN/Q8RULvSAQ68VKXKgn0Ady YDog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@me.com header.s=1a1hai header.b=NkoYjk58; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd5-20020a170902830500b001991584ad17si4153768plb.34.2023.02.06.13.14.35; Mon, 06 Feb 2023 13:14:59 -0800 (PST) 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=@me.com header.s=1a1hai header.b=NkoYjk58; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230106AbjBFVNK (ORCPT + 99 others); Mon, 6 Feb 2023 16:13:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbjBFVNI (ORCPT ); Mon, 6 Feb 2023 16:13:08 -0500 X-Greylist: delayed 563 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 06 Feb 2023 13:13:07 PST Received: from qs51p00im-qukt01072701.me.com (qs51p00im-qukt01072701.me.com [17.57.155.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B71097689 for ; Mon, 6 Feb 2023 13:13:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1675717423; bh=nDqcwgYfwv4lTDUs/q+Zq23g/jcLqlPNBpJQ3yHg2Q8=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=NkoYjk58L0yG9WuovJ3Pml7hfE1S+S3YHTS2jANnfYOXuhs9Os/Q+xhbWbyG5m8K5 f8zvBWmnz9W9s0jF31rS0ov8ItRNA6EH45q6luWyZumMgppbJsehwgbjEXg+B8afUO C1q8BWOtX1IJsRKdSAAbS5ejM9tFsgmvgqvO7+EDyQZzI3MQgGoVftjvZVIKDPHydN U9hx2mJX1nNrD4HzMZgvjR1dJyNPqilMvjR7q5s03H42woEuJN+lpxES/NepLHicUa gFlEQ5WXBK80Rtzq+KfL/NoxnkEKNv9n5iRim0lzeg/ig9V1NKzrqZ6rK4dlZcGdyZ 5qJmGngQnfGvw== Received: from localhost (qs51p00im-dlb-asmtp-mailmevip.me.com [17.57.155.28]) by qs51p00im-qukt01072701.me.com (Postfix) with ESMTPSA id 62B1315C0702; Mon, 6 Feb 2023 21:03:42 +0000 (UTC) From: Alain Volmat To: Patrice Chotard Cc: Alain Volmat , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] i2c: st: use pm_sleep_ptr to avoid ifdef CONFIG_PM_SLEEP Date: Mon, 6 Feb 2023 22:03:23 +0100 Message-Id: <20230206210324.65508-1-avolmat@me.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: bffMchFZif8_wUljSr6IvtqqwQ6FZjLq X-Proofpoint-GUID: bffMchFZif8_wUljSr6IvtqqwQ6FZjLq X-Proofpoint-Virus-Version: =?utf-8?q?vendor=3Dfsecure_engine=3D1=2E1=2E170-?= =?utf-8?q?22c6f66c430a71ce266a39bfe25bc2903e8d5c8f=3A6=2E0=2E425=2C18=2E0?= =?utf-8?q?=2E572=2C17=2E0=2E605=2E474=2E0000000_definitions=3D2022-01-11=5F?= =?utf-8?q?01=3A2022-01-11=5F01=2C2020-02-14=5F11=2C2020-01-23=5F02_signatur?= =?utf-8?q?es=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1011 bulkscore=0 mlxlogscore=963 phishscore=0 spamscore=0 mlxscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2302060182 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1757117781345574221?= X-GMAIL-MSGID: =?utf-8?q?1757117781345574221?= Rely on pm_sleep_ptr when setting the pm ops and get rid of the ifdef CONFIG_PM_SLEEP around suspend/resume functions. Signed-off-by: Alain Volmat --- drivers/i2c/busses/i2c-st.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c index 88482316d22a..f823913b75a6 100644 --- a/drivers/i2c/busses/i2c-st.c +++ b/drivers/i2c/busses/i2c-st.c @@ -740,7 +740,6 @@ static int st_i2c_xfer(struct i2c_adapter *i2c_adap, return (ret < 0) ? ret : i; } -#ifdef CONFIG_PM_SLEEP static int st_i2c_suspend(struct device *dev) { struct st_i2c_dev *i2c_dev = dev_get_drvdata(dev); @@ -762,11 +761,7 @@ static int st_i2c_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(st_i2c_pm, st_i2c_suspend, st_i2c_resume); -#define ST_I2C_PM (&st_i2c_pm) -#else -#define ST_I2C_PM NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(st_i2c_pm, st_i2c_suspend, st_i2c_resume); static u32 st_i2c_func(struct i2c_adapter *adap) { @@ -901,7 +896,7 @@ static struct platform_driver st_i2c_driver = { .driver = { .name = "st-i2c", .of_match_table = st_i2c_match, - .pm = ST_I2C_PM, + .pm = pm_sleep_ptr(&st_i2c_pm), }, .probe = st_i2c_probe, .remove = st_i2c_remove,