[PATCH v5 3/4] drm/bridge: Add ti-tfp410 DVI transmitter driver
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Tue Nov 29 20:26:43 UTC 2016
Hi Jyri,
On Tuesday 29 Nov 2016 22:18:25 Jyri Sarha wrote:
> The module unload should not be allowed while the bridge is attached. So
> still need to add these:
>
> On 11/25/16 11:02, Jyri Sarha wrote:
> > +
> > +static int tfp410_attach(struct drm_bridge *bridge)
> > +{
> > + struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
> > + int ret;
> > +
>
> + if (!try_module_get(THIS_MODULE)) {
> + dev_err(dvi->dev, "Module unloading\n");
> + return -ENODEV;
> + }
> +
Shouldn't this be done in core code ?
> > + if (!bridge->encoder) {
> > + dev_err(dvi->dev, "Missing encoder\n");
> > + return -ENODEV;
> > + }
> > +
> > + drm_connector_helper_add(&dvi->connector,
> > + &tfp410_con_helper_funcs);
> > + ret = drm_connector_init(bridge->dev, &dvi->connector,
> > + &tfp410_con_funcs, DRM_MODE_CONNECTOR_HDMIA);
> > + if (ret) {
> > + dev_err(dvi->dev, "drm_connector_init() failed: %d\n", ret);
> > + return ret;
> > + }
> > +
> > + drm_mode_connector_attach_encoder(&dvi->connector,
> > + bridge->encoder);
> > +
> > + return 0;
> > +}
>
> +static void tfp410_detach(struct drm_bridge *bridge)
> +{
> + module_put(THIS_MODULE);
> +}
> +
>
> > +
> > +static const struct drm_bridge_funcs tfp410_bridge_funcs = {
> > + .attach = tfp410_attach,
>
> + .detach = tfp410_detach,
>
> > +};
> > +
--
Regards,
Laurent Pinchart
More information about the dri-devel
mailing list