Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp444293rwb; Thu, 11 Aug 2022 04:33:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR5daWCMP5bVXB3nVyc4FxJ1mtBZMDc6pWiDBLv82a/6APShCSI2y25jZQG431lI9W1bQo6l X-Received: by 2002:a05:6402:2b8d:b0:43a:5410:a9fc with SMTP id fj13-20020a0564022b8d00b0043a5410a9fcmr31245560edb.99.1660217582042; Thu, 11 Aug 2022 04:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660217582; cv=none; d=google.com; s=arc-20160816; b=wjVPGkeDYHLOc5n/2WHGb3SgzagzWOZ0nWUIx3AgL/Hg4P0KK1q0BroXerI+Z7jehx P5C9Km3cHW5sZEySiMFZtpxTSkNPeLN1fpuHNaHLaedc3yAdZU+V/iMnheSubp3ocZPU Zta72Nhxnf9LsnC2+ZMEvKUBrE2XtnMNvxwyyeMyGGnyZZ0g+bYzGawUoFXiQ//7ihw6 TMgRGKbPDLiBO61acQjCvjaFA3zb0TF90p+CMPYPj8fI4WqJ9qG8HugDupUG3HMBNXh4 41+aJi4owzSsrmW/zagc00W/58/Fsx01WgRJ5yiyAw89fUKDtuUa74rOmNsSSZNGzG2t +zIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=2psXapoZ13xPQOZjFEvN9Z4DOi1cREWK0pz2T2YJtmo=; b=0WqPPYIQhzrYcqNSsV+sxbY2zLX8iyU2S/NEn1y4eqvmLUsi9T+DKw6Qsggn8OihqD vaQzz3PeGf8JRcuQP5lg9uAAAsC9xdiz0cfYr6etswYI7mxacILPIHTpS7HXTdH9uV2w s6rekxrSEO24yYazewcT0X7U+KrlqbDDDxuqioHpwnplJiL47EieGLECkJXB6zF36A5w 0nUP+JGez2GsbOfxI04KQAK3vV2/dmtYA+mKGbi+s2BoJWxFKPVHY0Nsy3if/eKP9QcF 8mHycuC71SXdUYJNKg/UIm7vZM0pYQJU3dC9wd1o8AJf4PVvf7J/ba+qiIIqvDILEPCb cGDQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mf2-20020a170906cb8200b0072b81296609si5512104ejb.64.2022.08.11.04.32.36; Thu, 11 Aug 2022 04:33:02 -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; 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 S234672AbiHKKss (ORCPT + 99 others); Thu, 11 Aug 2022 06:48:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234584AbiHKKsr (ORCPT ); Thu, 11 Aug 2022 06:48:47 -0400 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5BEE92F44; Thu, 11 Aug 2022 03:48:45 -0700 (PDT) Received: by mail-ej1-f41.google.com with SMTP id a7so32844160ejp.2; Thu, 11 Aug 2022 03:48:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=2psXapoZ13xPQOZjFEvN9Z4DOi1cREWK0pz2T2YJtmo=; b=IpaDm60Ez/kHnqKOqwLqecSOwt+TofmQl/BUc7MHOIkH+fULgLOPOjr9Aw3pYpBSBv R42mufR3uBI1vhL2XhmgmHEcUOGhJgWprd7YeDkcdO7VPwITvhzUs5N9bqCJnBBY6pRX TFKmzXSL1kiu7hQ1UM8NGEUUbrQqAN9KMyUZMn57TtSuFmaOzXKbG6ICXX17Yw5kpCcT elrAgNcjQg16pGxgqd5BX1u9AweMno7CSdUgcZyt5ioxbgN8AlIEtvilOgwLtU+xKODg osd0C5snWFdL8DWNjt8XsYm/sYoxWe9a18UN+nWiheue9WpSWe8C5dkfys8QQzNXFQP2 DVGA== X-Gm-Message-State: ACgBeo1keGsGLQTGG8T2pNsCcORl7bVTfmz427qRZ34bkA5IU8tbUDEd eYXvNLOXCXmjp3BTnV0LQINQw+PsaC8= X-Received: by 2002:a17:907:2e19:b0:730:acf0:4921 with SMTP id ig25-20020a1709072e1900b00730acf04921mr21902909ejc.416.1660214924186; Thu, 11 Aug 2022 03:48:44 -0700 (PDT) Received: from ?IPV6:2a0b:e7c0:0:107::70f? ([2a0b:e7c0:0:107::70f]) by smtp.gmail.com with ESMTPSA id f15-20020a50ee8f000000b0043bc4b28464sm9002313edr.34.2022.08.11.03.48.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Aug 2022 03:48:43 -0700 (PDT) Message-ID: <2fd0f4e5-8b5d-4257-4700-71e68cff29f6@kernel.org> Date: Thu, 11 Aug 2022 12:48:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.0 Subject: Re: [PATCH] serial: stm32: make info structs static to avoid sparse warnings Content-Language: en-US To: Ben Dooks , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Cc: gregkh@linuxfoundation.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com References: <20220721212430.453192-1-ben-linux@fluff.org> From: Jiri Slaby In-Reply-To: <20220721212430.453192-1-ben-linux@fluff.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 On 21. 07. 22, 23:24, Ben Dooks wrote: > The info structs are local only to the stm32-usart.c driver and are > triggering sparse warnings about being undecalred. Move these into > the main driver code and make them static to avoid the following > warnings: > > drivers/tty/serial/stm32-usart.h:42:25: warning: symbol 'stm32f4_info' was not declared. Should it be static? > drivers/tty/serial/stm32-usart.h:63:25: warning: symbol 'stm32f7_info' was not declared. Should it be static? > drivers/tty/serial/stm32-usart.h:85:25: warning: symbol 'stm32h7_info' was not declared. Should it be static? Right, I would go even further. There is no point in having a separate header. So could you move the whole content to .c? > Signed-off-by: Ben Dooks > --- > drivers/tty/serial/stm32-usart.c | 69 ++++++++++++++++++++++++++++++++ > drivers/tty/serial/stm32-usart.h | 68 ------------------------------- > 2 files changed, 69 insertions(+), 68 deletions(-) > > diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c > index 0973b03eeeaa..01f1ab2c18c0 100644 > --- a/drivers/tty/serial/stm32-usart.c > +++ b/drivers/tty/serial/stm32-usart.c > @@ -35,6 +35,75 @@ > #include "serial_mctrl_gpio.h" > #include "stm32-usart.h" > > + > +/* Register offsets */ > +static struct stm32_usart_info stm32f4_info = { > + .ofs = { > + .isr = 0x00, > + .rdr = 0x04, > + .tdr = 0x04, > + .brr = 0x08, > + .cr1 = 0x0c, > + .cr2 = 0x10, > + .cr3 = 0x14, > + .gtpr = 0x18, > + .rtor = UNDEF_REG, > + .rqr = UNDEF_REG, > + .icr = UNDEF_REG, > + }, > + .cfg = { > + .uart_enable_bit = 13, > + .has_7bits_data = false, > + .fifosize = 1, > + } > +}; > + > +static struct stm32_usart_info stm32f7_info = { > + .ofs = { > + .cr1 = 0x00, > + .cr2 = 0x04, > + .cr3 = 0x08, > + .brr = 0x0c, > + .gtpr = 0x10, > + .rtor = 0x14, > + .rqr = 0x18, > + .isr = 0x1c, > + .icr = 0x20, > + .rdr = 0x24, > + .tdr = 0x28, > + }, > + .cfg = { > + .uart_enable_bit = 0, > + .has_7bits_data = true, > + .has_swap = true, > + .fifosize = 1, > + } > +}; > + > +static struct stm32_usart_info stm32h7_info = { > + .ofs = { > + .cr1 = 0x00, > + .cr2 = 0x04, > + .cr3 = 0x08, > + .brr = 0x0c, > + .gtpr = 0x10, > + .rtor = 0x14, > + .rqr = 0x18, > + .isr = 0x1c, > + .icr = 0x20, > + .rdr = 0x24, > + .tdr = 0x28, > + }, > + .cfg = { > + .uart_enable_bit = 0, > + .has_7bits_data = true, > + .has_swap = true, > + .has_wakeup = true, > + .has_fifo = true, > + .fifosize = 16, > + } > +}; > + > static void stm32_usart_stop_tx(struct uart_port *port); > static void stm32_usart_transmit_chars(struct uart_port *port); > static void __maybe_unused stm32_usart_console_putchar(struct uart_port *port, unsigned char ch); > diff --git a/drivers/tty/serial/stm32-usart.h b/drivers/tty/serial/stm32-usart.h > index ee69c203b926..0ec41a732c88 100644 > --- a/drivers/tty/serial/stm32-usart.h > +++ b/drivers/tty/serial/stm32-usart.h > @@ -38,74 +38,6 @@ struct stm32_usart_info { > > #define UNDEF_REG 0xff > > -/* Register offsets */ > -struct stm32_usart_info stm32f4_info = { > - .ofs = { > - .isr = 0x00, > - .rdr = 0x04, > - .tdr = 0x04, > - .brr = 0x08, > - .cr1 = 0x0c, > - .cr2 = 0x10, > - .cr3 = 0x14, > - .gtpr = 0x18, > - .rtor = UNDEF_REG, > - .rqr = UNDEF_REG, > - .icr = UNDEF_REG, > - }, > - .cfg = { > - .uart_enable_bit = 13, > - .has_7bits_data = false, > - .fifosize = 1, > - } > -}; > - > -struct stm32_usart_info stm32f7_info = { > - .ofs = { > - .cr1 = 0x00, > - .cr2 = 0x04, > - .cr3 = 0x08, > - .brr = 0x0c, > - .gtpr = 0x10, > - .rtor = 0x14, > - .rqr = 0x18, > - .isr = 0x1c, > - .icr = 0x20, > - .rdr = 0x24, > - .tdr = 0x28, > - }, > - .cfg = { > - .uart_enable_bit = 0, > - .has_7bits_data = true, > - .has_swap = true, > - .fifosize = 1, > - } > -}; > - > -struct stm32_usart_info stm32h7_info = { > - .ofs = { > - .cr1 = 0x00, > - .cr2 = 0x04, > - .cr3 = 0x08, > - .brr = 0x0c, > - .gtpr = 0x10, > - .rtor = 0x14, > - .rqr = 0x18, > - .isr = 0x1c, > - .icr = 0x20, > - .rdr = 0x24, > - .tdr = 0x28, > - }, > - .cfg = { > - .uart_enable_bit = 0, > - .has_7bits_data = true, > - .has_swap = true, > - .has_wakeup = true, > - .has_fifo = true, > - .fifosize = 16, > - } > -}; > - > /* USART_SR (F4) / USART_ISR (F7) */ > #define USART_SR_PE BIT(0) > #define USART_SR_FE BIT(1) thanks, -- js suse labs