[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Should bus-less devices default to .user_creatable = false? (was: [PATCH

From: Markus Armbruster
Subject: Should bus-less devices default to .user_creatable = false? (was: [PATCH 13/13] bcm2835_cprman: put some peripherals of bcm2835 cprman into the 'misc' category)
Date: Wed, 18 Nov 2020 09:50:14 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Markus Armbruster <armbru@redhat.com> writes:

> qdev_device_add() looks like a bus-less device is usable if the machine
> provides a hotplug handler for it.  Commit 03fcbd9dc5 "qdev: Check for
> the availability of a hotplug controller before adding a device" seems
> to be pertinent.

Nope.  A hotplug handler is only required for hot plug (d'oh!), not for
cold plug.  

I wonder whether bus-less devices should default to .user_creatable =
false like sysbus devices, and for the same reasons.

To actually *do* something, a physical device requires some connection
to the rest of the world.  Same for a virtual device (at least the ones
that model physical devices).


     * device_add plugs devices into a suitable bus.  For "real" buses,
     * that actually connects the device.  For sysbus, the connections
     * need to be made separately, and device_add can't do that.  The
     * device would be left unconnected, and will probably not work
     * However, a few machines can handle device_add/-device with
     * a few specific sysbus devices. In those cases, the device
     * subclass needs to override it and set user_creatable=true.
    k->user_creatable = false;

The reasoning applies to bus-less devices just as well, doesn't it?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]