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 A5264C04A95 for ; Thu, 29 Sep 2022 02:36:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7276684BEF; Thu, 29 Sep 2022 04:36:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="byDmB+0q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BB9E78456E; Thu, 29 Sep 2022 04:36:13 +0200 (CEST) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) (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 C924E84BE4 for ; Thu, 29 Sep 2022 04:36:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-wm1-x32e.google.com with SMTP id i203-20020a1c3bd4000000b003b3df9a5ecbso2400755wma.1 for ; Wed, 28 Sep 2022 19:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date; bh=WzrAWoRXpZDhNkm6eVPsRPZ5WCxq33wXQlRfVB5gXds=; b=byDmB+0qZuQJcZWHv9C8H88gKBhg/pPDomHtm6qNakHwTipRJN5Ayd7M8HHIeOQv2L Y9HyQA1jnbCRbtR1pcJOD9wE3Enng9pKLCozruAm39Nw9sBlaQ5ZdenKSA9cA1odwzWz 90f0hJl+dYa89IbmHYnNmvaLByq4mmG6rsth4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date; bh=WzrAWoRXpZDhNkm6eVPsRPZ5WCxq33wXQlRfVB5gXds=; b=ZSQEe62vheh0bKMBneAjdG3ZnqDaKQ9NhRwD+dXqYT7+rSqP9e8urK4Eys/Oh4NUNd cWqTWjyuXXHmZw1dBM7V0pNTDzRe7a+jNTEcDwB09QConj7v/ORg+pCZ6KDwYW4gbHwG pTs8rMt/hkCN/kuojwEkWZa3JEAPi1hV5yqeihGmo9ttU8Q9v9+Lw7HEhA4toT7t3JTX bAJuwnIhdPKyEEYR/OH8eIYNVO+OTKwrqBqaKJX8TYJPcBIzzOt1akk2G+t5NpxGnxOO V6wXc+LapSikhyXabkBfL7sOkuzEhQKkjOLV3f2l8qInQRbFIkqUnr9D6ORtd3RPwSt0 nOlw== X-Gm-Message-State: ACrzQf1i34wBDPJ7abhA3szCD5kXbtuqVGNqQJ/ncGgvs0vFGt1TBOB9 5ZTZk3BKLoGpX54+CzV1zjV2eELHvTPM95EiWdNqqg== X-Google-Smtp-Source: AMsMyM6ifzcDUDNVNuO+iunTxQqLc4BwdX6jqAZBictskfDlWYeFlOSz+0BuV2+WIQK651kvRM44pgwI2RAYsJvp9cU= X-Received: by 2002:a7b:cc99:0:b0:3b4:76f2:192b with SMTP id p25-20020a7bcc99000000b003b476f2192bmr9098782wma.138.1664418969998; Wed, 28 Sep 2022 19:36:09 -0700 (PDT) MIME-Version: 1.0 References: <20220925150248.2524421-1-sjg@chromium.org> <20220925150248.2524421-15-sjg@chromium.org> <20220926001728.GB7925@laputa> <20220929005145.GA39264@laputa> In-Reply-To: <20220929005145.GA39264@laputa> From: Simon Glass Date: Wed, 28 Sep 2022 20:35:58 -0600 Message-ID: Subject: Re: [PATCH 14/45] dm: blk: Add udevice functions To: AKASHI Takahiro , Simon Glass , U-Boot Mailing List , Tom Rini , Heinrich Schuchardt , Marek Vasut , Masahisa Kojima , Pavel Herrmann Content-Type: text/plain; charset="UTF-8" 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 Takahiro, On Wed, 28 Sept 2022 at 18:51, AKASHI Takahiro wrote: > > 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. Yes that's right. > > 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. Yes I agree, but you already have that with your dev_read() API. I just want to rename it a bit. > > > 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". The code seems to be almost the same between the two so I think it may be possible to move the common code into a shared function. > > > Also should have comments in the > > header file about what the functions do (and what type of device they > > accept). > > Yeah. Regards, Simon