From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6094C04A95 for ; Thu, 29 Sep 2022 00:51:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 43A4C84BE6; Thu, 29 Sep 2022 02:51:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="cVT2RZxd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A6E5D84BCD; Thu, 29 Sep 2022 02:51:55 +0200 (CEST) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3FB4583D1A for ; Thu, 29 Sep 2022 02:51:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x102d.google.com with SMTP id u12so5225765pjj.1 for ; Wed, 28 Sep 2022 17:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date; bh=XnugQznM56f5EUQffzRGO6dmQ8hKHgzm5DJqY7Pgk0k=; b=cVT2RZxdlM/lptpuZUExEgcjA2Ut2VusrMgbCKqeaY+uSK9kvSxSZNmNjnBrJqy4CG AaUn3lDTTyzJNiMF+oLdcWq3ccd+ABFSfUqiIIZHJLfZj3Hk6as8L+5lLpulCJZO8N5N 9ASJiOVxrGB/cB4LzY0jr02vLUszSMDUshsdQxhXRqDysONGkzs60E7vfY/DSGvppvWv 1y0R/FpVHrC8dTam1Gb+AmUJI0/+LKz9z4AwmWvIbKJQmk1DOha3+gnWFv34r3Sl8ukw +LTLn50jQwX+tUkLBqAG4SV/F0R2mnqx3ZyyNG6gHN0gRbCszzXylJiSlSs8iiFpbSQe LIag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=XnugQznM56f5EUQffzRGO6dmQ8hKHgzm5DJqY7Pgk0k=; b=ottfYJEzfvxPUaVNyjHMx+I00gDXArTBx5yX3N4bW6yGiSeaAodT4jJg/0BzbAlZP4 PL0JJYWd1LKcRFnDPfcN6SWuNqhDGhll1AZHtxwxqbkDPntm0uX1IGskOwOTLELeTeJc v62IAW4/hVoUhBrlAI7rChk1p7vq0a1Og5MG2sq68t/6asMOMNJJvexPFo5xiXN0U0Ot fLov6mN37lHjfZ97XdeGRyXBmI5Vy2iPpOMt+NUMNTmSrdDWD6C2g4hFAItE9ib5qeFK on5CTXI+pNGimFQrO5XJ9LGrax4hP7Wf4dEMH9Cjw/Vg84k006O0V66OlsaH9e8KU7VC F7vA== X-Gm-Message-State: ACrzQf3wAKXQ9CHWTnWeVjpIeG13SouXDM/h08UmbvIUTtM/OhFODMCw 6LJED08uCf+gaFw7AeSpkKjePw== X-Google-Smtp-Source: AMsMyM6pvLP+bRBYx4C6EnFccFfgxrefxjKeDi9JnnK95Yy5MMWFpASYtzIum/W8NFzDLwZZaeFPjg== X-Received: by 2002:a17:902:9881:b0:178:6506:bbf9 with SMTP id s1-20020a170902988100b001786506bbf9mr734977plp.80.1664412710206; Wed, 28 Sep 2022 17:51:50 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:f25b:6c23:7239:9200]) by smtp.gmail.com with ESMTPSA id bi5-20020a170902bf0500b00176cdd7e4c6sm4393951plb.50.2022.09.28.17.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 17:51:49 -0700 (PDT) Date: Thu, 29 Sep 2022 09:51:45 +0900 From: AKASHI Takahiro To: Simon Glass Cc: U-Boot Mailing List , Tom Rini , Heinrich Schuchardt , Marek Vasut , Masahisa Kojima , Pavel Herrmann Subject: Re: [PATCH 14/45] dm: blk: Add udevice functions Message-ID: <20220929005145.GA39264@laputa> Mail-Followup-To: AKASHI Takahiro , Simon Glass , U-Boot Mailing List , Tom Rini , Heinrich Schuchardt , Marek Vasut , Masahisa Kojima , Pavel Herrmann References: <20220925150248.2524421-1-sjg@chromium.org> <20220925150248.2524421-15-sjg@chromium.org> <20220926001728.GB7925@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Simon, On Wed, Sep 28, 2022 at 04:20:56AM -0600, Simon Glass wrote: > Hi Takahiro, > > On Sun, 25 Sept 2022 at 18:17, AKASHI Takahiro > wrote: > > > > Hi Simon, > > > > On Sun, Sep 25, 2022 at 09:02:17AM -0600, Simon Glass wrote: > > > At present we have functions called blk_dread(), etc., which take a > > > struct blk_desc * to refer to the block device. Add some functions which > > > use udevice instead, since this is more in keeping with how driver model > > > is supposed to work. > > > > Unfortunately, NAK. > > I have already added similar functions in disk/disk-uclass.c > > with my commit 59da9d4782cd ("dm: disk: add read/write interfaces with > > udevice"). dev_read()/dev_write() works well with UCLASS_BLK (as intended). > > > > I remember that you also ack'ed that patch. > > You have a better memory than me! > > How about we make those functions call my new ones? So do you want to have two distinct API's for BLK and PARTITION? You seem to have a policy that each DM class should have its own API's. I don't have a strong opinion here, but form user's point of view, block-level accessing has no difference between BLK and PARTITION. Most common users of such accessors are file systems. In stead of using the following code at every corner, cid = device_get_uclass_id(udev); if (cid == UCLASS_BLK) blk_read(udev, ...); else if (cid == UCLASS_PARTITION) disk_part(udev, ...); it may be more convenient to have a single API. > Also I think we should rename your functions to avoid using the > dev_read prefix, since this is for reading from the device tree. Okay. > Perhaps disk_read()? Also it seems that we could rationalise the code > between disk_read() and part_read() ? I'm not sure what you mean by "rationalise". > Also should have comments in the > header file about what the functions do (and what type of device they > accept). Yeah. -Takahiro Akashi > Regards, > Simon > [..]