Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9624502ybi; Wed, 24 Jul 2019 07:15:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIGMabekMKIQzVGFQ8bTE5Qs59yxeq++GhscOm0SNR5UGhyXpXAb70iPwQ+UTvmIGynjxF X-Received: by 2002:a17:90b:f12:: with SMTP id br18mr84446884pjb.127.1563977752881; Wed, 24 Jul 2019 07:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563977752; cv=none; d=google.com; s=arc-20160816; b=gPdZRsQjvdjIpBruFatnH+dJ8vjZxCNvsj7PYdciZTWcCDROtYwNjPwfmJ0X70SQy9 YBFF3+0q1FWdyCg4x4Jil0NFESF0FnTjk5sPrh99yotD4XFjLq4d2nAL+YJwU+Ns6uTd 0eLGUPg5ipnr3inbYnWo/jQvg5kblrdhRIPyIXxDm9ynCdAaYKKnhg5rPzj8Uglk51w+ ZOFAcjCSV2iZwZJXwMCm7NRRckLWSgO3V//IN3rYUtOLflRbhRfuIJzU/Jyk/iQJKWvp sGbN+TJ+r9RboMaJE2G2L8qiHh5cS+5tPITUoxSfTLmCrQianEMcTExtrVcOunZ4R7qA WdwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=d1Ul2UkezyjbXq4joKIWlx+C7WVy/t6pRoqsGTfqd60=; b=zRVnGgKsa1KFh5d1kEhYWa6qCvPRE0haMEGFGK3FJVsLr7FQI8uBR/oTlA8ioUuLIq /QPhB2vrFcFZcE0zjLswfih/GMi25Sr8awLNRfjcxFYhPM3/NBkXW+uk1hvly5Od8kaP 7/7dZwLKXgBP2qiB2v6o/pcDcwe2Q6EHebLgAUbzPrr56ETkBTWQMiB+0y0oj1GlLKoP lCl2VQI9GVUmxyOsjxTc4sR2tmWN9Bzz3oFT+qiznEBNqdaXcKuQpLkWBxBbqNWXo/lR k8daYPCqX4jlN9rEXsnFrXfhnnoHnHw6/SL1l7xaCmrISvhHkHiObb/V2CDoZMJxY+pF d9JA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w17si13834952plp.404.2019.07.24.07.15.38; Wed, 24 Jul 2019 07:15:52 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387533AbfGXOLF (ORCPT + 99 others); Wed, 24 Jul 2019 10:11:05 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44718 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727358AbfGXOLE (ORCPT ); Wed, 24 Jul 2019 10:11:04 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6OE7J8H013736 for ; Wed, 24 Jul 2019 10:11:03 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2txrpy8nx4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 24 Jul 2019 10:11:03 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 24 Jul 2019 15:11:01 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 24 Jul 2019 15:10:58 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6OEAvcY58458190 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Jul 2019 14:10:57 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7FFA4A4089; Wed, 24 Jul 2019 14:10:56 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 23D54A4059; Wed, 24 Jul 2019 14:10:55 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.168]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 24 Jul 2019 14:10:55 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Wed, 24 Jul 2019 17:10:54 +0300 From: Mike Rapoport To: linux-xtensa@linux-xtensa.org Cc: Chris Zankel , Max Filippov , linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH] xtensa: remove free_initrd_mem Date: Wed, 24 Jul 2019 17:10:32 +0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 19072414-4275-0000-0000-000003502593 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19072414-4276-0000-0000-000038604E10 Message-Id: <1563977432-8376-1-git-send-email-rppt@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-07-24_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=810 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1907240158 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The xtensa free_initrd_mem() verifies that initrd is mapped and then frees its memory using free_reserved_area(). The initrd is considered mapped when its memory was successfully reserved with mem_reserve(). Resetting initrd_start to 0 in case of mem_reserve() failure allows to switch to generic free_initrd_mem() implementation. Signed-off-by: Mike Rapoport --- arch/xtensa/kernel/setup.c | 9 +++------ arch/xtensa/mm/init.c | 10 ---------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c index 5cb8a62..63c865b 100644 --- a/arch/xtensa/kernel/setup.c +++ b/arch/xtensa/kernel/setup.c @@ -61,7 +61,6 @@ struct screen_info screen_info = { #ifdef CONFIG_BLK_DEV_INITRD extern unsigned long initrd_start; extern unsigned long initrd_end; -int initrd_is_mapped = 0; extern int initrd_below_start_ok; #endif @@ -332,13 +331,11 @@ void __init setup_arch(char **cmdline_p) /* Reserve some memory regions */ #ifdef CONFIG_BLK_DEV_INITRD - if (initrd_start < initrd_end) { - initrd_is_mapped = mem_reserve(__pa(initrd_start), - __pa(initrd_end)) == 0; + if (initrd_start < initrd_end && + !mem_reserve(__pa(initrd_start), __pa(initrd_end))) initrd_below_start_ok = 1; - } else { + else initrd_start = 0; - } #endif mem_reserve(__pa(_stext), __pa(_end)); diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c index 79467c7..d898ed6 100644 --- a/arch/xtensa/mm/init.c +++ b/arch/xtensa/mm/init.c @@ -203,16 +203,6 @@ void __init mem_init(void) (unsigned long)(__bss_stop - __bss_start) >> 10); } -#ifdef CONFIG_BLK_DEV_INITRD -extern int initrd_is_mapped; - -void free_initrd_mem(unsigned long start, unsigned long end) -{ - if (initrd_is_mapped) - free_reserved_area((void *)start, (void *)end, -1, "initrd"); -} -#endif - static void __init parse_memmap_one(char *p) { char *oldp; -- 2.7.4