Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2618363pxb; Sun, 17 Oct 2021 20:40:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVPjWWH5gunGXe3CwrRPpdklQ6rC0LzOvOY4rYjj7X50+NVdN3OIoOcYjDRPzxrrsrVZXV X-Received: by 2002:a17:902:a50f:b029:11a:b033:e158 with SMTP id s15-20020a170902a50fb029011ab033e158mr24972793plq.26.1634528431089; Sun, 17 Oct 2021 20:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528431; cv=none; d=google.com; s=arc-20160816; b=QZNs6gvETlsvtEh6MZgH9DZo8kT24CIIWm6AdT38qX1FX1JmhZbrvv7Vg5eXLq+R+A Fbev647uoHYi3M3HvsjMEGrhTCOugnK/+yQ2r783vv6Aa94GJjYez4PYuSYrntIEqG8S re6+UM5i0ZC35dDgMSTsoq9zmCvWMvsWOwwYL27ivs5Q9rrWNy1uNjuBpaDLWjrXT4bI SgUFhK6WRjaRxO4XtOEJUS+0AK0DCv8JeiKMkcK3PztjuKH8vF5jX6JxFCAEWFkvJS3f Uq3ePCjRFwQdxzp5YLQ7HH45eB2ceAhDZ/Q83iTn4zVFFIftnQjLfZl4GyIsLCf/LxAt A/Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=grY3puXHdNB4ov/AfWAyem+7xTbcTzXFJwCaoF2GCUo=; b=YV0GobG6DZE4wxFgykOvV3Qc9ZFZ3OyP3+lc4/S+1ImVBfDMmDVMloKV3UO1D+LS6R vBfUYPURB8pDvy9zjTOLnCHVZpAXyJsi2PFv05+e8+TeyiqEvttfJxEKDQBkSndhYg1S UnixmXb3aIyiHSXVPaQGGu9/zuhgGVe5H1DhTJ9ndltzGliZdaKpu8lwjrsqeZrjyGPP p3rYToz3ZExOwzaSA6X+LlUJfjwONcbk1T8ihlaRHuozFqWEf5HqWdGwHf3qV0qo7wnn oLG4If15y1gXzhJQT0KA2+RCyHlRkYJdcQ+H5IwefcTGbX+Lv7rVuBhHME/X0QUtynUu q89Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pd+b7WPW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mq9si3725509pjb.75.2021.10.17.20.40.17; Sun, 17 Oct 2021 20:40:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pd+b7WPW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245024AbhJQHJi (ORCPT + 98 others); Sun, 17 Oct 2021 03:09:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:53410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233513AbhJQHJg (ORCPT ); Sun, 17 Oct 2021 03:09:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 55AEC60F23; Sun, 17 Oct 2021 07:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634454446; bh=uYrWYaNw+y04uyy1r1WLDgEiohtXcV0xRVaH9SH36H8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pd+b7WPWC6Eiej0nXxGyYVBEice/PLIcKYMLjtynosoywSbXMLRsWbl6HWNHiNwi2 NpLiqzPolVambyF+cY9V9DMKZKtDfwhS/s8ySxAOkou1wEQv8z/LbvqkZ/O5oYYVD7 255x+RRnHJIf84i4E9yRr6vOOoCN0tVbHaRbbQ+0= Date: Sun, 17 Oct 2021 09:07:18 +0200 From: Greg KH To: Manivannan Sadhasivam Cc: Manivannan Sadhasivam , hemantk@codeaurora.org, bbhatt@codeaurora.org, loic.poulain@linaro.org, wangqing@vivo.com, mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Kicinski Subject: Re: [PATCH 2/3] bus: mhi: Add inbound buffers allocation flag Message-ID: References: <20211016065734.28802-1-manivannan.sadhasivam@linaro.org> <20211016065734.28802-3-manivannan.sadhasivam@linaro.org> <20211016163128.GC4048@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211016163128.GC4048@thinkpad> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 16, 2021 at 10:01:28PM +0530, Manivannan Sadhasivam wrote: > On Sat, Oct 16, 2021 at 09:39:53AM +0200, Greg KH wrote: > > On Sat, Oct 16, 2021 at 12:27:33PM +0530, Manivannan Sadhasivam wrote: > > > From: Loic Poulain > > > > > > Currently, the MHI controller driver defines which channels should > > > have their inbound buffers allocated and queued. But ideally, this is > > > something that should be decided by the MHI device driver instead, > > > which actually deals with that buffers. > > > > > > Add a flag parameter to mhi_prepare_for_transfer allowing to specify > > > if buffers have to be allocated and queued by the MHI stack. > > > > This is a horrible api. Now one has to go and look up why "0" was added > > to a function as a parameter. > > > > If you don't want to allocate the buffer, then make a function of that > > name and call that. As you only have one "flag", don't try to make > > something generic here that is obviously not generic at all. > > > > This is the only API that can be used by the client drivers to pass the > configurations to the MHI stack. So we wanted to have a flags parameter that > could be extended in the future also. Worry about future issues then, in the future :) > Regarding "0", the default behaviour is to not pre allocate the buffer at all. > So it made less sense to add a separate flag or an API for that. But again, this is now hard to understand and if you run across a '0' in the call, you have to go and look it up, breaking your reading flow. Please just create a new function for this new option, and then have both of them call the common function with a boolean for this "allocate or not" type of thing. We do this all the time in the kernel to make it easier to read and understand over time. thanks, greg k-h