static int udl_get_modes(struct drm_connector *connector)
{
- struct udl_drm_connector *udl_connector =
- container_of(connector,
- struct udl_drm_connector,
- connector);
+ struct udl_connector *udl_connector = to_udl_connector(connector);
drm_connector_update_edid_property(connector, udl_connector->edid);
if (udl_connector->edid)
udl_detect(struct drm_connector *connector, bool force)
{
struct udl_device *udl = to_udl(connector->dev);
- struct udl_drm_connector *udl_connector =
- container_of(connector,
- struct udl_drm_connector,
- connector);
+ struct udl_connector *udl_connector = to_udl_connector(connector);
/* cleanup previous edid */
if (udl_connector->edid != NULL) {
static void udl_connector_destroy(struct drm_connector *connector)
{
- struct udl_drm_connector *udl_connector =
- container_of(connector,
- struct udl_drm_connector,
- connector);
+ struct udl_connector *udl_connector = to_udl_connector(connector);
drm_connector_cleanup(connector);
kfree(udl_connector->edid);
struct drm_connector *udl_connector_init(struct drm_device *dev)
{
- struct udl_drm_connector *udl_connector;
+ struct udl_connector *udl_connector;
struct drm_connector *connector;
- udl_connector = kzalloc(sizeof(struct udl_drm_connector), GFP_KERNEL);
+ udl_connector = kzalloc(sizeof(*udl_connector), GFP_KERNEL);
if (!udl_connector)
return ERR_PTR(-ENOMEM);
#ifndef __UDL_CONNECTOR_H__
#define __UDL_CONNECTOR_H__
-#include <drm/drm_crtc.h>
+#include <linux/container_of.h>
+
+#include <drm/drm_connector.h>
struct edid;
-struct udl_drm_connector {
+struct udl_connector {
struct drm_connector connector;
/* last udl_detect edid */
struct edid *edid;
};
+static inline struct udl_connector *to_udl_connector(struct drm_connector *connector)
+{
+ return container_of(connector, struct udl_connector, connector);
+}
#endif //__UDL_CONNECTOR_H__