Skip to content

Commit

Permalink
rtc: remove .open() and .release()
Browse files Browse the repository at this point in the history
There are no driver left using .open and .release. There is no good use
case for them as there is nothing the character device interface does that
should not be done in the sysfs interface or in-kernel interface.

Remove those callbacks now to avoid future confusion.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
  • Loading branch information
Alexandre Belloni committed Aug 24, 2017
1 parent 604c782 commit ea369ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
20 changes: 4 additions & 16 deletions drivers/rtc/rtc-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,19 @@ static dev_t rtc_devt;

static int rtc_dev_open(struct inode *inode, struct file *file)
{
int err;
struct rtc_device *rtc = container_of(inode->i_cdev,
struct rtc_device, char_dev);
const struct rtc_class_ops *ops = rtc->ops;

if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags))
return -EBUSY;

file->private_data = rtc;

err = ops->open ? ops->open(rtc->dev.parent) : 0;
if (err == 0) {
spin_lock_irq(&rtc->irq_lock);
rtc->irq_data = 0;
spin_unlock_irq(&rtc->irq_lock);

return 0;
}
spin_lock_irq(&rtc->irq_lock);
rtc->irq_data = 0;
spin_unlock_irq(&rtc->irq_lock);

/* something has gone wrong */
clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
return err;
return 0;
}

#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
Expand Down Expand Up @@ -438,9 +429,6 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
rtc_update_irq_enable(rtc, 0);
rtc_irq_set_state(rtc, NULL, 0);

if (rtc->ops->release)
rtc->ops->release(rtc->dev.parent);

clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions include/linux/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ extern struct class *rtc_class;
* issued through ioctl() ...
*/
struct rtc_class_ops {
int (*open)(struct device *);
void (*release)(struct device *);
int (*ioctl)(struct device *, unsigned int, unsigned long);
int (*read_time)(struct device *, struct rtc_time *);
int (*set_time)(struct device *, struct rtc_time *);
Expand Down

0 comments on commit ea369ea

Please sign in to comment.