Lines Matching refs:clk
22 struct posix_clock *clk = fp->private_data; in get_posix_clock() local
24 down_read(&clk->rwsem); in get_posix_clock()
26 if (!clk->zombie) in get_posix_clock()
27 return clk; in get_posix_clock()
29 up_read(&clk->rwsem); in get_posix_clock()
34 static void put_posix_clock(struct posix_clock *clk) in put_posix_clock() argument
36 up_read(&clk->rwsem); in put_posix_clock()
42 struct posix_clock *clk = get_posix_clock(fp); in posix_clock_read() local
45 if (!clk) in posix_clock_read()
48 if (clk->ops.read) in posix_clock_read()
49 err = clk->ops.read(clk, fp->f_flags, buf, count); in posix_clock_read()
51 put_posix_clock(clk); in posix_clock_read()
58 struct posix_clock *clk = get_posix_clock(fp); in posix_clock_poll() local
61 if (!clk) in posix_clock_poll()
64 if (clk->ops.poll) in posix_clock_poll()
65 result = clk->ops.poll(clk, fp, wait); in posix_clock_poll()
67 put_posix_clock(clk); in posix_clock_poll()
75 struct posix_clock *clk = get_posix_clock(fp); in posix_clock_ioctl() local
78 if (!clk) in posix_clock_ioctl()
81 if (clk->ops.ioctl) in posix_clock_ioctl()
82 err = clk->ops.ioctl(clk, cmd, arg); in posix_clock_ioctl()
84 put_posix_clock(clk); in posix_clock_ioctl()
93 struct posix_clock *clk = get_posix_clock(fp); in posix_clock_compat_ioctl() local
96 if (!clk) in posix_clock_compat_ioctl()
99 if (clk->ops.ioctl) in posix_clock_compat_ioctl()
100 err = clk->ops.ioctl(clk, cmd, arg); in posix_clock_compat_ioctl()
102 put_posix_clock(clk); in posix_clock_compat_ioctl()
111 struct posix_clock *clk = in posix_clock_open() local
114 down_read(&clk->rwsem); in posix_clock_open()
116 if (clk->zombie) { in posix_clock_open()
120 if (clk->ops.open) in posix_clock_open()
121 err = clk->ops.open(clk, fp->f_mode); in posix_clock_open()
126 get_device(clk->dev); in posix_clock_open()
127 fp->private_data = clk; in posix_clock_open()
130 up_read(&clk->rwsem); in posix_clock_open()
136 struct posix_clock *clk = fp->private_data; in posix_clock_release() local
139 if (clk->ops.release) in posix_clock_release()
140 err = clk->ops.release(clk); in posix_clock_release()
142 put_device(clk->dev); in posix_clock_release()
162 int posix_clock_register(struct posix_clock *clk, struct device *dev) in posix_clock_register() argument
166 init_rwsem(&clk->rwsem); in posix_clock_register()
168 cdev_init(&clk->cdev, &posix_clock_file_operations); in posix_clock_register()
169 err = cdev_device_add(&clk->cdev, dev); in posix_clock_register()
175 clk->cdev.owner = clk->ops.owner; in posix_clock_register()
176 clk->dev = dev; in posix_clock_register()
182 void posix_clock_unregister(struct posix_clock *clk) in posix_clock_unregister() argument
184 cdev_device_del(&clk->cdev, clk->dev); in posix_clock_unregister()
186 down_write(&clk->rwsem); in posix_clock_unregister()
187 clk->zombie = true; in posix_clock_unregister()
188 up_write(&clk->rwsem); in posix_clock_unregister()
190 put_device(clk->dev); in posix_clock_unregister()
196 struct posix_clock *clk; member
211 cd->clk = get_posix_clock(fp); in get_clock_desc()
213 err = cd->clk ? 0 : -ENODEV; in get_clock_desc()
222 put_posix_clock(cd->clk); in put_clock_desc()
240 if (cd.clk->ops.clock_adjtime) in pc_clock_adjtime()
241 err = cd.clk->ops.clock_adjtime(cd.clk, tx); in pc_clock_adjtime()
259 if (cd.clk->ops.clock_gettime) in pc_clock_gettime()
260 err = cd.clk->ops.clock_gettime(cd.clk, ts); in pc_clock_gettime()
278 if (cd.clk->ops.clock_getres) in pc_clock_getres()
279 err = cd.clk->ops.clock_getres(cd.clk, ts); in pc_clock_getres()
302 if (cd.clk->ops.clock_settime) in pc_clock_settime()
303 err = cd.clk->ops.clock_settime(cd.clk, ts); in pc_clock_settime()