Message ID | 20220610092924.754942-6-maxime@cerno.tech (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/vc4: Fix hotplug for vc4 | expand |
Hi Am 10.06.22 um 11:28 schrieb Maxime Ripard: > Unlike encoders and CRTCs, the drm_connector_init() and > drm_connector_init_with_ddc() don't mention how the cleanup is supposed to > be done. Let's add it. > > Signed-off-by: Maxime Ripard <maxime@cerno.tech> > --- > drivers/gpu/drm/drm_connector.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c > index 353d83ae09d3..2a78a23836d8 100644 > --- a/drivers/gpu/drm/drm_connector.c > +++ b/drivers/gpu/drm/drm_connector.c > @@ -222,6 +222,11 @@ void drm_connector_free_work_fn(struct work_struct *work) > * Initialises a preallocated connector. Connectors should be > * subclassed as part of driver connector objects. > * > + * At driver unload time the driver's &drm_connector_funcs.destroy hook > + * should call drm_connector_unregister(), drm_connector_cleanup() and > + * kfree() the connector structure. The connector structure should not This sounds odd. Maybe '... to release... the connector structure' ? > + * be allocated with devm_kzalloc(). > + * > * Returns: > * Zero on success, error code on failure. > */ > @@ -345,6 +350,11 @@ EXPORT_SYMBOL(drm_connector_init); > * Initialises a preallocated connector. Connectors should be > * subclassed as part of driver connector objects. > * > + * At driver unload time the driver's &drm_connector_funcs.destroy hook > + * should call drm_connector_unregister(), drm_connector_cleanup() and > + * kfree() the connector structure. The connector structure should not > + * be allocated with devm_kzalloc(). > + * Same here. Best regards Thomas > * Ensures that the ddc field of the connector is correctly set. > * > * Returns:
Hi Thomas, Thanks for your review On Mon, Jun 20, 2022 at 12:21:33PM +0200, Thomas Zimmermann wrote: > Am 10.06.22 um 11:28 schrieb Maxime Ripard: > > Unlike encoders and CRTCs, the drm_connector_init() and > > drm_connector_init_with_ddc() don't mention how the cleanup is supposed to > > be done. Let's add it. > > > > Signed-off-by: Maxime Ripard <maxime@cerno.tech> > > --- > > drivers/gpu/drm/drm_connector.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c > > index 353d83ae09d3..2a78a23836d8 100644 > > --- a/drivers/gpu/drm/drm_connector.c > > +++ b/drivers/gpu/drm/drm_connector.c > > @@ -222,6 +222,11 @@ void drm_connector_free_work_fn(struct work_struct *work) > > * Initialises a preallocated connector. Connectors should be > > * subclassed as part of driver connector objects. > > * > > + * At driver unload time the driver's &drm_connector_funcs.destroy hook > > + * should call drm_connector_unregister(), drm_connector_cleanup() and > > + * kfree() the connector structure. The connector structure should not > > This sounds odd. Maybe > > '... to release... the connector structure' ? I didn't really get what your suggestion was exactly Is it > At driver unload time the driver's &drm_connector_funcs.destroy hook > should call drm_connector_unregister(), drm_connector_cleanup() and > kfree() to release the connector structure. Or something else? Thanks! Maxime
Hi Am 20.06.22 um 14:18 schrieb Maxime Ripard: > + * At driver unload time the driver's &drm_connector_funcs.destroy hook > + * should call drm_connector_unregister(), drm_connector_cleanup() and > + * kfree() the connector structure. This sentence sounds odd.
On Mon, Jun 20, 2022 at 04:19:43PM +0200, Thomas Zimmermann wrote: > Hi > > Am 20.06.22 um 14:18 schrieb Maxime Ripard: > > + * At driver unload time the driver's &drm_connector_funcs.destroy hook > > + * should call drm_connector_unregister(), drm_connector_cleanup() and > > + * kfree() the connector structure. > > This sentence sounds odd. Yeah, I was using kfree as a verb which is probably where the weirdness comes from. Would that be better: At driver unload time the driver's &drm_connector_funcs.destroy hook should call drm_connector_unregister() and free the connector structure. Maxime
Hi Am 20.06.22 um 16:40 schrieb Maxime Ripard: > On Mon, Jun 20, 2022 at 04:19:43PM +0200, Thomas Zimmermann wrote: >> Hi >> >> Am 20.06.22 um 14:18 schrieb Maxime Ripard: >>> + * At driver unload time the driver's &drm_connector_funcs.destroy hook >>> + * should call drm_connector_unregister(), drm_connector_cleanup() and >>> + * kfree() the connector structure. >> >> This sentence sounds odd. > > Yeah, I was using kfree as a verb which is probably where the weirdness comes from. > > Would that be better: > > At driver unload time the driver's &drm_connector_funcs.destroy hook should call > drm_connector_unregister() and free the connector structure. Yes. That's better. Best regards Thomas > > Maxime
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 353d83ae09d3..2a78a23836d8 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -222,6 +222,11 @@ void drm_connector_free_work_fn(struct work_struct *work) * Initialises a preallocated connector. Connectors should be * subclassed as part of driver connector objects. * + * At driver unload time the driver's &drm_connector_funcs.destroy hook + * should call drm_connector_unregister(), drm_connector_cleanup() and + * kfree() the connector structure. The connector structure should not + * be allocated with devm_kzalloc(). + * * Returns: * Zero on success, error code on failure. */ @@ -345,6 +350,11 @@ EXPORT_SYMBOL(drm_connector_init); * Initialises a preallocated connector. Connectors should be * subclassed as part of driver connector objects. * + * At driver unload time the driver's &drm_connector_funcs.destroy hook + * should call drm_connector_unregister(), drm_connector_cleanup() and + * kfree() the connector structure. The connector structure should not + * be allocated with devm_kzalloc(). + * * Ensures that the ddc field of the connector is correctly set. * * Returns:
Unlike encoders and CRTCs, the drm_connector_init() and drm_connector_init_with_ddc() don't mention how the cleanup is supposed to be done. Let's add it. Signed-off-by: Maxime Ripard <maxime@cerno.tech> --- drivers/gpu/drm/drm_connector.c | 10 ++++++++++ 1 file changed, 10 insertions(+)