Re: [PATCH v5 1/4] drm/bridge: add support for sn65dsi86 bridge driver

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

 



Quoting Sean Paul (2018-05-02 12:03:16)
> On Wed, May 02, 2018 at 10:01:59AM +0530, Sandeep Panda wrote:
> 
> > +     struct drm_display_mode curr_mode;
> > +     struct mutex lock;
> > +     unsigned int ctrl_ref_count;
> > +};
> > +
> > +static const struct regmap_range ti_sn_bridge_volatile_ranges[] = {
> > +     { .range_min = 0, .range_max = 0xff },
> > +};
> > +
> > +static const struct regmap_access_table ti_sn_bridge_volatile_table = {
> > +     .yes_ranges = ti_sn_bridge_volatile_ranges,
> > +     .n_yes_ranges = ARRAY_SIZE(ti_sn_bridge_volatile_ranges),
> > +};
> > +
> > +static const struct regmap_config ti_sn_bridge_regmap_config = {
> > +     .reg_bits = 8,
> > +     .val_bits = 8,
> > +     .volatile_table = &ti_sn_bridge_volatile_table,
> > +     .cache_type = REGCACHE_NONE,
> > +};
> > +
> > +static int ti_sn_bridge_power_ctrl(struct ti_sn_bridge *pdata, bool enable)
> > +{
> > +     int ret = 0;
> > +
> > +     mutex_lock(&pdata->lock);
> > +     if (enable)
> > +             pdata->ctrl_ref_count++;
> > +     else
> > +             pdata->ctrl_ref_count--;
> 
> I think you should use a kref instead of rolling your own ref_count. You can
> handle release by calling kref_put_mutex(), which will handle the reference and
> the lock. On the acquire side, you can use kref_get_unless_zero which will be
> fast if the reference is already active.

Why not use runtime PM?

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux