On 01/04/2020 10:41, Sebastian Huber wrote:

        for (i = 0; i < buffer_count; ++i) {
@@ -394,6 +399,7 @@ rtems_bsd_mmcsd_disk_read_write(struct mmcsd_part *part, rtems_blkdev_request *b
  error:
        MMCSD_DISK_UNLOCK(part);
+    MMCBUS_RELEASE_BUS(device_get_parent(dev), dev);
        rtems_blkdev_request_done(blkreq, status_code);
  @@ -436,8 +442,6 @@ rtems_bsd_mmcsd_attach_worker(rtems_media_state state, const char *src, char **d
              goto error;
          }
  -        MMCBUS_ACQUIRE_BUS(device_get_parent(dev), dev);

I think the bus acquire here is necessary to prevent an rtems_blkdev_create() while the bus is detached in parallel, e.g. a fast plug/unplug of an USB stick.
Sorry, this comment makes little sense, this code is not for USB sticks. However, if we want to support hot plugging of MMC busses and devices, then the rtems_blkdev_create() during a concurrent detach is something we have to consider.

After reviewing the code I think this bus acquire without a release (which is in the code since the import from libusb in 2015) was a hack to improve the read/write performance. We didn't support hot plugging of MMC busses and devices. Do we need this feature now?

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to