* [PATCH 1/2] block: Alias block_op_close() to block_op_flush()
@ 2019-01-12 5:58 Andrey Smirnov
2019-01-12 5:58 ` [PATCH 2/2] block: Replace debug() with dev_dbg() Andrey Smirnov
2019-01-16 7:29 ` [PATCH 1/2] block: Alias block_op_close() to block_op_flush() Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Andrey Smirnov @ 2019-01-12 5:58 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
The two functions are identical, so there's no need to keep two copies
of the same code around. Alias block_op_close() to block_op_flush()
and drop standalone definition for the former.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
common/block.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/common/block.c b/common/block.c
index 8d0de42d90..549df71a9d 100644
--- a/common/block.c
+++ b/common/block.c
@@ -329,13 +329,6 @@ static ssize_t block_op_write(struct cdev *cdev, const void *buf, size_t count,
}
#endif
-static int block_op_close(struct cdev *cdev)
-{
- struct block_device *blk = cdev->priv;
-
- return writebuffer_flush(blk);
-}
-
static int block_op_flush(struct cdev *cdev)
{
struct block_device *blk = cdev->priv;
@@ -343,6 +336,8 @@ static int block_op_flush(struct cdev *cdev)
return writebuffer_flush(blk);
}
+static int block_op_close(struct cdev *cdev) __alias(block_op_flush);
+
static struct cdev_operations block_ops = {
.read = block_op_read,
#ifdef CONFIG_BLOCK_WRITE
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] block: Replace debug() with dev_dbg()
2019-01-12 5:58 [PATCH 1/2] block: Alias block_op_close() to block_op_flush() Andrey Smirnov
@ 2019-01-12 5:58 ` Andrey Smirnov
2019-01-16 7:29 ` [PATCH 1/2] block: Alias block_op_close() to block_op_flush() Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Andrey Smirnov @ 2019-01-12 5:58 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
All of the functions using debug() in that file have enough info to
use dev_dbg instead. Convert all of the uses of debug() to dev_dbg()
in order to get more informative debug output.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
common/block.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/common/block.c b/common/block.c
index 549df71a9d..35173c65f1 100644
--- a/common/block.c
+++ b/common/block.c
@@ -76,7 +76,8 @@ static struct chunk *chunk_get_cached(struct block_device *blk, int block)
list_for_each_entry(chunk, &blk->buffered_blocks, list) {
if (block >= chunk->block_start &&
block < chunk->block_start + blk->rdbufsize) {
- debug("%s: found %d in %d\n", __func__, block, chunk->num);
+ dev_dbg(blk->dev, "%s: found %d in %d\n", __func__,
+ block, chunk->num);
/*
* move most recently used entry to the head of the list
*/
@@ -153,8 +154,8 @@ static int block_cache(struct block_device *blk, int block)
chunk->block_start = block & ~blk->blkmask;
- debug("%s: %d to %d\n", __func__, chunk->block_start,
- chunk->num);
+ dev_dbg(blk->dev, "%s: %d to %d\n", __func__, chunk->block_start,
+ chunk->num);
num_blocks = min(blk->rdbufsize, blk->num_blocks - chunk->block_start);
@@ -364,8 +365,8 @@ int blockdevice_register(struct block_device *blk)
INIT_LIST_HEAD(&blk->idle_blocks);
blk->blkmask = blk->rdbufsize - 1;
- debug("%s: rdbufsize: %d blockbits: %d blkmask: 0x%08x\n", __func__, blk->rdbufsize, blk->blockbits,
- blk->blkmask);
+ dev_dbg(blk->dev, "rdbufsize: %d blockbits: %d blkmask: 0x%08x\n",
+ blk->rdbufsize, blk->blockbits, blk->blkmask);
for (i = 0; i < 32; i++) {
struct chunk *chunk = xzalloc(sizeof(*chunk));
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] block: Alias block_op_close() to block_op_flush()
2019-01-12 5:58 [PATCH 1/2] block: Alias block_op_close() to block_op_flush() Andrey Smirnov
2019-01-12 5:58 ` [PATCH 2/2] block: Replace debug() with dev_dbg() Andrey Smirnov
@ 2019-01-16 7:29 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2019-01-16 7:29 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: barebox
On Fri, Jan 11, 2019 at 09:58:14PM -0800, Andrey Smirnov wrote:
> The two functions are identical, so there's no need to keep two copies
> of the same code around. Alias block_op_close() to block_op_flush()
> and drop standalone definition for the former.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> common/block.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/common/block.c b/common/block.c
> index 8d0de42d90..549df71a9d 100644
> --- a/common/block.c
> +++ b/common/block.c
> @@ -329,13 +329,6 @@ static ssize_t block_op_write(struct cdev *cdev, const void *buf, size_t count,
> }
> #endif
>
> -static int block_op_close(struct cdev *cdev)
> -{
> - struct block_device *blk = cdev->priv;
> -
> - return writebuffer_flush(blk);
> -}
> -
> static int block_op_flush(struct cdev *cdev)
> {
> struct block_device *blk = cdev->priv;
> @@ -343,6 +336,8 @@ static int block_op_flush(struct cdev *cdev)
> return writebuffer_flush(blk);
> }
>
> +static int block_op_close(struct cdev *cdev) __alias(block_op_flush);
> +
> static struct cdev_operations block_ops = {
> .read = block_op_read,
> #ifdef CONFIG_BLOCK_WRITE
> --
> 2.20.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-16 7:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-12 5:58 [PATCH 1/2] block: Alias block_op_close() to block_op_flush() Andrey Smirnov
2019-01-12 5:58 ` [PATCH 2/2] block: Replace debug() with dev_dbg() Andrey Smirnov
2019-01-16 7:29 ` [PATCH 1/2] block: Alias block_op_close() to block_op_flush() Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox