Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1649822ybl; Sat, 25 Jan 2020 05:30:37 -0800 (PST) X-Google-Smtp-Source: APXvYqxCkyofumH4Cf/W3/+eU1ekYQauTI/6ca+M+FsMFwzffb/+l5V/+dc0ABv0kCIL7c5675bF X-Received: by 2002:a05:6808:9a4:: with SMTP id e4mr2417880oig.127.1579959037513; Sat, 25 Jan 2020 05:30:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579959037; cv=none; d=google.com; s=arc-20160816; b=yoww2EAethvwj3kHsCE6/AprftEOa/5xggz04UMUJZAQbzKbQlRpw4s5L6k1eq3PLk 17Z2uvHGKDBjTw1gF8kNoMH+N/NGFJmTac96woJGgA/yfu5SrtM/lfArad/7cgcP6AxD 5O+17GTdLdbnMTAESj0KQ9pLCBKQfTpxov0RFwDpJ2eSlPq34olBd7OZauOAKmv73rUJ rzr3gOndWAFJ8RPPwK3l4Qmr2JPTyt6ibc+5noBIiDXwp1HX9Zjjh82omdzEmoNAeQVC WZ2YntFDhRZq3joo3/KFBDOzd5t+B5BAs0pbnisfSLcKZUqn3XS2vQCQLGxYoCoz4rZL O1hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=XmuGVhIhCBGCYY7LYMKgzmslk7JFICrARoVn7s4AP70=; b=oGRjmm1iML9Ct69BVCpmb7p0/Y/zV7+bEfDyzgko7OgJgblEuFDvGTiGQxBj4IRWbM uQtJGNij1bVdjU82AtTUbEIAcYkPZ1Zxc6pD1i6lNVxZOBY7LsI400RdqtmB5wDIlK6a xi6ututn0iMncppf8kWRX13XDbSi6W8D0+zGjMVXN7jDKxIcIH/leheYOMAlIn4KPVeC 5W6GPonolViwdPUn9Yq+HyvTzNfFm/D52+qAJOAmuTbZHflYih2B1wDKrrTSiV6HjYVm OfvfJHewtNl4DQWh7YL9fxgpWmfosHB/nEZhWjR9+TQekIvSvCFBi97nYHgc6erotOTH GWeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="B33H/q9u"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si1240039oij.139.2020.01.25.05.30.25; Sat, 25 Jan 2020 05:30:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="B33H/q9u"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbgAYN3c (ORCPT + 99 others); Sat, 25 Jan 2020 08:29:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:40316 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgAYN3b (ORCPT ); Sat, 25 Jan 2020 08:29:31 -0500 Received: from localhost (unknown [145.15.244.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 484E2206F0; Sat, 25 Jan 2020 13:29:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579958971; bh=ZlARgGBv0efHgDPaj5HZbh4hEPn9xIvhPiiZnur8dEI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=B33H/q9u6nNS8fgmrR+xa9fC0LuzjgUzLU49IWbQm3xmL5ZpLOuYL7uWBgZ5iCAHn uNj2zoQd0jfz/sHHeNYBl4TRRRYykecoTvtmTT/foX9/2XHuIsoUPGLexAq/+vWD1k AbZp4FkwgfWJotDe6rziQVLRSOH6S/LE2zrYOaMM= Date: Sat, 25 Jan 2020 14:26:15 +0100 From: Greg KH To: Jeffrey Hugo Cc: Manivannan Sadhasivam , arnd@arndb.de, smohanad@codeaurora.org, kvalo@codeaurora.org, bjorn.andersson@linaro.org, hemantk@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 02/16] bus: mhi: core: Add support for registering MHI controllers Message-ID: <20200125132615.GA3516435@kroah.com> References: <20200123111836.7414-1-manivannan.sadhasivam@linaro.org> <20200123111836.7414-3-manivannan.sadhasivam@linaro.org> <20200124082939.GA2921617@kroah.com> <42c79181-9d97-3542-c6b0-1e37f9b2ff39@codeaurora.org> <20200124174707.GB3417153@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 24, 2020 at 11:12:57AM -0700, Jeffrey Hugo wrote: > On 1/24/2020 10:47 AM, Greg KH wrote: > > On Fri, Jan 24, 2020 at 07:24:43AM -0700, Jeffrey Hugo wrote: > > > > > +/** > > > > > + * struct mhi_result - Completed buffer information > > > > > + * @buf_addr: Address of data buffer > > > > > + * @dir: Channel direction > > > > > + * @bytes_xfer: # of bytes transferred > > > > > + * @transaction_status: Status of last transaction > > > > > + */ > > > > > +struct mhi_result { > > > > > + void *buf_addr; > > > > > > > > Why void *? > > > > > > Because its not possible to resolve this more clearly. The client provides > > > the buffer and knows what the structure is. The bus does not. Its just an > > > opaque pointer (hence void *) to the bus, and the client needs to decode it. > > > This is the struct that is handed to the client to allow them to decode the > > > activity (either a received buf, or a confirmation that a transmitted buf > > > has been consumed). > > > > Then shouldn't this be a "u8 *" instead as you are saying how many bytes > > are here? > > I'm sorry, I don't see the benefit of that. Can you elaborate on why you > think that u8 * is a better type? > > Sure, its an arbitrary byte stream from the perspective of the bus, but to > the client, 99% of the time its going to have some structure. So which side is in control here, the "bus" or the "client"? For the bus to care, it's a bytestream and should be represented as such (like you have) with a number of bytes in the "packet". If you already know the structure types, just make a union of all of the valid ones and be done with it. In other words, try to avoid using void * as much as is ever possible please. thanks, greg k-h