From patchwork Mon Apr 3 07:49:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 78398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2131941vqo; Mon, 3 Apr 2023 01:01:10 -0700 (PDT) X-Google-Smtp-Source: AKy350YJ4OP5witfQE+bvdV4UV6IYcX6jJuTkjns0MW2v1Ru+E4HH0KAkhP3n0EWqbXTgYiIOK6U X-Received: by 2002:a17:906:174b:b0:929:7d80:3a37 with SMTP id d11-20020a170906174b00b009297d803a37mr33597935eje.37.1680508870194; Mon, 03 Apr 2023 01:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680508870; cv=none; d=google.com; s=arc-20160816; b=wuyyDfmCzBWkXnoRSUt3l0tLOZU+sV5DSHS9jy3e/gFP0JVWnphGlUOLAZHyJuBnX1 Z+70s1qDV6++ywxucatbjIafTfrOzzzdj0MYzNR0h6FrWg66gj5JvXqme5TmQDIjrvvm WgmFM/bm9rBCzrC+DG1q8NuGtIFvTObkJWnPrTjjJgyXfH56WoobNecpQOPnJnBEcfHm 8cnSjZvWO0xqkoweSMhERJS86qrguvije9jB1P/mlMSIiQ5x6hEr5HH5YDbnyR6pQMIS +W+Pxigmgl4tk6IQKn+t3NIJr00L/hCE1wmfNtonIHpp4KQ5ZldwFgPz5zjPbmv2R2ql rlTg== 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=c70BqtpOg7NJ7XSTwVE36R2IFyiEprEbGDuKyJH/WJY=; b=VtgSXWKPfb9uygkxCMhrtQZk7Mp6TOmVLzG2UPNUvWCiedO3ljjIJwTWof2zjB7e3P 3tGziJ6sqed1F+IMTpVdUM0mnekCcvgrLpp+h7Y8YhnNf1NIIaLSnZhh54ClHblHQWLj cN95Y8JFpZn10O9jCGxQHVHWq7QvhsthzIjJQ21AphnrTemyKYykpOOjgfUBx4c7Ox4P 1a/uQLpmNxIy/y23Ey43SyotdYrgAmidnxyPTb3OU4XmJia9+xspSFIi3Jlge1N4UtNb Bxk6lplpxmu8qDgM+0XVnJZlWxedV2JBkBz0cayBqZ3UT8blMvu+eghwmboDl54Lr5YR Wv+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OcRmbfJD; 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 kd5-20020a17090798c500b00939adedc8e7si6714908ejc.226.2023.04.03.01.00.44; Mon, 03 Apr 2023 01:01:10 -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=OcRmbfJD; 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 S231694AbjDCHuH (ORCPT + 99 others); Mon, 3 Apr 2023 03:50:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231320AbjDCHuE (ORCPT ); Mon, 3 Apr 2023 03:50:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E7E9525B; Mon, 3 Apr 2023 00:49:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 36279B81097; Mon, 3 Apr 2023 07:49:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA77AC433EF; Mon, 3 Apr 2023 07:49:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680508185; bh=6mVhMmgCEexVQis9i8ZyD12x70TPYyHdwAxpUEaYpxE=; h=From:To:Cc:Subject:Date:From; b=OcRmbfJDmRGAULuMFh2hCZNNXlsWpbyKkVGQpqcvVxW5+T9isUX1vJ2ru4ORrCzXr UR9oxZRp/Z1PPcxn8b20CE8OMVJEX+1Uuwnq8lWnrYLRdZF04Kd0hv8VCi5ZO7iXEw o2zsq/g6kDc3W+S37H1ZxQqcJZj4Y7nnN56yPxFbjtNtD1/D4lI3nPftq6N2LskgID +GMLbreQJvA87H81QwxC6g8JcpsOq9AZgaudl5vMwIzef5i7Kl0fbm3VHSRpLTfxF9 OUyrCiRlqzt2oSRjm9/OnjDbCvrXHWYEyAPHxNeHp9JCTzGvHgAESoHZkYX7RlUpYY 84fqqV61cNtqg== From: Arnd Bergmann To: Jean-Marie Verdun , Nick Hawkins , Wolfram Sang , Joel Stanley Cc: Arnd Bergmann , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Andy Shevchenko , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] i2c: gxp: fix build failure without CONFIG_I2C_SLAVE Date: Mon, 3 Apr 2023 09:49:13 +0200 Message-Id: <20230403074939.3785593-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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?1762141269538437963?= X-GMAIL-MSGID: =?utf-8?q?1762141269538437963?= From: Arnd Bergmann The gxp_i2c_slave_irq_handler() is hidden in an #ifdef, but the caller uses an IS_ENABLED() check: drivers/i2c/busses/i2c-gxp.c: In function 'gxp_i2c_irq_handler': drivers/i2c/busses/i2c-gxp.c:467:29: error: implicit declaration of function 'gxp_i2c_slave_irq_handler'; did you mean 'gxp_i2c_irq_handler'? [-Werror=implicit-function-declaration] It has to consistently use one method or the other to avoid warnings, so move to IS_ENABLED() here for readability and build coverage, and move the #ifdef in linux/i2c.h to allow building it as dead code. Fixes: 4a55ed6f89f5 ("i2c: Add GXP SoC I2C Controller") Signed-off-by: Arnd Bergmann Reviewed-by: Nick Hawkins --- drivers/i2c/busses/i2c-gxp.c | 2 -- include/linux/i2c.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-gxp.c b/drivers/i2c/busses/i2c-gxp.c index d4b55d989a26..8ea3fb5e4c7f 100644 --- a/drivers/i2c/busses/i2c-gxp.c +++ b/drivers/i2c/busses/i2c-gxp.c @@ -353,7 +353,6 @@ static void gxp_i2c_chk_data_ack(struct gxp_i2c_drvdata *drvdata) writew(value, drvdata->base + GXP_I2CMCMD); } -#if IS_ENABLED(CONFIG_I2C_SLAVE) static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata) { u8 value; @@ -437,7 +436,6 @@ static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata) return true; } -#endif static irqreturn_t gxp_i2c_irq_handler(int irq, void *_drvdata) { diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 5ba89663ea86..13a1ce38cb0c 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -385,7 +385,6 @@ static inline void i2c_set_clientdata(struct i2c_client *client, void *data) /* I2C slave support */ -#if IS_ENABLED(CONFIG_I2C_SLAVE) enum i2c_slave_event { I2C_SLAVE_READ_REQUESTED, I2C_SLAVE_WRITE_REQUESTED, @@ -396,9 +395,10 @@ enum i2c_slave_event { int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb); int i2c_slave_unregister(struct i2c_client *client); -bool i2c_detect_slave_mode(struct device *dev); int i2c_slave_event(struct i2c_client *client, enum i2c_slave_event event, u8 *val); +#if IS_ENABLED(CONFIG_I2C_SLAVE) +bool i2c_detect_slave_mode(struct device *dev); #else static inline bool i2c_detect_slave_mode(struct device *dev) { return false; } #endif