Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19150497rwd; Wed, 28 Jun 2023 05:53:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5uGKk8h10JnMXjGoqQxPYU5YQG+xmEzy+wopUlTeHqEvgmHhWb58meHLRwxTjg+H+V/VEV X-Received: by 2002:a17:906:8a6a:b0:988:b61e:4219 with SMTP id hy10-20020a1709068a6a00b00988b61e4219mr495836ejc.29.1687956819757; Wed, 28 Jun 2023 05:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687956819; cv=none; d=google.com; s=arc-20160816; b=I8Pm/5XtRYM3A2BA4u1g1Wwt3GTYOPn6ZwwfGgaPKRrnhdsExXW8F8hpVoAqSqCFH4 L/AIJeRbBdOnHsxU1HHuYUb3yTyxc2k99YVcX4/mkAkgNlD8yg0LiG3G1IKR09jiARie lIebEJhFN+XMc9AFx5uftMbuSFA1dkbXoREAqmyiyIgjffA94KnP/vqOIEOIOyPo5Hka vs2i1uBpknPxgwqY69EwIU9ACgzXQR4071mOVVvDG8M9/1sm6tctnkiKVoLuuLgGAxjb LFBpR2kXb6trgJdQumoKzuc7VJg1xdgz+hsSRB9a0V5T/bpaTqAa/w49lXKBxIYA5CWq C95Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=P2QBL+7zGMKDj1s/OV57kLVSn1SCcUja5763zLo1cZM=; fh=xfNbOz4I/Hg3jG8SBg8wTUJPSewLm0J/G1fLCBug3yE=; b=J+592yihSxc+GGSD7d8P7PL/Ei7/W9WgSuUmlpnuZeVQp+yReH5UkuxvLBeHRYE+Ew 2//G1yUyupbnJtzyZOHrAx+2ZJanr9EIGhyQAPtv7BpCu9yJqjJ2Sp4kHKMlZmiDDwZ1 cRw/V5dygMiMAJ8ibWx7vUi67EjUJVjToQHqSXIduROJyv4UgqWwHQoHNPfu0SwVAx9J gAOzBZ4nqHDFychvjKWnJ+Idz86KKM0od+FDdRjoVCmXjBoDETRGcR5O/5/Lb7I312pH zXuoz52cO6HCk59BbHalMxkkpGH2xSBBUfE7Im7RScC4OnOW+mOPS8YfNehht3Ig6PYn zgfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=d9tPUeWH; 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=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a170906474900b0099257ea4ef6si1173165ejs.726.2023.06.28.05.53.14; Wed, 28 Jun 2023 05:53:39 -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=@quicinc.com header.s=qcppdkim1 header.b=d9tPUeWH; 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=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231888AbjF1Mh7 (ORCPT + 99 others); Wed, 28 Jun 2023 08:37:59 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]:63716 "EHLO mx0b-0031df01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231821AbjF1Mgg (ORCPT ); Wed, 28 Jun 2023 08:36:36 -0400 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35SB2tG3012176; Wed, 28 Jun 2023 12:36:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=P2QBL+7zGMKDj1s/OV57kLVSn1SCcUja5763zLo1cZM=; b=d9tPUeWHLHRKTfxZHWo6EMSVNoJA21gzQQKvkikc5/i8hxvN0fk38LK8oZLeX7bOovnD OwRtaDyoVhj0OSEIwjk4naLKtRaI+LpwjySwbcRkItMc/cLOB2ihwZUQW2vGhOip3hAe 9cS15yWyV00EiH5mtq1fbz8PGF2uFr9nMDyA6RyV2VkLH52ysfnYHCeAJzmiKpIpgPe1 DKGM1tOiKhZPo4/Cx+9Zue7I0ElwpGI5C3vsKFiWiPAmmz1IxNf9/0lLfX8tO+kZf19o RtoTE3uE5YDuc0N8Y1eEDmXeE2yH7rDp3mo6iknjgYp9fgSSgC9XTCPnWf2BjE0XQH90 mA== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rgetpgw5s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jun 2023 12:36:17 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35SCaGEs024716 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Jun 2023 12:36:16 GMT Received: from hu-mojha-hyd.qualcomm.com (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Wed, 28 Jun 2023 05:36:10 -0700 From: Mukesh Ojha To: , , , , , , , , , , , , , , CC: , , , , , , , , "Mukesh Ojha" Subject: [PATCH v4 09/21] pstore/ram : Export ramoops_parse_dt() symbol Date: Wed, 28 Jun 2023 18:04:36 +0530 Message-ID: <1687955688-20809-10-git-send-email-quic_mojha@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1687955688-20809-1-git-send-email-quic_mojha@quicinc.com> References: <1687955688-20809-1-git-send-email-quic_mojha@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ZoEjWss5MTUTidHK6qRrwbz1QzIG9cbn X-Proofpoint-GUID: ZoEjWss5MTUTidHK6qRrwbz1QzIG9cbn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-28_08,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 bulkscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306280111 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is possible if some driver do not want ramoops region to be static instead it sets up the mem_address and mem_size and use everything what this driver has to offer. To offer this convenience export ramoops_parse_dt() function. Signed-off-by: Mukesh Ojha --- fs/pstore/ram.c | 26 ++++++++++++++++++-------- include/linux/pstore_ram.h | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index ade66dbe5f39..6bb66d044bef 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -638,7 +638,7 @@ static int ramoops_parse_dt_u32(struct platform_device *pdev, return 0; } -static int ramoops_parse_dt(struct platform_device *pdev, +int ramoops_parse_dt(struct platform_device *pdev, struct ramoops_platform_data *pdata) { struct device_node *of_node = pdev->dev.of_node; @@ -649,15 +649,24 @@ static int ramoops_parse_dt(struct platform_device *pdev, dev_dbg(&pdev->dev, "using Device Tree\n"); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(&pdev->dev, - "failed to locate DT /reserved-memory resource\n"); - return -EINVAL; + /* + * It is possible if some driver do not want ramoops + * region to be static instead it sets up the mem_address + * and mem_size and use everything what this driver has + * to offer. + */ + if (!pdata->mem_address && !pdata->mem_size) { + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, + "failed to locate DT /reserved-memory resource\n"); + return -EINVAL; + } + + pdata->mem_size = resource_size(res); + pdata->mem_address = res->start; } - pdata->mem_size = resource_size(res); - pdata->mem_address = res->start; /* * Setting "unbuffered" is deprecated and will be ignored if * "mem_type" is also specified. @@ -713,6 +722,7 @@ static int ramoops_parse_dt(struct platform_device *pdev, return 0; } +EXPORT_SYMBOL_GPL(ramoops_parse_dt); static int ramoops_probe(struct platform_device *pdev) { diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index 9d65ff94e216..55df4e631a25 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -8,6 +8,7 @@ #ifndef __LINUX_PSTORE_RAM_H__ #define __LINUX_PSTORE_RAM_H__ +#include #include struct persistent_ram_ecc_info { @@ -39,4 +40,5 @@ struct ramoops_platform_data { struct persistent_ram_ecc_info ecc_info; }; +int ramoops_parse_dt(struct platform_device *, struct ramoops_platform_data *); #endif -- 2.7.4