Message ID | 20210124085552.29146-3-paul@crapouillou.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fixes to bridge/panel and ingenic-drm | expand |
Hi Paul, Thank you for the patch. On Sun, Jan 24, 2021 at 08:55:50AM +0000, Paul Cercueil wrote: > This performs the same operation as drmm_simple_encoder_alloc(), but > only allocates and returns a struct drm_encoder instance. > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > --- > include/drm/drm_simple_kms_helper.h | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h > index e6dbf3161c2f..f07e70303cfb 100644 > --- a/include/drm/drm_simple_kms_helper.h > +++ b/include/drm/drm_simple_kms_helper.h > @@ -209,4 +209,21 @@ void *__drmm_simple_encoder_alloc(struct drm_device *dev, size_t size, > offsetof(type, member), \ > encoder_type)) > > +/** > + * drmm_plain_simple_encoder_alloc - Allocate and initialize a drm_encoder > + * struct with basic functionality. > + * @dev: drm device > + * @encoder_type: user visible type of the encoder > + * > + * This performs the same operation as drmm_simple_encoder_alloc(), but > + * only allocates and returns a struct drm_encoder instance. > + * > + * Returns: > + * Pointer to the new drm_encoder struct, or ERR_PTR on failure. > + */ > +#define drmm_plain_simple_encoder_alloc(dev, encoder_type) \ > + ((struct drm_encoder *) \ > + __drmm_simple_encoder_alloc(dev, sizeof(struct drm_encoder), \ > + 0, encoder_type)) > + As this isn't related to the simple encoder helper anymore, how about using __drmm_encoder_alloc instead ? #define drmm_plain_simple_encoder_alloc(dev, encoder_type) \ ((struct drm_encoder *) \ __drmm_encoder_alloc(dev, sizeof(struct drm_encoder), 0, NULL, \ encoder_type, NULL)) I'd also rename the macro to drmm_plain_encoder_alloc(), and move it to drm_encoder.h. That way drivers that don't need the simple KMS helper won't have to select it just for this. > #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */
diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h index e6dbf3161c2f..f07e70303cfb 100644 --- a/include/drm/drm_simple_kms_helper.h +++ b/include/drm/drm_simple_kms_helper.h @@ -209,4 +209,21 @@ void *__drmm_simple_encoder_alloc(struct drm_device *dev, size_t size, offsetof(type, member), \ encoder_type)) +/** + * drmm_plain_simple_encoder_alloc - Allocate and initialize a drm_encoder + * struct with basic functionality. + * @dev: drm device + * @encoder_type: user visible type of the encoder + * + * This performs the same operation as drmm_simple_encoder_alloc(), but + * only allocates and returns a struct drm_encoder instance. + * + * Returns: + * Pointer to the new drm_encoder struct, or ERR_PTR on failure. + */ +#define drmm_plain_simple_encoder_alloc(dev, encoder_type) \ + ((struct drm_encoder *) \ + __drmm_simple_encoder_alloc(dev, sizeof(struct drm_encoder), \ + 0, encoder_type)) + #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */
This performs the same operation as drmm_simple_encoder_alloc(), but only allocates and returns a struct drm_encoder instance. Signed-off-by: Paul Cercueil <paul@crapouillou.net> --- include/drm/drm_simple_kms_helper.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)