Received: by 10.223.185.116 with SMTP id b49csp1029825wrg; Fri, 23 Feb 2018 10:37:42 -0800 (PST) X-Google-Smtp-Source: AH8x225AMcyNug78yKMKF5OtTGP9FBZ3gnB2o7vPLaG3/djSsdZioTJ8ZAIJobT5ElQPHjhpfaUB X-Received: by 10.98.100.131 with SMTP id y125mr2660305pfb.117.1519411062181; Fri, 23 Feb 2018 10:37:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519411062; cv=none; d=google.com; s=arc-20160816; b=Rdv2ElWakIAxFWPO8cSpq7CJ+ukDdfYMaMquMLjo4r2OtJNbzhWNs+ZXm3QYIs2cjC Tx7JsXLywHw25FMDEBr+AL/o/VsQha2n1xZUqJVwqINyLBCxOas/AqGF9qS0B3JjCqcP WxxuJQ1KWqELkL6vXgtQRtfyCNou20jocfc5XUfHxHoc4CloC/thNFd538KZbY6aQTEx A5Qt5H4lLEwCuaSTkyjJvV50O5qtkzNMthXV5+h+swuJbH3DO2AKHvOtFMq59OQ7IhRR Xs5Eof6/kfl0YTlEBO3JDQbXNL4kyXkWjheiQl0c+AqFb4Pg68DYvnkYsmQmPN7TYnIM Gv6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=SmBwSo++TQgsTqVk98Yr5jYDJKwWKU9blWEDjbgLACo=; b=TjLGDYVe4rTdUO5roqfzb5lDSUCoMc4kiDNMDZdSI55AkQHKBfcbFrxxoGhSsn1Vv/ WBBMRkKIo9EEIqn+j6cH3KH5gOopPuYE24TnCTjsQMwV/giyrUdpN49wRiVIonYWnskD m2qWmZk0H772tFsgTX+aIvf4gS66uRiG2iMRBMy1GUcmZtQuLSJ34HyeUyO2LD5o2E4b 8N8EsMj2TcRu+xqdqZsIQuih+83XCZmwuQaK6vxYVKmriTE9MlbAo6JkrG4IXi6n5Mzk ltWH+ukpRM0kDjz/gn1HW0itqfxJXxi9M9QE8PqJQgWJiPqUzxzPWudafz+mboIsifJs 58kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y72si2195037pfd.88.2018.02.23.10.37.27; Fri, 23 Feb 2018 10:37:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754120AbeBWSgv (ORCPT + 99 others); Fri, 23 Feb 2018 13:36:51 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37970 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753303AbeBWSgs (ORCPT ); Fri, 23 Feb 2018 13:36:48 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9B713131B; Fri, 23 Feb 2018 18:36:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julia Lawall , Brian Norris Subject: [PATCH 4.4 090/193] mtd: maps: add __init attribute Date: Fri, 23 Feb 2018 19:25:23 +0100 Message-Id: <20180223170340.118210702@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170325.997716448@linuxfoundation.org> References: <20180223170325.997716448@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Julia Lawall commit e4106a7c8236eb7b91686d36f3bf33ee43db94b4 upstream. Add __init attribute on functions that are only called from other __init functions and that are not inlined, at least with gcc version 4.8.4 on an x86 machine with allyesconfig. Currently, the functions are put in the .text.unlikely segment. Declaring them as __init will cause them to be put in the .init.text and to disappear after initialization. The result of objdump -x on the functions before the change is as follows: 00000000000001bc l F .text.unlikely 00000000000006a2 ck804xrom_init_one.isra.1 00000000000001aa l F .text.unlikely 0000000000000764 esb2rom_init_one.isra.1 00000000000001db l F .text.unlikely 0000000000000716 ichxrom_init_one.isra.1 And after the change it is as follows: 0000000000000000 l F .init.text 000000000000069d ck804xrom_init_one.isra.1 0000000000000000 l F .init.text 000000000000075f esb2rom_init_one.isra.1 0000000000000000 l F .init.text 0000000000000711 ichxrom_init_one.isra.1 Done with the help of Coccinelle. The semantic patch checks for local static non-init functions that are called from an __init function and are not called from any other function. Note that in each case, the function is stored in the probe field of a pci_driver structure, but this code is under an #if 0. The #if 0s have been unchanged since 2009 at the latest. Signed-off-by: Julia Lawall Signed-off-by: Brian Norris Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/maps/ck804xrom.c | 4 ++-- drivers/mtd/maps/esb2rom.c | 4 ++-- drivers/mtd/maps/ichxrom.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c @@ -112,8 +112,8 @@ static void ck804xrom_cleanup(struct ck8 } -static int ck804xrom_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) +static int __init ck804xrom_init_one(struct pci_dev *pdev, + const struct pci_device_id *ent) { static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; u8 byte; --- a/drivers/mtd/maps/esb2rom.c +++ b/drivers/mtd/maps/esb2rom.c @@ -144,8 +144,8 @@ static void esb2rom_cleanup(struct esb2r pci_dev_put(window->pdev); } -static int esb2rom_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) +static int __init esb2rom_init_one(struct pci_dev *pdev, + const struct pci_device_id *ent) { static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; struct esb2rom_window *window = &esb2rom_window; --- a/drivers/mtd/maps/ichxrom.c +++ b/drivers/mtd/maps/ichxrom.c @@ -86,8 +86,8 @@ static void ichxrom_cleanup(struct ichxr } -static int ichxrom_init_one(struct pci_dev *pdev, - const struct pci_device_id *ent) +static int __init ichxrom_init_one(struct pci_dev *pdev, + const struct pci_device_id *ent) { static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; struct ichxrom_window *window = &ichxrom_window;