All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: lukma@denx.de, peng.fan@nxp.com, jh80.chung@samsung.com,
	bmeng.cn@gmail.com, peng.ma@nxp.com, sr@denx.de,
	xypron.glpk@gmx.de, sjg@chromium.org,
	ilias.apalodimas@linaro.org
Cc: masami.hiramatsu@linaro.org, u-boot@lists.denx.de,
	AKASHI Takahiro <takahiro.akashi@linaro.org>
Subject: [PATCH 05/19] sata: call device_probe() after scanning
Date: Wed,  2 Feb 2022 10:08:39 +0900	[thread overview]
Message-ID: <20220202010853.40405-6-takahiro.akashi@linaro.org> (raw)
In-Reply-To: <20220202010853.40405-1-takahiro.akashi@linaro.org>

Every time a sata bus/port is scanned and a new device is detected,
we want to call device_probe() as it will give us a chance to run
additional post-processings for some purposes.

In particular, support for creating partitions on a device will be added.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
 drivers/ata/dwc_ahsata.c |  5 +++++
 drivers/ata/fsl_sata.c   | 11 +++++++++++
 drivers/ata/sata_mv.c    |  5 +++++
 drivers/ata/sata_sil.c   | 12 ++++++++++++
 4 files changed, 33 insertions(+)

diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c
index 6d42548087b3..d9fd850c6fae 100644
--- a/drivers/ata/dwc_ahsata.c
+++ b/drivers/ata/dwc_ahsata.c
@@ -1026,6 +1026,11 @@ int dwc_ahsata_scan(struct udevice *dev)
 		return ret;
 	}
 
+	ret = blk_probe_or_unbind(dev);
+	if (ret < 0)
+		/* TODO: undo create */
+		return ret;
+
 	return 0;
 }
 
diff --git a/drivers/ata/fsl_sata.c b/drivers/ata/fsl_sata.c
index e44db0a37458..346e9298b4c5 100644
--- a/drivers/ata/fsl_sata.c
+++ b/drivers/ata/fsl_sata.c
@@ -982,6 +982,17 @@ static int fsl_ata_probe(struct udevice *dev)
 			failed_number++;
 			continue;
 		}
+
+		ret = device_probe(bdev);
+		if (ret < 0) {
+			debug("Can't probe\n");
+			ret = fsl_unbind_device(blk);
+			if (ret)
+				return ret;
+
+			failed_number++;
+			continue;
+		}
 	}
 
 	if (failed_number == nr_ports)
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 003222d47be6..60666d551434 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1099,6 +1099,11 @@ static int sata_mv_probe(struct udevice *dev)
 			continue;
 		}
 
+		ret = blk_probe_or_unbind(bdev);
+		if (ret < 0)
+			/* TODO: undo create */
+			continue;
+
 		/* If we got here, the current SATA port was probed
 		 * successfully, so set the probe status to successful.
 		 */
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index dda712f42cb2..295f7ca72303 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -864,6 +864,18 @@ static int sil_pci_probe(struct udevice *dev)
 			failed_number++;
 			continue;
 		}
+
+		ret = device_probe(bdev);
+		if (ret < 0) {
+			debug("Can't probe\n");
+			ret = sil_unbind_device(blk);
+			device_unbind(bdev);
+			if (ret)
+				return ret;
+
+			failed_number++;
+			continue;
+		}
 	}
 
 	if (failed_number == sata_info.maxport)
-- 
2.33.0


  parent reply	other threads:[~2022-02-02  1:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-02  1:08 [PATCH 00/19] efi_loader: more tightly integrate UEFI disks to driver model AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 01/19] scsi: call device_probe() after scanning AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 02/19] usb: storage: " AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 03/19] mmc: " AKASHI Takahiro
2022-02-08 23:46   ` Jaehoon Chung
2022-02-10  3:45     ` AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 04/19] nvme: " AKASHI Takahiro
2022-02-02  1:08 ` AKASHI Takahiro [this message]
2022-02-02  1:08 ` [PATCH 06/19] block: ide: " AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 07/19] virtio: call device_probe() in scanning AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 08/19] dm: add event notification AKASHI Takahiro
2022-02-05  8:59   ` Heinrich Schuchardt
2022-02-02  1:08 ` [PATCH 09/19] dm: add tag support AKASHI Takahiro
2022-02-05  9:34   ` Heinrich Schuchardt
2022-02-02  1:08 ` [PATCH 10/19] dm: tag: add some document AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 11/19] test: dm: add tests for tag support AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 12/19] dm: disk: add UCLASS_PARTITION AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 13/19] dm: blk: add a device-probe hook for scanning disk partitions AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 14/19] efi_loader: disk: a helper function to create efi_disk objects from udevice AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 15/19] efi_loader: disk: a helper function to delete efi_disk objects AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 16/19] dm: disk: add read/write interfaces with udevice AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 17/19] efi_loader: disk: use udevice instead of blk_desc AKASHI Takahiro
2022-02-05  9:02   ` Heinrich Schuchardt
2022-02-02  1:08 ` [PATCH 18/19] efi_loader: disk: not create BLK device for BLK(IF_TYPE_EFI_LOADER) devices AKASHI Takahiro
2022-02-02  1:08 ` [PATCH 19/19] efi_driver: align with efi_disk-dm integration AKASHI Takahiro
2022-02-05  9:39 ` [PATCH 00/19] efi_loader: more tightly integrate UEFI disks to driver model Heinrich Schuchardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220202010853.40405-6-takahiro.akashi@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=bmeng.cn@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jh80.chung@samsung.com \
    --cc=lukma@denx.de \
    --cc=masami.hiramatsu@linaro.org \
    --cc=peng.fan@nxp.com \
    --cc=peng.ma@nxp.com \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.