Lines Matching refs:con

108  * @con:	Console to update
114 static inline void nbcon_state_set(struct console *con, struct nbcon_state *new)
116 atomic_set(&ACCESS_PRIVATE(con, nbcon_state), new->atom);
121 * @con: Console to read
124 static inline void nbcon_state_read(struct console *con, struct nbcon_state *state)
126 state->atom = atomic_read(&ACCESS_PRIVATE(con, nbcon_state));
131 * @con: Console to update
137 static inline bool nbcon_state_try_cmpxchg(struct console *con, struct nbcon_state *cur,
140 return atomic_try_cmpxchg(&ACCESS_PRIVATE(con, nbcon_state), &cur->atom, new->atom);
145 * @con: Console to read the sequence of
147 * Return: Sequence number of the next record to print on @con.
149 u64 nbcon_seq_read(struct console *con)
151 unsigned long nbcon_seq = atomic_long_read(&ACCESS_PRIVATE(con, nbcon_seq));
158 * @con: Console to work on
164 void nbcon_seq_force(struct console *con, u64 seq)
174 atomic_long_set(&ACCESS_PRIVATE(con, nbcon_seq), __u64seq_to_ulseq(valid_seq));
176 /* Clear con->seq since nbcon consoles use con->nbcon_seq instead. */
177 con->seq = 0;
186 * @ctxt->seq is updated to the new value of @con::nbcon_seq (expanded to
194 struct console *con = ctxt->console;
196 if (atomic_long_try_cmpxchg(&ACCESS_PRIVATE(con, nbcon_seq), &nbcon_seq,
200 ctxt->seq = nbcon_seq_read(con);
230 struct console *con = ctxt->console;
255 } while (!nbcon_state_try_cmpxchg(con, cur, &new));
310 struct console *con = ctxt->console;
340 if (!nbcon_state_try_cmpxchg(con, cur, &new)) {
393 struct console *con = ctxt->console;
426 if (!nbcon_state_try_cmpxchg(con, cur, &new))
448 nbcon_state_read(con, cur);
464 if (nbcon_state_try_cmpxchg(con, cur, &new)) {
499 struct console *con = ctxt->console;
523 } while (!nbcon_state_try_cmpxchg(con, cur, &new));
545 struct console *con = ctxt->console;
549 nbcon_state_read(con, &cur);
572 ctxt->pbufs = con->pbufs;
607 struct console *con = ctxt->console;
611 nbcon_state_read(con, &cur);
626 } while (!nbcon_state_try_cmpxchg(con, &cur, &new));
728 struct console *con = ctxt->console;
731 nbcon_state_read(con, &cur);
741 * __nbcon_context_update_unsafe - Update the unsafe bit in @con->nbcon_state
761 struct console *con = ctxt->console;
765 nbcon_state_read(con, &cur);
780 } while (!nbcon_state_try_cmpxchg(con, &cur, &new));
847 struct console *con = ctxt->console;
848 bool is_extended = console_srcu_read_flags(con) & CON_EXTENDED;
871 * @con->dropped is not protected in case of an unsafe hostile
875 con_dropped = data_race(READ_ONCE(con->dropped));
884 /* For skipped records just update seq/dropped in @con. */
891 nbcon_state_read(con, &cur);
894 if (con->write_atomic) {
895 done = con->write_atomic(con, wctxt);
923 WRITE_ONCE(con->dropped, dropped);
933 * @con: Console to allocate buffers for
941 bool nbcon_alloc(struct console *con)
943 if (con->flags & CON_BOOT) {
949 con->pbufs = &printk_shared_pbufs;
951 con->pbufs = kmalloc(sizeof(*con->pbufs), GFP_KERNEL);
952 if (!con->pbufs) {
953 con_printk(KERN_ERR, con, "failed to allocate printing buffer\n");
963 * @con: Console to initialize
968 * This function expects that the legacy @con->seq has been set.
970 void nbcon_init(struct console *con)
975 BUG_ON(!con->pbufs);
977 nbcon_seq_force(con, con->seq);
978 nbcon_state_set(con, &state);
983 * @con: Console to free/cleanup nbcon data
985 void nbcon_free(struct console *con)
989 nbcon_state_set(con, &state);
992 if (!(con->flags & CON_BOOT))
993 kfree(con->pbufs);
995 con->pbufs = NULL;