Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754619AbcJUKeD (ORCPT ); Fri, 21 Oct 2016 06:34:03 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:61689 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751033AbcJUKeA (ORCPT ); Fri, 21 Oct 2016 06:34:00 -0400 From: Arnd Bergmann To: Imran Khan Cc: andy.gross@linaro.org, David Brown , Rob Herring , Mark Rutland , "open list:ARM/QUALCOMM SUPPORT" , "open list:ARM/QUALCOMM SUPPORT" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list Subject: Re: [PATCH] soc: qcom: Add SoC info driver Date: Fri, 21 Oct 2016 12:33:40 +0200 Message-ID: <2349770.MVMXr64OoI@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <1476972386-28655-1-git-send-email-kimran@codeaurora.org> References: <1476972386-28655-1-git-send-email-kimran@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:P7PaSxAXWk+9g0SrpfDPoiL/52k0Y5vrNyHGogIWkFaci6sRNVz CzCQ7CKJ5CV/v9PqnIdojnrDAUimPqAAejE3U6fzdfw2LBHjCV3dGHvJCrzXfcln+5K2911 jAQFTPUf7Yv+ejfUB7QJxKHhSldYTfFbio2detGAYbn826/5VBPy1lOW+r8GnllkyQlCkII OZpcKQ3nPoIEVK6ftmQjQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:mKXBPlftTgk=:tSyxU0U7QuGbBcOSNxmRsf FZU/lUq3mTZGF5ACilNOl5jdO8Ze6I1yC8IWNOIhEgsfHka8xTye9oJND+wZP98GNf82q5i3C lnnl87roz0rpe0t9l8diBSCsoQiOAww6vZz+Xwo6gSzeQWO51p0A/YOiVwLap7LeMd73p9jvW Vz1vg4CT00Ga/v/baYHyIeR5IdFhVDVcSJv4EJMEQpQfKa9xVuvowp5pRZE1gdEXKBQsmOL00 pC1WSg6OsBkKICBX9aX2eDAWJLpHosCqu21udRGHRqXdD3ZqlruIBarXVFm+AjjISlqGJblOY idIyrRTlOmHJ3oe7Z2l5SaBkbMMOSjbTanx69yZZD8w2gystSPuJiFejQoQOysdDDmy68mhd8 XdaPv/Vk1jB2fK+rNbD5uNBNSA9DWdVRL5Acep27oJDw1cwUePlFRHlOpmpH/POqGckGqdJod DltoZtMYGmgwfq5mwn2Ej+uXYpNw4Jc8WQmc1Iv+7KhSibRUv+k5cYMHRka3b1/gpqyAD71Nj LFqL63OrBmEhdpkhSCDxaX0Ga2t3KxciLgzvKwt4J5pRsTbchj56MS/8xkmyZtaJxF5Qe2GXP S656xNpL0Ei2g2yoKAeYdQR/5QrdOUzZJDRIh3ZybXyUxHmpuxmEh1l5DijMWxTu5ySB7z17o JpAxp5Nh1r0NSN7aDYx3Tq15sTvRs99uV0bYgCA8IAE75ndkwPC0UourlJX2xGNH5NHY2CKMU Sbk8jxO472OR3h8w Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2470 Lines: 97 On Thursday, October 20, 2016 7:36:22 PM CEST Imran Khan wrote: > +#include > +#include > + > +#include I don't see anything here that needs asm/system_misc.h > +const char *hw_platform[] = { > + [HW_PLATFORM_UNKNOWN] = "Unknown", > + [HW_PLATFORM_SURF] = "Surf", > + [HW_PLATFORM_FFA] = "FFA", > + [HW_PLATFORM_FLUID] = "Fluid", > +}; > + > +const char *qrd_hw_platform_subtype[] = { > + [PLATFORM_SUBTYPE_QRD] = "QRD", > + [PLATFORM_SUBTYPE_SKUAA] = "SKUAA", > +}; > + > +const char *hw_platform_subtype[] = { > + [PLATFORM_SUBTYPE_UNKNOWN] = "Unknown", > +}; Make these all static > + > +/* Used to parse shared memory. Must match the modem. */ > +struct socinfo_v0_1 { > + uint32_t format; > + uint32_t id; > + uint32_t version; s/uint32_t/u32/ > + > +uint32_t socinfo_get_id(void) > +{ > + return (socinfo) ? socinfo->v0_1.id : 0; > +} > +EXPORT_SYMBOL_GPL(socinfo_get_id); > + > +uint32_t socinfo_get_version(void) > +{ > + return (socinfo) ? socinfo->v0_1.version : 0; > +} > +EXPORT_SYMBOL_GPL(socinfo_get_version); > + > +char *socinfo_get_build_id(void) > +{ > + return (socinfo) ? socinfo->v0_1.build_id : NULL; > +} > +EXPORT_SYMBOL_GPL(socinfo_get_build_id); Please remove all the exports and mark the functions static, we don't want any drivers poking vendor-specific interfaces for this. > +/* socinfo: sysfs functions */ This seems overly verbose, having both raw and human-readable IDs is generally not necessary, pick one of the two. If you need any fields that we don't already support in soc_device, let's talk about adding them to the generic structure. > +static ssize_t > +qcom_get_image_version(struct device *dev, > + struct device_attribute *attr, > + char *buf) > +{ > + char *string_address; > + > + string_address = socinfo_get_image_version_base_address(dev); > + if (IS_ERR_OR_NULL(string_address)) { IS_ERR_OR_NULL() indicates that your interface is not well-designed. Please return either NULL on all failures, or return an error pointer on all failures, not both. > +/* Platform Subtype String is being deprecated. Use Platform > + * Subtype ID instead. > + */ If it's deprecated, don't add it to the kernel! > diff --git a/include/linux/soc/qcom/socinfo.h b/include/linux/soc/qcom/socinfo.h > new file mode 100644 > index 0000000..17ca50a > --- /dev/null > +++ b/include/linux/soc/qcom/socinfo.h Merge the header file into the driver. Arnd