Message ID | 6ec702e12cb30501fc81693a71a96b238bf09ea0.1680729716.git.philipp.g.hortmann@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp613103vqo; Wed, 5 Apr 2023 14:59:09 -0700 (PDT) X-Google-Smtp-Source: AKy350ZLUFkkaSFWFIpvfqnTE46Pg1CTdjEHe19sdNbBB8EVY4eBcxGkH99ve3zEq66JhvU95lSi X-Received: by 2002:a17:903:1c3:b0:1a1:c3eb:af7 with SMTP id e3-20020a17090301c300b001a1c3eb0af7mr9195639plh.55.1680731949395; Wed, 05 Apr 2023 14:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680731949; cv=none; d=google.com; s=arc-20160816; b=l0Hz9PaSZlp2WZD817H7VfEGmqyy4tZMbnsOBk29ro6k3KVr2pnfIcMi5U6FmGUT/N rvh/ub3ItiC17FfJYaXbi7S4Zk2GtXA25HZjat5PLo55BRIg9Kk5+SKFY5lEzGYQBc9G 9XJA0zUfTiG1mu+1L2rExWo4hsEVtwhKyzpz13KLHiyQRgzd7b827hHGMU7GRCgI0Y5z WIQST2cRvY7dwYn3xG/SaM36VjsvAWF6ieB3vojmJQHmFbwta9tuVX43aFtyD/D7xP8Q zOotnhA78+D+LjH/+c59nGmSL/UHJ8eCUMECnBEX7ccNK+SwcUZeQHQe7b2EnFNufzoo jYqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature; bh=MCqBVJ5FUAqz6et7gCXC65lddEZjuyWxiqbGgbtDS3g=; b=nvJz0wihLq67+Lskq58ALgBwg1YFmC0GweXfvlj+epM9vBLemwYe/+K6YLLnLbpbWK W3VYqFY2Zfa17nJKONL2gBpKhDsnP92tnVT8anEaQeHh70jnLVTau45DrGs/CySxtmqz FjP4LECiwRRHZA9i4aHlHSwh6zTMR6LGycPL/bDwhhPOii260G+NFeGcrB3/Q/Mf+c7q Hc005BnreKh1yX633ESPSJjVew2ZKYOJuljSq6HZ3FodrN0C3S4w5Iwk7lJD+qoxA2Cw tbUz3lolwxgznweTwPRsNrDMonPKAerBhErY4wagbFYjkExOT7bp8lkvCSKNdrQkQQx0 dABQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OddqGCVQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a170903244600b0019e698b3cefsi10165pls.311.2023.04.05.14.58.56; Wed, 05 Apr 2023 14:59:09 -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=@gmail.com header.s=20210112 header.b=OddqGCVQ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229731AbjDEVsr (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Wed, 5 Apr 2023 17:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbjDEVsi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 5 Apr 2023 17:48:38 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB0357DAA for <linux-kernel@vger.kernel.org>; Wed, 5 Apr 2023 14:48:23 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-947a47eb908so61186466b.0 for <linux-kernel@vger.kernel.org>; Wed, 05 Apr 2023 14:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680731302; x=1683323302; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=MCqBVJ5FUAqz6et7gCXC65lddEZjuyWxiqbGgbtDS3g=; b=OddqGCVQ9nguKkoLetqbQq9AWu6vI93zintV3cneVBEclDnwlebshfdw2KJ1RnFS4Y 2sXG/aRTSQ+Hq92MJ4CXM10zB7bau3pkNmAyMclQ4nfhjk4/C1z4XXzhEilgRYy/Pnf0 D/8ocAm7myGvsbgbrQLrRYcyHeVXQOVbKyHBv5TrAOmdXxzN3XvHI1VGmPjO2zo/Mstm X4+6x2ogjas8UYmc/Czy7rOzfp3AXz0BqwWcK+cr8IKLPWPOWQT6qWJe18M/+aEQaIVM aVwH18TW2wFqarg7LplLeFXE0ptgWP1EN1XD5MHnlx/7MKcjiTt4MWsfxXlCzb7TIVxR k4Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680731302; x=1683323302; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MCqBVJ5FUAqz6et7gCXC65lddEZjuyWxiqbGgbtDS3g=; b=hTmiGT4iaY4uENI1VVMbvMO7QZuRbPhj/+YmFBfcRYhidXM8bzs7mHPro4yuaWfIvj ef2sAEGrUYHnKIgXHiPthSa/a3dIONFStLDiq9LCUFa+SljVxRlvUAvGIKUKKJshARxv Bzo6ccoJuQTST2cZNoYO+9DsfNd58c1R2YkTepyxl2pwkWjQ/3RKDL0AJc6Wy2bnbThV sUJrWJrSoTSsjhF99bFolO7Nteh5U7k+dgIF1eyY6utGTmErjuJf/8HDURehfptt5iN2 bPPugdbBgAKeya7H1e6JIWhPNE+58KChsPUGbWV7WYQXrlDOaGxrTPlYVb5ILWzjW6cO GL1A== X-Gm-Message-State: AAQBX9cxcWQf8HpjTFqJa6ZvBwV8bwgCby5eNv95JfnL6CwZZ6E8GAnC IMo0bDwCDWqLcf0JISCQyo9CS7KgVn4= X-Received: by 2002:a05:6402:27cc:b0:4bb:afe3:e0a with SMTP id c12-20020a05640227cc00b004bbafe30e0amr4846026ede.3.1680731302114; Wed, 05 Apr 2023 14:48:22 -0700 (PDT) Received: from matrix-ESPRIMO-P710 (p57935146.dip0.t-ipconnect.de. [87.147.81.70]) by smtp.gmail.com with ESMTPSA id n19-20020a509353000000b004c09527d62dsm7867721eda.30.2023.04.05.14.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 14:48:21 -0700 (PDT) Date: Wed, 5 Apr 2023 23:48:20 +0200 From: Philipp Hortmann <philipp.g.hortmann@gmail.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] staging: rtl8192e: Remove unused local variable irq_line Message-ID: <6ec702e12cb30501fc81693a71a96b238bf09ea0.1680729716.git.philipp.g.hortmann@gmail.com> References: <cover.1680729715.git.philipp.g.hortmann@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <cover.1680729715.git.philipp.g.hortmann@gmail.com> X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762375184557416714?= X-GMAIL-MSGID: =?utf-8?q?1762375184557416714?= |
Series |
staging: rtl8192e: Remove unused code for hardware rtl8192se
|
|
Commit Message
Philipp Hortmann
April 5, 2023, 9:48 p.m. UTC
Remove unused local variable irq_line.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
---
drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 --
1 file changed, 2 deletions(-)
Comments
On Wed, Apr 05, 2023 at 11:48:20PM +0200, Philipp Hortmann wrote: > Remove unused local variable irq_line. This does more than just remove the unused variable. > > Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> > --- > drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c > index 0bc3e013001e..1c3ccd2aabc3 100644 > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c > @@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev) > struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); > u16 device_id; > u8 revision_id; > - u16 irq_line; > > device_id = pdev->device; > revision_id = pdev->revision; > - pci_read_config_word(pdev, 0x3C, &irq_line); > > priv->card_8192 = NIC_8192E; > > -- > 2.40.0 >
On Wed, Apr 05, 2023 at 11:48:20PM +0200, Philipp Hortmann wrote: > Remove unused local variable irq_line. > > Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> > --- > drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c > index 0bc3e013001e..1c3ccd2aabc3 100644 > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c > @@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev) > struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); > u16 device_id; > u8 revision_id; > - u16 irq_line; > > device_id = pdev->device; > revision_id = pdev->revision; > - pci_read_config_word(pdev, 0x3C, &irq_line); As was pointed out, that might not be "unused". When doing a PCI write, the only way to know it has completed is to issue a read. Are you sure this isn't a read that is flushing out a pending write? Look at who calls this function and verify that this read really is safe to remove and then document that really really well in the changelog text when doing so. Be careful about removing seemingly-unused PCI read/writes, they often times are actually needed. thanks, greg k-h
On 4/6/23 22:06, Greg Kroah-Hartman wrote: > On Wed, Apr 05, 2023 at 11:48:20PM +0200, Philipp Hortmann wrote: >> Remove unused local variable irq_line. >> >> Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> >> --- >> drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c >> index 0bc3e013001e..1c3ccd2aabc3 100644 >> --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c >> +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c >> @@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev) >> struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); >> u16 device_id; >> u8 revision_id; >> - u16 irq_line; >> >> device_id = pdev->device; >> revision_id = pdev->revision; >> - pci_read_config_word(pdev, 0x3C, &irq_line); > > As was pointed out, that might not be "unused". > > When doing a PCI write, the only way to know it has completed is to > issue a read. Are you sure this isn't a read that is flushing out a > pending write? Look at who calls this function and verify that this > read really is safe to remove and then document that really really well > in the changelog text when doing so. > > Be careful about removing seemingly-unused PCI read/writes, they often > times are actually needed. > > thanks, > > greg k-h Hi, The first function that is called of the driver is: _rtl92e_pci_probe(). 66 Lines later the function rtl92e_check_adapter() is called. The line pci_read_config_word() is the 10th line of this function. No other pci function before in function rtl92e_check_adapter(). The following functions are used in the probe function before the rtl92e_check_adapter(): pci_enable_device() Does not require a pci read. pci_set_master() Does not require a pci read. dma_set_mask() Does not require a pci read. alloc_rtllib() Does not require a pci read. pci_set_drvdata() Does not require a pci read. SET_NETDEV_DEV() Does not require a pci read. rtllib_priv() Does not require a pci read. pci_resource_start() Does not require a pci read. pci_resource_len() Does not require a pci read. pci_resource_flags() Does not require a pci read. request_mem_region() Does not require a pci read. ioremap() Does not require a pci read. pci_resource_len() Does not require a pci read. pci_read_config_byte() Which is deleted in this patch series. So Gregs hint is applicable for this patch as well. I am going to issue a v2. Thanks for your support. Bye Philipp
On Fri, Apr 07, 2023 at 10:08:50AM +0200, Philipp Hortmann wrote: > On 4/6/23 22:06, Greg Kroah-Hartman wrote: > > On Wed, Apr 05, 2023 at 11:48:20PM +0200, Philipp Hortmann wrote: > > > Remove unused local variable irq_line. > > > > > > Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> > > > --- > > > drivers/staging/rtl8192e/rtl8192e/rtl_pci.c | 2 -- > > > 1 file changed, 2 deletions(-) > > > > > > diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c > > > index 0bc3e013001e..1c3ccd2aabc3 100644 > > > --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c > > > +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c > > > @@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev) > > > struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); > > > u16 device_id; > > > u8 revision_id; > > > - u16 irq_line; > > > device_id = pdev->device; > > > revision_id = pdev->revision; > > > - pci_read_config_word(pdev, 0x3C, &irq_line); > > > > As was pointed out, that might not be "unused". > > > > When doing a PCI write, the only way to know it has completed is to > > issue a read. Are you sure this isn't a read that is flushing out a > > pending write? Look at who calls this function and verify that this > > read really is safe to remove and then document that really really well > > in the changelog text when doing so. > > > > Be careful about removing seemingly-unused PCI read/writes, they often > > times are actually needed. > > > > thanks, > > > > greg k-h > > Hi, > > The first function that is called of the driver is: _rtl92e_pci_probe(). > 66 Lines later the function rtl92e_check_adapter() is called. The line > pci_read_config_word() is the 10th line of this function. > > No other pci function before in function rtl92e_check_adapter(). > > The following functions are used in the probe function before the > rtl92e_check_adapter(): > > pci_enable_device() Does not require a pci read. > pci_set_master() Does not require a pci read. > dma_set_mask() Does not require a pci read. > alloc_rtllib() Does not require a pci read. > pci_set_drvdata() Does not require a pci read. > SET_NETDEV_DEV() Does not require a pci read. > rtllib_priv() Does not require a pci read. > pci_resource_start() Does not require a pci read. > pci_resource_len() Does not require a pci read. > pci_resource_flags() Does not require a pci read. > request_mem_region() Does not require a pci read. > ioremap() Does not require a pci read. > pci_resource_len() Does not require a pci read. > pci_read_config_byte() Which is deleted in this > patch series. So Gregs hint is > applicable for this patch as well. > > I am going to issue a v2. How do you know that this device does not require that register to be read from in order to work properly? Remember, reads can change device's state as well as writes. thanks, greg k-h
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c index 0bc3e013001e..1c3ccd2aabc3 100644 --- a/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c @@ -33,11 +33,9 @@ bool rtl92e_check_adapter(struct pci_dev *pdev, struct net_device *dev) struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); u16 device_id; u8 revision_id; - u16 irq_line; device_id = pdev->device; revision_id = pdev->revision; - pci_read_config_word(pdev, 0x3C, &irq_line); priv->card_8192 = NIC_8192E;