From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0144DC001E0 for ; Sat, 21 Oct 2023 16:36:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231719AbjJUQgH (ORCPT ); Sat, 21 Oct 2023 12:36:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231745AbjJUQfh (ORCPT ); Sat, 21 Oct 2023 12:35:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27603112; Sat, 21 Oct 2023 09:35:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FEBCC433C7; Sat, 21 Oct 2023 16:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697906131; bh=IRSw7P9VmuHhUOMwdDBR2XmA3tdHqhvGWiakm/9oZ9I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GD3fLXMdp5ENzoMaZS+fNNSFjexby3//ktNJIxMQagbYFEmNH3sSMrJXmCP2wsitu NrGJogc+Bu5bu3tSoeN4KQxU/sz4js+A7eNkYq+lMJyEIUkmN5C4FddLlrBRpCvFct FbETBGPoIvSAMvZX/nqXEko6qB+5TuJlxbNyZfLs= Date: Sat, 21 Oct 2023 18:35:29 +0200 From: Greg Kroah-Hartman To: Anup Patel Cc: Paolo Bonzini , Atish Patra , Palmer Dabbelt , Paul Walmsley , Jiri Slaby , Conor Dooley , Andrew Jones , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-serial@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 6/9] RISC-V: Add stubs for sbi_console_putchar/getchar() Message-ID: <2023102113-harsh-trout-be8f@gregkh> References: <20231020072140.900967-1-apatel@ventanamicro.com> <20231020072140.900967-7-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231020072140.900967-7-apatel@ventanamicro.com> Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org On Fri, Oct 20, 2023 at 12:51:37PM +0530, Anup Patel wrote: > The functions sbi_console_putchar() and sbi_console_getchar() are > not defined when CONFIG_RISCV_SBI_V01 is disabled so let us add > stub of these functions to avoid "#ifdef" on user side. > > Signed-off-by: Anup Patel > Reviewed-by: Andrew Jones > --- > arch/riscv/include/asm/sbi.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h > index 12dfda6bb924..cbcefa344417 100644 > --- a/arch/riscv/include/asm/sbi.h > +++ b/arch/riscv/include/asm/sbi.h > @@ -271,8 +271,13 @@ struct sbiret sbi_ecall(int ext, int fid, unsigned long arg0, > unsigned long arg3, unsigned long arg4, > unsigned long arg5); > > +#ifdef CONFIG_RISCV_SBI_V01 > void sbi_console_putchar(int ch); > int sbi_console_getchar(void); > +#else > +static inline void sbi_console_putchar(int ch) { } > +static inline int sbi_console_getchar(void) { return -1; } Why not return a real error, "-1" isn't that :) thanks, greg k-h