Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3883520pxb; Mon, 8 Feb 2021 02:32:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTHbZotvFaievxg/yDQHQTO990Wrsnpet1ijMGYpCAgPlI852mKhFfuX8FSELNWkpJwEUw X-Received: by 2002:aa7:c889:: with SMTP id p9mr6025021eds.224.1612780379795; Mon, 08 Feb 2021 02:32:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612780379; cv=none; d=google.com; s=arc-20160816; b=RoGK6oVALqzbxXiwFyYFTD+13HwPQfx+Xh39jiAq1oTePdB1wSg4srGZ+fcu0Jonzi AA1i219SdlBb10HTLSAGmSDDBAD+EmUak5ga8LrfPFGE5RNJtV5Zg/Gthb3LV8vQSp7C kosyUYtW0GuxI5CNd1kDCsyxEN2wmtS+7Cqs5oZXZptvlTe8Xcs/ymzrvRuj+v5UTftj icBxiIw8+vMS/45Y3P/oP7T8b+8o2BeTeiZdCIPsSW1n55P7GZwC+dzhtUxNoZdxkX7H sITnDXd+0tW83NiXFlYZhVsDyGbz2UhN+ZXuUaUxW5wJ+AfIZMZhZ/3EXneNVElNfk2s T5lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=sYbVgLIX+r79AC92zSDbMeMyYfHTGLVOZJrkvK6/LKQ=; b=gbRhmLHQXlAK7GJ9cwGmkIt4oYcPej3IshNpjhYAFSOZ66Wd9/RIthvUVZsoE124cq /9RWtAPQYnZXLJaZwLIKxFvsIFEVAIx051sjt+RtePphxvfMosZSmELBsHmLDXCO6WLp 7Ynyzuyek3f0OYAb4P/N5RJXbgHVa00LUH3ryKjLfNf2gJkKhfVhpDJVP6eCuNE+MFAQ AuloMahFmIhYAxMrLgvcZXe856FKh3vQEhukMD2o0qVwnyqgKIDmg8V2OWnCKLaqDaqy 5qRmGLKEPMg/XrWC4o5A/wlB6C6+BxkLDAG66CWk+4jxTR3kShrA5nPWVx66PC+akqYV lElw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si12374701edm.477.2021.02.08.02.32.35; Mon, 08 Feb 2021 02:32:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbhBHKbb (ORCPT + 99 others); Mon, 8 Feb 2021 05:31:31 -0500 Received: from mail-ot1-f53.google.com ([209.85.210.53]:40157 "EHLO mail-ot1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232295AbhBHKSx (ORCPT ); Mon, 8 Feb 2021 05:18:53 -0500 Received: by mail-ot1-f53.google.com with SMTP id i20so13664733otl.7; Mon, 08 Feb 2021 02:18:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sYbVgLIX+r79AC92zSDbMeMyYfHTGLVOZJrkvK6/LKQ=; b=ZKqKt2Gu/vTRGswruTe5S42pl3uzvr5Uvfs+RW8XMNCmeEjjpQ7DYmH2yAv2KFldiC XtfHqlsOaL+fZs2d6NPjHiz7VekaGYrkVbS8f/QhiUEXvHwpKQax8GLyCJIqcDN1PZPP wFsQHnceK7HgxKVx/ckv+wMyFGzqNsyvuZp5UgTmYS+z51+2Ya9YjTAYOkzLhobQcpsx BjMorwCqec3NZJulGuADSIiVIBj4PAknhm7HHa42ECFyqLpKwVPX7+ubY9p4N6HKtcXw TThdyFeShkp1QZeHtvrEQdFXJ8o7nh0Nj1V+M/AQHmLEkpt1GagjTRYwjolJB1zOOSOX VROA== X-Gm-Message-State: AOAM531ku60lkbDSeMMZYUCM8wuOm+9pFEUypKH+Rw0lbMNbiqAWxke8 EBHn5WTUyLlTQXXcZuRZiZaOhwFa5RMYJikq5Zs= X-Received: by 2002:a9d:77d6:: with SMTP id w22mr1010723otl.145.1612779492055; Mon, 08 Feb 2021 02:18:12 -0800 (PST) MIME-Version: 1.0 References: <20210207000030.256592-1-memxor@gmail.com> <20210207173441.2902acac@canb.auug.org.au> <20210207073827.7l7h3475tqgxxfte@apollo> In-Reply-To: <20210207073827.7l7h3475tqgxxfte@apollo> From: Geert Uytterhoeven Date: Mon, 8 Feb 2021 11:18:01 +0100 Message-ID: Subject: Re: [PATCH] staging: emxx_udc: Fix incorrectly defined global To: Kumar Kartikeya Dwivedi Cc: Stephen Rothwell , driverdevel , Greg KH , Linux Kernel Mailing List , Nishad Kamdar , Magnus Damm , Linux-Renesas Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kumar, CC Nishad, Magnus, linux-renesas-soc, On Sun, Feb 7, 2021 at 8:40 AM Kumar Kartikeya Dwivedi wrote: > On Sun, Feb 07, 2021 at 12:04:41PM IST, Stephen Rothwell wrote: > > Given that drivers/staging/emxx_udc/emxx_udc.h is only included by > > drivers/staging/emxx_udc/emxx_udc.c, shouldn't these variables just be > > declared static in emxx_udc.c and removed from emxx_udc.h? > > > > Either would be correct. I went this way because it was originally trying to > (incorrectly) define a global variable instead. I guess they can be static now > and when more users are added, the linkage can be adjusted as needed. > > Here's another version of the patch: > > -- > From 5835ad916ceeba620c85bc32f52ecd69f21f8dab Mon Sep 17 00:00:00 2001 > From: Kumar Kartikeya Dwivedi > Date: Sun, 7 Feb 2021 12:53:39 +0530 > Subject: [PATCH] staging: emxx_udc: Make incorrectly defined global static > > The global gpio_desc pointer and int vbus_irq were defined in the header, > instead put the definitions in the translation unit and make them static as > there's only a single consumer in emxx_udc.c. > > This fixes the following sparse warnings for this driver: > drivers/staging/emxx_udc/emxx_udc.c: note: in included file: > drivers/staging/emxx_udc/emxx_udc.h:23:18: warning: symbol 'vbus_gpio' was not > declared. Should it be static? > drivers/staging/emxx_udc/emxx_udc.h:24:5: warning: symbol 'vbus_irq' was not > declared. Should it be static? > > Signed-off-by: Kumar Kartikeya Dwivedi Thanks for your patch! > --- a/drivers/staging/emxx_udc/emxx_udc.c > +++ b/drivers/staging/emxx_udc/emxx_udc.c > @@ -34,6 +34,9 @@ > #define DRIVER_DESC "EMXX UDC driver" > #define DMA_ADDR_INVALID (~(dma_addr_t)0) > > +static struct gpio_desc *vbus_gpio; > +static int vbus_irq; While I agree these must be static, I expect the driver to be still broken, as vbus_gpio is never set? Commit 48101806c52203f6 ("Staging: emxx_udc: Switch to the gpio descriptor interface") introduced both variables, which was presumably never tested. Magnus: perhaps we should just remove this driver? > + > static const char driver_name[] = "emxx_udc"; > static const char driver_desc[] = DRIVER_DESC; > > diff --git a/drivers/staging/emxx_udc/emxx_udc.h b/drivers/staging/emxx_udc/emxx_udc.h > index bca614d69..c9e37a1b8 100644 > --- a/drivers/staging/emxx_udc/emxx_udc.h > +++ b/drivers/staging/emxx_udc/emxx_udc.h > @@ -20,8 +20,6 @@ > /* below hacked up for staging integration */ > #define GPIO_VBUS 0 /* GPIO_P153 on KZM9D */ > #define INT_VBUS 0 /* IRQ for GPIO_P153 */ > -struct gpio_desc *vbus_gpio; > -int vbus_irq; Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds