Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp703550rwb; Fri, 23 Sep 2022 03:01:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57+OJ7B9MV+ftiUNPtDFDAiRmg7sldvTiCDENvldlp7M1a717uYB6ZIddgqV2b3wRcRX+e X-Received: by 2002:a17:902:ce8f:b0:176:e0b3:cf14 with SMTP id f15-20020a170902ce8f00b00176e0b3cf14mr7591762plg.153.1663927286365; Fri, 23 Sep 2022 03:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663927286; cv=none; d=google.com; s=arc-20160816; b=zhgbtteHo/1kfiMvN80n9EWKrtqnA7VIwIeaDPgIxOrmwIKx6iFXopv3HSvQzgBi1f 1wolbul5mGqphF47a23rdsbrJxbpSxOODLIA5+OfiLK3qfHJO3IZuGkoaOEaM3hAXBFE VgaT7+9X1v3r6qRSdbmskZtAD6zNy8lPdXvdTmHzSqhS2btQw7Uuft/t7Hu/kmtPcgOp DQeQWuYDGOcoRNOJ3dnCexVOUHsTaCBsNM2YKJi7jnYI3FuAOq2s4p3vVB+3mqv//bM4 tIr6ccpJVeiN4M7phTyVabeVmWVgAAtwsx3p2jVtLk/llmZhNu/3dOY96IqwniA6dX3R Rg0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:message-id :references:in-reply-to:cc:to:from:date:mime-version:dkim-signature; bh=Pyy6eEQGqm5x0ptRrX3qFJPlzABRUcd93BdxWTrxRAc=; b=cyRdoA3J6xO6ZCedPvVyAVPbWgIW7CaBJfk5bI+qV2c7N3Qp+fa7o7BQ2YKuj8EiNf acdfa5m3cUhhhZVXkqSLIt8cAIt3MhNdlBRVCcdZGpMBij2wL2/9XfL11pMG5kumPh9h yMx9/HR+BBqCTwSzP05srz2Dm9drd4g7gJ+vK3xwwfyhmn8VCJOy8sZepglS6PHdHy+x ZLTjFcb58z6QXQyoskKadzJpOWLcqq8ck1i7MT9JVoxnCGr9bfzzf2tufS7oc7i751le nYewdLlNLdaqfNbXLJBAXGR38Ha5eWpdJSZVHF+fUHjNVOxGPsW2K3rlMkZ3tiQRHAqY k/rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ext.kapsi.fi header.s=20161220 header.b=tqZuE5xc; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kapsi.fi Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a63200a000000b0042ad0333df1si3079430pgg.479.2022.09.23.03.01.14; Fri, 23 Sep 2022 03:01:26 -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=fail header.i=@ext.kapsi.fi header.s=20161220 header.b=tqZuE5xc; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kapsi.fi Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229688AbiIWJNw (ORCPT + 99 others); Fri, 23 Sep 2022 05:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbiIWJNj (ORCPT ); Fri, 23 Sep 2022 05:13:39 -0400 Received: from mailserv1.kapsi.fi (mailserv1.kapsi.fi [IPv6:2001:67c:1be8::25:1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 606CC11DFF0; Fri, 23 Sep 2022 02:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ext.kapsi.fi; s=20161220; h=Subject:Content-Transfer-Encoding:Content-Type: Message-ID:References:In-Reply-To:Cc:To:From:Date:MIME-Version:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Pyy6eEQGqm5x0ptRrX3qFJPlzABRUcd93BdxWTrxRAc=; b=tqZuE5xcs/KT9n15zbg5lQSuYP 6Y4ZugPX+vbHS6E5JQyJ7RZExVY1fjZCsX5gA5C2Br0voZuyv2uYsymAElmESaPnylEVbdNh45n8Q sWhFUUcHhO0rOS6sz1VQawNnAs/yK6w5/+ML23GK/h9/xHLV6EJ97lRMXXTmB0v3nyA4OPE4GLkNV tBPuYsANvbkyRsL4n8TDuheqBEFxgyUwf+eZRs2U7ilKTjzlZ6h003zrmTogWtFyTjNu1ESW6yTsi HBGTrOkjNeBmCHvBExFDB13YLXpfW7rVyG1C2ptEOPCUj/8C6tf6d9NrgABPWoRnFyK78k+slojyt +ge9Sfag==; Received: from [2001:67c:1be8::200] (port=34582 helo=roundcube.kapsi.fi) by mailserv1.kapsi.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1obekO-009CI2-Mv; Fri, 23 Sep 2022 12:13:25 +0300 MIME-Version: 1.0 Date: Fri, 23 Sep 2022 12:13:24 +0300 From: maukka@ext.kapsi.fi To: Arnd Bergmann Cc: Rob Herring , krzysztof.kozlowski+dt@linaro.org, Olof Johansson , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Russell King , =?UTF-8?Q?Pali_Roh=C3=A1r?= , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org In-Reply-To: <89f85393-c767-4c0c-90db-d78a2927d465@www.fastmail.com> References: <20220427162123.110458-1-maukka@ext.kapsi.fi> <20220922202458.7592-1-maukka@ext.kapsi.fi> <20220922202458.7592-4-maukka@ext.kapsi.fi> <89f85393-c767-4c0c-90db-d78a2927d465@www.fastmail.com> Message-ID: X-Sender: maukka@ext.kapsi.fi Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:1be8::200 X-SA-Exim-Mail-From: maukka@ext.kapsi.fi X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Subject: Re: [PATCH v2 3/3] ARM: orion5x: Add D-Link DNS-323 based on Device Tree X-SA-Exim-Version: 4.2.1 (built Sat, 13 Feb 2021 17:57:42 +0000) X-SA-Exim-Scanned: Yes (on mailserv1.kapsi.fi) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23.9.2022 00:39, Arnd Bergmann wrote: > On Thu, Sep 22, 2022, at 10:24 PM, Mauri Sandberg wrote: >> + >> +/* dns323_parse_hex_*() taken from tsx09-common.c; should a common >> copy of these >> + * functions be kept somewhere? >> + */ >> +static int __init dns323_parse_hex_nibble(char n) >> +{ >> + if (n >= '0' && n <= '9') >> + return n - '0'; >> + >> + if (n >= 'A' && n <= 'F') >> + return n - 'A' + 10; >> + >> + if (n >= 'a' && n <= 'f') >> + return n - 'a' + 10; >> + >> + return -1; >> +} >> + >> +static int __init dns323_parse_hex_byte(const char *b) >> +{ >> + int hi; >> + int lo; >> + >> + hi = dns323_parse_hex_nibble(b[0]); >> + lo = dns323_parse_hex_nibble(b[1]); >> + >> + if (hi < 0 || lo < 0) >> + return -1; >> + >> + return (hi << 4) | lo; >> +} >> + > > Can you use simple_strntoull() to parse the address into a u64 instead? > Nice idea. Its current replacement seems to be kstrtoull(). I'll have to do it byte by byte, right? Or what do you have in mind with 64bit unsigned? >> +static int __init dns323_read_mac_addr(u8 *addr) >> +{ >> + int i; >> + char *mac_page; >> + >> + /* MAC address is stored as a regular ol' string in /dev/mtdblock4 >> + * (0x007d0000-0x00800000) starting at offset 196480 (0x2ff80). >> + */ >> + mac_page = ioremap(DNS323_NOR_BOOT_BASE + 0x7d0000 + 196480, 1024); >> + if (!mac_page) >> + return -ENOMEM; > > It would be nicer to use of_iomap() on the nor device than a > hardcoded physical address here, at least if that doesn't add > too much extra complexity. > I'll look into this.