Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp439841rdb; Tue, 16 Jan 2024 05:18:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyJCdEN8JWTonaeEqGKHkqqxrVWJ0Jm583OwUzlxWXuuKQaWO1Va0NVEOzkGUgMuQ0Tw4t X-Received: by 2002:a17:907:783:b0:a27:a977:9131 with SMTP id xd3-20020a170907078300b00a27a9779131mr4063921ejb.93.1705411127086; Tue, 16 Jan 2024 05:18:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705411127; cv=none; d=google.com; s=arc-20160816; b=L4cRIE3ArsDcojrJS+yiQlx2N9nSaBIaKZnmmJw5gRUmJI2uuxTTFW8cylI9gmSykH jp746DmmT1AGha6mVzZgRr0VCOXem7EHpB38hn1Hl9gHNXl7s7D98m0Dj87lBj3YhwKG utr29W7NHW8en6aPu4Sv6WCgNi3hWqBKHN4/8UIxsLQnOcSDdSXfsYzdUkRTL69ZxYvZ ha52POJIZb76JPY8jEsS7Iu8pr/X/QqHhBjOwb08sNAi4SgGyY2odFDD5L4Kfw5p1YsN gDuv/pFCtnZapxLiozOKxZejUNr0TxoecJ7HJQ8oRl4/ecTyJN1miKKfshIdgtscUnKx Carw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ej944qWFIi9COYJbBb09o9QKP8cZyiOYwsc2orhfIt4=; fh=RouZzNPg5kuRfMsQCccMQ0o01MUhMNJPBHzwNj2TTuk=; b=H9xJcP04RJDZx/fIPr9KJNe6sf9ap+jkOHhf9GEWw8Pttntygi56bsv3H57FCAbUn5 zSFBcDOCTt+TYwDzRBVSgWV9X7GYLrehZvg6RI9NwYg0ZsV4AgtFwJR0GNCTQn4sfLtA iw56Rz+VMEIeQ8zOyu+158Cx3LtAltASsSXLAV49wuIU8sl3gQbhk2FAeqToWz3lbowN EboPF0lx6pgLF4n+HPODGHr6BT/5hCdWA+yMcy/X34Rtnfp1cl0qXqew5+DY/JA+fXfG lXPQ3AXssG20gxKUnkzO69PCvaNuk8ZQVtWmCBETTZpKtC6MezXU1Tp4Zdyt6NQy14Ai 1X8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=m8HblPnD; spf=pass (google.com: domain of linux-kernel+bounces-27411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id jr12-20020a170906a98c00b00a2c5bf4f801si4707674ejb.872.2024.01.16.05.18.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 05:18:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=m8HblPnD; spf=pass (google.com: domain of linux-kernel+bounces-27411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C9E6E1F24DFD for ; Tue, 16 Jan 2024 13:18:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFF391BDC4; Tue, 16 Jan 2024 13:18:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="m8HblPnD" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 040D31BC47; Tue, 16 Jan 2024 13:18:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=ej944qWFIi9COYJbBb09o9QKP8cZyiOYwsc2orhfIt4=; b=m8HblPnDO5qXLUMnufSJwanb4X F3UWBnF9h5JHQPP6F2CVRMfVGd1oUv+3UTePhOAYP6ijcN/Ososc7qvjsV96EJyuybBb41vV4RN/W YTsYGrpry9JlBgTaTzCcGdl9oYsjsebtXRIcsqCtq6b61DufTx9LVzNB+id/fg2RFOug=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rPjKO-005JiB-Id; Tue, 16 Jan 2024 14:18:04 +0100 Date: Tue, 16 Jan 2024 14:18:04 +0100 From: Andrew Lunn To: =?iso-8859-1?Q?K=F6ry?= Maincent Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Luis Chamberlain , Russ Weight , Greg Kroah-Hartman , "Rafael J. Wysocki" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Oleksij Rempel , Thomas Petazzoni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, devicetree@vger.kernel.org, Dent Project Subject: Re: [PATCH net-next v2 8/8] net: pse-pd: Add PD692x0 PSE controller driver Message-ID: <64f30166-58cc-409d-ba5b-9ea3fb8ead88@lunn.ch> References: <20231201-feature_poe-v2-0-56d8cac607fa@bootlin.com> <20231201-feature_poe-v2-8-56d8cac607fa@bootlin.com> <639c5222-043f-4e27-9efa-ce2a1d73eaba@lunn.ch> <20240116104949.12708cd5@kmaincent-XPS-13-7390> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240116104949.12708cd5@kmaincent-XPS-13-7390> > > > > +static int pd692x0_fw_get_next_line(const u8 *data, > > > + char *line, size_t size) > > > +{ > > > + size_t line_size; > > > + int i; > > > + > > > + line_size = min_t(size_t, size, (size_t)PD692X0_FW_LINE_MAX_SZ); > > > + > > > + memset(line, 0, PD692X0_FW_LINE_MAX_SZ); > > > + for (i = 0; i < line_size - 1; i++) { > > > + if (*data == '\r' && *(data + 1) == '\n') { > > > + line[i] = '\r'; > > > + line[i + 1] = '\n'; > > > + return i + 2; > > > + } > > > > Does the Vendor Documentation indicate Windoze line endings will > > always be used? Motorola SREC allow both Windows or rest of the world > > line endings to be used. > > All the firmware lines end with "\r\n" but indeed it is not specifically > written that the firmware content would follow this. IMHO it is implicit that > it would be the case as all i2c messages use this line termination. > Do you prefer that I add support to the world line endings possibility? No need, just hack an SREC file, and test the parser does not explode with an opps, and you get an sensible error message about the firmware being corrupt. I would not be too surprised if there are some mail systems still out there which might convert the line ending. > > > +static enum fw_upload_err pd692x0_fw_poll_complete(struct fw_upload *fwl) > > > +{ > > > + struct pd692x0_priv *priv = fwl->dd_handle; > > > + const struct i2c_client *client = priv->client; > > > + struct pd692x0_msg_ver ver; > > > + int ret; > > > + > > > + priv->fw_state = PD692X0_FW_COMPLETE; > > > + > > > + ret = pd692x0_fw_reset(client); > > > + if (ret) > > > + return ret; > > > + > > > + ver = pd692x0_get_sw_version(priv); > > > + if (ver.maj_sw_ver != PD692X0_FW_MAJ_VER) { > > > > That is probably too strong a condition. You need to allow firmware > > upgrades, etc. Does it need to be an exact match, or would < be > > enough? > > The major version is not compatible with the last one, the i2c messages > content changed. I supposed a change in major version would imply a change in > the i2c messages content and would need a driver update that's why I used this > strong condition. Do you know the next major version will change the message contents? Is this documented somewhere? If so add a comment. Otherwise, i would allow higher major versions. When the vendor breaks backwards compatibility, its going to need code changes anyway, and at that point the test can be made more strict. We try to make vendors not make firmware ABI breaking changes, and we have pushed back against a number of vendors who do. So i think its best we assume they won't break the ABI. Andrew