Commit 5ed37174 authored by Petr Mladek's avatar Petr Mladek

Merge branch 'for-5.11' into for-linus

parents 5f3b8d39 8d143c61
...@@ -695,7 +695,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from) ...@@ -695,7 +695,6 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
if (LOG_FACILITY(u) != 0) if (LOG_FACILITY(u) != 0)
facility = LOG_FACILITY(u); facility = LOG_FACILITY(u);
endp++; endp++;
len -= endp - line;
line = endp; line = endp;
} }
} }
......
...@@ -559,11 +559,12 @@ static void desc_make_reusable(struct prb_desc_ring *desc_ring, ...@@ -559,11 +559,12 @@ static void desc_make_reusable(struct prb_desc_ring *desc_ring,
* on error the caller can re-load the tail lpos to determine the situation. * on error the caller can re-load the tail lpos to determine the situation.
*/ */
static bool data_make_reusable(struct printk_ringbuffer *rb, static bool data_make_reusable(struct printk_ringbuffer *rb,
struct prb_data_ring *data_ring,
unsigned long lpos_begin, unsigned long lpos_begin,
unsigned long lpos_end, unsigned long lpos_end,
unsigned long *lpos_out) unsigned long *lpos_out)
{ {
struct prb_data_ring *data_ring = &rb->text_data_ring;
struct prb_desc_ring *desc_ring = &rb->desc_ring; struct prb_desc_ring *desc_ring = &rb->desc_ring;
struct prb_data_block *blk; struct prb_data_block *blk;
enum desc_state d_state; enum desc_state d_state;
...@@ -625,10 +626,9 @@ static bool data_make_reusable(struct printk_ringbuffer *rb, ...@@ -625,10 +626,9 @@ static bool data_make_reusable(struct printk_ringbuffer *rb,
* descriptors into the reusable state if the tail is pushed beyond * descriptors into the reusable state if the tail is pushed beyond
* their associated data block. * their associated data block.
*/ */
static bool data_push_tail(struct printk_ringbuffer *rb, static bool data_push_tail(struct printk_ringbuffer *rb, unsigned long lpos)
struct prb_data_ring *data_ring,
unsigned long lpos)
{ {
struct prb_data_ring *data_ring = &rb->text_data_ring;
unsigned long tail_lpos_new; unsigned long tail_lpos_new;
unsigned long tail_lpos; unsigned long tail_lpos;
unsigned long next_lpos; unsigned long next_lpos;
...@@ -669,8 +669,7 @@ static bool data_push_tail(struct printk_ringbuffer *rb, ...@@ -669,8 +669,7 @@ static bool data_push_tail(struct printk_ringbuffer *rb,
* Make all descriptors reusable that are associated with * Make all descriptors reusable that are associated with
* data blocks before @lpos. * data blocks before @lpos.
*/ */
if (!data_make_reusable(rb, data_ring, tail_lpos, lpos, if (!data_make_reusable(rb, tail_lpos, lpos, &next_lpos)) {
&next_lpos)) {
/* /*
* 1. Guarantee the block ID loaded in * 1. Guarantee the block ID loaded in
* data_make_reusable() is performed before * data_make_reusable() is performed before
...@@ -807,7 +806,7 @@ static bool desc_push_tail(struct printk_ringbuffer *rb, ...@@ -807,7 +806,7 @@ static bool desc_push_tail(struct printk_ringbuffer *rb,
* data blocks once their associated descriptor is gone. * data blocks once their associated descriptor is gone.
*/ */
if (!data_push_tail(rb, &rb->text_data_ring, desc.text_blk_lpos.next)) if (!data_push_tail(rb, desc.text_blk_lpos.next))
return false; return false;
/* /*
...@@ -1019,10 +1018,10 @@ static unsigned long get_next_lpos(struct prb_data_ring *data_ring, ...@@ -1019,10 +1018,10 @@ static unsigned long get_next_lpos(struct prb_data_ring *data_ring,
* if necessary. This function also associates the data block with * if necessary. This function also associates the data block with
* a specified descriptor. * a specified descriptor.
*/ */
static char *data_alloc(struct printk_ringbuffer *rb, static char *data_alloc(struct printk_ringbuffer *rb, unsigned int size,
struct prb_data_ring *data_ring, unsigned int size,
struct prb_data_blk_lpos *blk_lpos, unsigned long id) struct prb_data_blk_lpos *blk_lpos, unsigned long id)
{ {
struct prb_data_ring *data_ring = &rb->text_data_ring;
struct prb_data_block *blk; struct prb_data_block *blk;
unsigned long begin_lpos; unsigned long begin_lpos;
unsigned long next_lpos; unsigned long next_lpos;
...@@ -1041,7 +1040,7 @@ static char *data_alloc(struct printk_ringbuffer *rb, ...@@ -1041,7 +1040,7 @@ static char *data_alloc(struct printk_ringbuffer *rb,
do { do {
next_lpos = get_next_lpos(data_ring, begin_lpos, size); next_lpos = get_next_lpos(data_ring, begin_lpos, size);
if (!data_push_tail(rb, data_ring, next_lpos - DATA_SIZE(data_ring))) { if (!data_push_tail(rb, next_lpos - DATA_SIZE(data_ring))) {
/* Failed to allocate, specify a data-less block. */ /* Failed to allocate, specify a data-less block. */
blk_lpos->begin = FAILED_LPOS; blk_lpos->begin = FAILED_LPOS;
blk_lpos->next = FAILED_LPOS; blk_lpos->next = FAILED_LPOS;
...@@ -1100,10 +1099,10 @@ static char *data_alloc(struct printk_ringbuffer *rb, ...@@ -1100,10 +1099,10 @@ static char *data_alloc(struct printk_ringbuffer *rb,
* Return a pointer to the beginning of the entire data buffer or NULL on * Return a pointer to the beginning of the entire data buffer or NULL on
* failure. * failure.
*/ */
static char *data_realloc(struct printk_ringbuffer *rb, static char *data_realloc(struct printk_ringbuffer *rb, unsigned int size,
struct prb_data_ring *data_ring, unsigned int size,
struct prb_data_blk_lpos *blk_lpos, unsigned long id) struct prb_data_blk_lpos *blk_lpos, unsigned long id)
{ {
struct prb_data_ring *data_ring = &rb->text_data_ring;
struct prb_data_block *blk; struct prb_data_block *blk;
unsigned long head_lpos; unsigned long head_lpos;
unsigned long next_lpos; unsigned long next_lpos;
...@@ -1130,7 +1129,7 @@ static char *data_realloc(struct printk_ringbuffer *rb, ...@@ -1130,7 +1129,7 @@ static char *data_realloc(struct printk_ringbuffer *rb,
return &blk->data[0]; return &blk->data[0];
} }
if (!data_push_tail(rb, data_ring, next_lpos - DATA_SIZE(data_ring))) if (!data_push_tail(rb, next_lpos - DATA_SIZE(data_ring)))
return NULL; return NULL;
/* The memory barrier involvement is the same as data_alloc:A. */ /* The memory barrier involvement is the same as data_alloc:A. */
...@@ -1395,7 +1394,7 @@ bool prb_reserve_in_last(struct prb_reserved_entry *e, struct printk_ringbuffer ...@@ -1395,7 +1394,7 @@ bool prb_reserve_in_last(struct prb_reserved_entry *e, struct printk_ringbuffer
if (r->text_buf_size > max_size) if (r->text_buf_size > max_size)
goto fail; goto fail;
r->text_buf = data_alloc(rb, &rb->text_data_ring, r->text_buf_size, r->text_buf = data_alloc(rb, r->text_buf_size,
&d->text_blk_lpos, id); &d->text_blk_lpos, id);
} else { } else {
if (!get_data(&rb->text_data_ring, &d->text_blk_lpos, &data_size)) if (!get_data(&rb->text_data_ring, &d->text_blk_lpos, &data_size))
...@@ -1419,7 +1418,7 @@ bool prb_reserve_in_last(struct prb_reserved_entry *e, struct printk_ringbuffer ...@@ -1419,7 +1418,7 @@ bool prb_reserve_in_last(struct prb_reserved_entry *e, struct printk_ringbuffer
if (r->text_buf_size > max_size) if (r->text_buf_size > max_size)
goto fail; goto fail;
r->text_buf = data_realloc(rb, &rb->text_data_ring, r->text_buf_size, r->text_buf = data_realloc(rb, r->text_buf_size,
&d->text_blk_lpos, id); &d->text_blk_lpos, id);
} }
if (r->text_buf_size && !r->text_buf) if (r->text_buf_size && !r->text_buf)
...@@ -1547,8 +1546,7 @@ bool prb_reserve(struct prb_reserved_entry *e, struct printk_ringbuffer *rb, ...@@ -1547,8 +1546,7 @@ bool prb_reserve(struct prb_reserved_entry *e, struct printk_ringbuffer *rb,
if (info->seq > 0) if (info->seq > 0)
desc_make_final(desc_ring, DESC_ID(id - 1)); desc_make_final(desc_ring, DESC_ID(id - 1));
r->text_buf = data_alloc(rb, &rb->text_data_ring, r->text_buf_size, r->text_buf = data_alloc(rb, r->text_buf_size, &d->text_blk_lpos, id);
&d->text_blk_lpos, id);
/* If text data allocation fails, a data-less record is committed. */ /* If text data allocation fails, a data-less record is committed. */
if (r->text_buf_size && !r->text_buf) { if (r->text_buf_size && !r->text_buf) {
prb_commit(e); prb_commit(e);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment