Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp361315rdb; Thu, 30 Nov 2023 06:52:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNdCseEt46OnAn25MUAo58IRM+Vs09r1C3fPTVSJ1B4yL9S7z1tgd+zZ8UUdN84AO3H9Fx X-Received: by 2002:a05:6a00:9384:b0:6cd:dfae:1b44 with SMTP id ka4-20020a056a00938400b006cddfae1b44mr4199766pfb.34.1701355948390; Thu, 30 Nov 2023 06:52:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701355948; cv=none; d=google.com; s=arc-20160816; b=VdQqWuHEmE5llkM06JqEsuMCsW0XzA7ZiPJQNw3BC7oa6QNne57178qdIqyqkERzsS +t14AZv22XPjDYtfcaNMk05i+X4zc/xIBYfnOAyEwmpOF4bjSNAu4ZeZA2SkbFPzG2iY Eg6mvZZalumYNkTUXmNP22CMaqRCHIgngjZila1MaOEYQDC+8AyZGknfIOyP8bcwnQ1R 5LwA+tooz8GZmJmwja1/yz3PvE1zKPH/B8QkDz2dYi58IMwbJeEYkdaPGmlh0W8HYFr6 KV7RFhnyam/VctCR6jmjdBVGQIHnQAw6SAwTjE91eoM9uj3iTgLse2tcR2zGdQ/nVr2p cysQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=oZ2UtLj8qXOKprA0xLNlgK6rXZsWDzjXudliiLAVLwU=; fh=N+YoLK3+cCjAN2miRvbfGaFudyq9rYOL5KcH6zavzWI=; b=qjASt63zxU7aRbED1rZEArxzvmMU1kLEGuiCzOPYJI0VoSQvXMdJnN1qjHG7ODePRI dEZWfMO0GSzSzLMf5v7VoSKgLGWe0o38KaJUp4qn1TBBREqxvGSCG/WuSp1fWVZiJsBD Zuh/f8yeYh75LJEjt8qHA5CNTTn2XYFoHDbWyua1fxA6DUCfDg8PXwTzlaoaW9RUi5hc Gh7/uJwsQOXQxCwjUttk4XfMOCM5iJBuqYJ3OufGTYWxJq9vYMA/1fiwXCrtLcUMRCF2 XE/NbFdkPY1ouNp3M8aF7nZ+0qdWnNrC3SY1S6ypiILqJtE738P2+h/krBxCpG2FNdeb +KzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d20-20020a056a00199400b006cbf70da0bbsi1447539pfl.54.2023.11.30.06.52.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 06:52:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 13A4E80CC11C; Thu, 30 Nov 2023 06:52:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346043AbjK3OwM convert rfc822-to-8bit (ORCPT + 99 others); Thu, 30 Nov 2023 09:52:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbjK3OwL (ORCPT ); Thu, 30 Nov 2023 09:52:11 -0500 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F94F133 for ; Thu, 30 Nov 2023 06:52:17 -0800 (PST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-167-ehzvvOoBOZGyvf_gdvKpVw-1; Thu, 30 Nov 2023 14:52:14 +0000 X-MC-Unique: ehzvvOoBOZGyvf_gdvKpVw-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 30 Nov 2023 14:52:11 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Thu, 30 Nov 2023 14:52:11 +0000 From: David Laight To: "'marc.ferland@gmail.com'" , "krzysztof.kozlowski@linaro.org" CC: "gregkh@linuxfoundation.org" , "marc.ferland@sonatest.com" , "jeff.dagenais@gmail.com" , "rdunlap@infradead.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v3 4/5] w1: ds2433: use the kernel bitmap implementation Thread-Topic: [PATCH v3 4/5] w1: ds2433: use the kernel bitmap implementation Thread-Index: AQHaI5Se1RHZ/iJZnUSiQqCBTHupzLCS8aAQ Date: Thu, 30 Nov 2023 14:52:10 +0000 Message-ID: References: <20231130135232.191320-1-marc.ferland@sonatest.com> <20231130135232.191320-5-marc.ferland@sonatest.com> In-Reply-To: <20231130135232.191320-5-marc.ferland@sonatest.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 30 Nov 2023 06:52:26 -0800 (PST) From: marc.ferland@gmail.com > Sent: 30 November 2023 13:53 > > The ds2433 driver uses the 'validcrc' variable to mark out which pages > have been successfully (crc is valid) retrieved from the eeprom and > placed in the internal 'memory' buffer (see CONFIG_W1_SLAVE_DS2433_CRC). > > The current implementation assumes that the number of pages will never > go beyond 32 pages (bit field is a u32). This is fine for the ds2433 > since it only has 16 pages. > > Use a dynamically allocated bitmap so that we can support eeproms with > more than 32 pages which is the case for the ds28ec20 (80 pages). Dynamically allocating seems excessive. Why not just make the maximum a compile-time constant (say 96 or 128) and just check that the actual size isn't too big. > As an added bonus, the code also gets easier on the eye. and slower :-) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)