Lines Matching +full:no +full:- +full:poll +full:- +full:on +full:- +full:init

1 // SPDX-License-Identifier: GPL-2.0-only
15 #include <linux/poll.h>
28 * This avoids deadlocks on printk locks without having to break locks. Also
42 if (mce->kflags & MCE_HANDLED_CEC) in dev_mce_log()
47 entry = mcelog->next; in dev_mce_log()
53 if (entry >= mcelog->len) { in dev_mce_log()
54 set_bit(MCE_OVERFLOW, (unsigned long *)&mcelog->flags); in dev_mce_log()
58 mcelog->next = entry + 1; in dev_mce_log()
60 memcpy(mcelog->entry + entry, mce, sizeof(struct mce)); in dev_mce_log()
61 mcelog->entry[entry].finished = 1; in dev_mce_log()
62 mcelog->entry[entry].kflags = 0; in dev_mce_log()
71 mce->kflags |= MCE_HANDLED_MCELOG; in dev_mce_log()
132 (mce_chrdev_open_count && (file->f_flags & O_EXCL))) { in mce_chrdev_open()
135 return -EBUSY; in mce_chrdev_open()
138 if (file->f_flags & O_EXCL) in mce_chrdev_open()
151 mce_chrdev_open_count--; in mce_chrdev_release()
169 return -EINVAL; in __mce_read_apei()
172 /* Error or no more MCE record */ in __mce_read_apei()
177 * "no record" instead of "no device." in __mce_read_apei()
179 if (rc == -ENODEV) in __mce_read_apei()
183 rc = -EFAULT; in __mce_read_apei()
189 * /sbin/mcelog, but we have no interface to support that now, in __mce_read_apei()
218 err = -EINVAL; in mce_chrdev_read()
219 if (*off != 0 || usize < mcelog->len * sizeof(struct mce)) in mce_chrdev_read()
222 next = mcelog->next; in mce_chrdev_read()
226 struct mce *m = &mcelog->entry[i]; in mce_chrdev_read()
232 memset(mcelog->entry, 0, next * sizeof(struct mce)); in mce_chrdev_read()
233 mcelog->next = 0; in mce_chrdev_read()
236 err = -EFAULT; in mce_chrdev_read()
241 return err ? err : buf - ubuf; in mce_chrdev_read()
247 if (READ_ONCE(mcelog->next)) in mce_chrdev_poll()
260 return -EPERM; in mce_chrdev_ioctl()
266 return put_user(mcelog->len, p); in mce_chrdev_ioctl()
271 flags = mcelog->flags; in mce_chrdev_ioctl()
272 } while (cmpxchg(&mcelog->flags, flags, 0) != flags); in mce_chrdev_ioctl()
277 return -ENOTTY; in mce_chrdev_ioctl()
299 return -EPERM; in mce_chrdev_write()
305 return -EIO; in mce_chrdev_write()
310 return -EFAULT; in mce_chrdev_write()
313 return -EINVAL; in mce_chrdev_write()
331 .poll = mce_chrdev_poll,
350 return -ENOMEM; in dev_mcelog_init_device()
352 memcpy(mcelog->signature, MCE_LOG_SIGNATURE, sizeof(mcelog->signature)); in dev_mcelog_init_device()
353 mcelog->len = mce_log_len; in dev_mcelog_init_device()
354 mcelog->recordlen = sizeof(struct mce); in dev_mcelog_init_device()
359 if (err == -EBUSY) in dev_mcelog_init_device()
361 pr_info("Unable to init device /dev/mcelog, already registered"); in dev_mcelog_init_device()
363 pr_err("Unable to init device /dev/mcelog (rc: %d)\n", err); in dev_mcelog_init_device()