From patchwork Tue Aug 28 09:33:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10578097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01FF317DB for ; Tue, 28 Aug 2018 09:41:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7868299FC for ; Tue, 28 Aug 2018 09:41:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D948929A16; Tue, 28 Aug 2018 09:41:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80479299FC for ; Tue, 28 Aug 2018 09:41:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727169AbeH1Nc2 (ORCPT ); Tue, 28 Aug 2018 09:32:28 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46672 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727130AbeH1Nc2 (ORCPT ); Tue, 28 Aug 2018 09:32:28 -0400 Received: by mail-wr1-f66.google.com with SMTP id a108-v6so905835wrc.13 for ; Tue, 28 Aug 2018 02:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wc9ZRwnUmb5rXGt9YW/Z3OT0r34lfcDOfLS8ZydfUMY=; b=MME6CIbn6ztirIfcMA3UHlZmo1USCfNk6oYrqrfS2kcBjaNSlBGu0Xt3IwJZJhOBa4 zRIVln4bKyOO9n7wPDACSj85rW1EivMdt4i794d5x79jKqT8lqvxRhLlvILxHCDAOGbD seIfVj33o/l6LK9f+eDElZyrX6Z+uhE83lFQTN98edjMRs5CpMwoYxwH6rks8zSFzkdp q+1pL9rlXPsXqmQHC/m1wvlrWWZCscU6mCX/Ru8R5B1aMJxPj1b2QDe4SUWDRE0ncTg7 r1hGif/HO0HXvVRQzxgJOlmQeSasPabVm9nYQ529cNM+/kyaUmuiTT+l8ZFQ9UGnEErd C9yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wc9ZRwnUmb5rXGt9YW/Z3OT0r34lfcDOfLS8ZydfUMY=; b=rSgQ+MI3kN6fGxldDTxBtnzh3QmajFY6TTZwepcpwp12mh0Phlbh16FnBiNEOhic3m CbjTXUIwI6wdzWpTs3MqqSIsDftdKbznuXzJPyzuWex50ZU4TRowIWJGhy8HdpJnaoRE EbZJapLOOKWXwHgUWbl47BY+h3OFRWBz27HyOrfjEo3Zv3lMLm4rBriPTC6/67aslA/D c7cO0WlZC+NhJf7jzlS186F+X+nJiCCWA/thh88zo9FwvCMKLnMNu5CPrXRLwoHBGNyf H/9P3im26o1FtbxwID7LTGktanTvZJE53eXnTd9poa1I77TsyRLkm2aQy/V3/8JP4mVq s1tw== X-Gm-Message-State: APzg51Cc0toBDdf0A6+fgVsbIIY1Jk9Dzss5aXAGO8aZlhWAMwY0lasA rzTnsTXgMiC0W4NSjskx/ewP1A== X-Google-Smtp-Source: ANB0VdYZg1uzJ+5+eFWd2GzaecxTUS0AzdL/Zfb2QSzLa7FMQgAFFXWWu6LyRuwDUGxRbdwq6jNxzw== X-Received: by 2002:adf:f8ca:: with SMTP id f10-v6mr568901wrq.237.1535448848093; Tue, 28 Aug 2018 02:34:08 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id l18-v6sm952276wru.75.2018.08.28.02.34.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 02:34:07 -0700 (PDT) From: Bartosz Golaszewski To: Michael Turquette , Stephen Boyd , Greg Kroah-Hartman , "Rafael J . Wysocki" , Arend van Spriel , Ulf Hansson , Bjorn Helgaas , Vivek Gautam , Robin Murphy , Joe Perches , Heikki Krogerus , Andrew Morton , Mike Rapoport , Michal Hocko , Al Viro , Jonathan Corbet , Roman Gushchin , Huang Ying , Kees Cook , Bjorn Andersson , Arnd Bergmann Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Bartosz Golaszewski Subject: [PATCH v2 2/4] mm: move is_kernel_rodata() to asm-generic/sections.h Date: Tue, 28 Aug 2018 11:33:30 +0200 Message-Id: <20180828093332.20674-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180828093332.20674-1-brgl@bgdev.pl> References: <20180828093332.20674-1-brgl@bgdev.pl> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Export this routine so that we can use it later in devm_kstrdup_const() and devm_kfree_const(). Signed-off-by: Bartosz Golaszewski Reviewed-by: Bjorn Andersson --- include/asm-generic/sections.h | 14 ++++++++++++++ mm/util.c | 7 ------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index 849cd8eb5ca0..d79abca81a52 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -141,4 +141,18 @@ static inline bool init_section_intersects(void *virt, size_t size) return memory_intersects(__init_begin, __init_end, virt, size); } +/** + * is_kernel_rodata - checks if the pointer address is located in the + * .rodata section + * + * @addr: address to check + * + * Returns: true if the address is located in .rodata, false otherwise. + */ +static inline bool is_kernel_rodata(unsigned long addr) +{ + return addr >= (unsigned long)__start_rodata && + addr < (unsigned long)__end_rodata; +} + #endif /* _ASM_GENERIC_SECTIONS_H_ */ diff --git a/mm/util.c b/mm/util.c index d2890a407332..41e9892a50ce 100644 --- a/mm/util.c +++ b/mm/util.c @@ -15,17 +15,10 @@ #include #include -#include #include #include "internal.h" -static inline int is_kernel_rodata(unsigned long addr) -{ - return addr >= (unsigned long)__start_rodata && - addr < (unsigned long)__end_rodata; -} - /** * kfree_const - conditionally free memory * @x: pointer to the memory