mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drbd: mark symbols static where possible
@ 2016-09-01 10:57 Baoyou Xie
  2016-09-02  8:18 ` Philipp Reisner
  0 siblings, 1 reply; 3+ messages in thread
From: Baoyou Xie @ 2016-09-01 10:57 UTC (permalink / raw)
  To: philipp.reisner, lars.ellenberg
  Cc: drbd-dev, linux-kernel, arnd, baoyou.xie, xie.baoyou

We get a few warnings when building kernel with W=1:
drivers/block/drbd/drbd_receiver.c:1224:6: warning: no previous prototype for 'one_flush_endio' [-Wmissing-prototypes]
drivers/block/drbd/drbd_req.c:1450:6: warning: no previous prototype for 'send_and_submit_pending' [-Wmissing-prototypes]
drivers/block/drbd/drbd_main.c:924:6: warning: no previous prototype for 'assign_p_sizes_qlim' [-Wmissing-prototypes]
....

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
---
 drivers/block/drbd/drbd_main.c     | 4 +++-
 drivers/block/drbd/drbd_receiver.c | 2 +-
 drivers/block/drbd/drbd_req.c      | 3 ++-
 drivers/block/drbd/drbd_worker.c   | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 100be55..f0aa746 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -921,7 +921,9 @@ void drbd_gen_and_send_sync_uuid(struct drbd_peer_device *peer_device)
 }
 
 /* communicated if (agreed_features & DRBD_FF_WSAME) */
-void assign_p_sizes_qlim(struct drbd_device *device, struct p_sizes *p, struct request_queue *q)
+static void
+assign_p_sizes_qlim(struct drbd_device *device, struct p_sizes *p,
+					struct request_queue *q)
 {
 	if (q) {
 		p->qlim->physical_block_size = cpu_to_be32(queue_physical_block_size(q));
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 942384f..432f39a 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1221,7 +1221,7 @@ struct one_flush_context {
 	struct issue_flush_context *ctx;
 };
 
-void one_flush_endio(struct bio *bio)
+static void one_flush_endio(struct bio *bio)
 {
 	struct one_flush_context *octx = bio->bi_private;
 	struct drbd_device *device = octx->device;
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index de279fe..c725bf5 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -1447,7 +1447,8 @@ static bool prepare_al_transaction_nonblock(struct drbd_device *device,
 	return !list_empty(pending);
 }
 
-void send_and_submit_pending(struct drbd_device *device, struct list_head *pending)
+static void
+send_and_submit_pending(struct drbd_device *device, struct list_head *pending)
 {
 	struct drbd_request *req, *tmp;
 
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index c6755c9..70f2706 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -194,7 +194,8 @@ void drbd_peer_request_endio(struct bio *bio)
 	}
 }
 
-void drbd_panic_after_delayed_completion_of_aborted_request(struct drbd_device *device)
+static void
+drbd_panic_after_delayed_completion_of_aborted_request(struct drbd_device *device)
 {
 	panic("drbd%u %s/%u potential random memory corruption caused by delayed completion of aborted local request\n",
 		device->minor, device->resource->name, device->vnr);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drbd: mark symbols static where possible
  2016-09-01 10:57 [PATCH] drbd: mark symbols static where possible Baoyou Xie
@ 2016-09-02  8:18 ` Philipp Reisner
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Reisner @ 2016-09-02  8:18 UTC (permalink / raw)
  To: Baoyou Xie; +Cc: lars.ellenberg, drbd-dev, linux-kernel, arnd, xie.baoyou

Hi Baoyou,

thanks for the patch. I applied it to our tree. Will be sent to
one of the next merge windows...

best regards,
 Phil
Am Donnerstag, 1. September 2016, 18:57:53 CEST schrieb Baoyou Xie:
> We get a few warnings when building kernel with W=1:
> drivers/block/drbd/drbd_receiver.c:1224:6: warning: no previous prototype
> for 'one_flush_endio' [-Wmissing-prototypes]
> drivers/block/drbd/drbd_req.c:1450:6: warning: no previous prototype for
> 'send_and_submit_pending' [-Wmissing-prototypes]
> drivers/block/drbd/drbd_main.c:924:6: warning: no previous prototype for
> 'assign_p_sizes_qlim' [-Wmissing-prototypes] ....
> 
> In fact, these functions are only used in the file in which they are
> declared and don't need a declaration, but can be made static.
> So this patch marks these functions with 'static'.
> 
> Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
> ---
>  drivers/block/drbd/drbd_main.c     | 4 +++-
>  drivers/block/drbd/drbd_receiver.c | 2 +-
>  drivers/block/drbd/drbd_req.c      | 3 ++-
>  drivers/block/drbd/drbd_worker.c   | 3 ++-
>  4 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
> index 100be55..f0aa746 100644
> --- a/drivers/block/drbd/drbd_main.c
> +++ b/drivers/block/drbd/drbd_main.c
> @@ -921,7 +921,9 @@ void drbd_gen_and_send_sync_uuid(struct drbd_peer_device
> *peer_device) }
> 
>  /* communicated if (agreed_features & DRBD_FF_WSAME) */
> -void assign_p_sizes_qlim(struct drbd_device *device, struct p_sizes *p,
> struct request_queue *q) +static void
> +assign_p_sizes_qlim(struct drbd_device *device, struct p_sizes *p,
> +					struct request_queue *q)
>  {
>  	if (q) {
>  		p->qlim->physical_block_size = 
cpu_to_be32(queue_physical_block_size(q));
> diff --git a/drivers/block/drbd/drbd_receiver.c
> b/drivers/block/drbd/drbd_receiver.c index 942384f..432f39a 100644
> --- a/drivers/block/drbd/drbd_receiver.c
> +++ b/drivers/block/drbd/drbd_receiver.c
> @@ -1221,7 +1221,7 @@ struct one_flush_context {
>  	struct issue_flush_context *ctx;
>  };
> 
> -void one_flush_endio(struct bio *bio)
> +static void one_flush_endio(struct bio *bio)
>  {
>  	struct one_flush_context *octx = bio->bi_private;
>  	struct drbd_device *device = octx->device;
> diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
> index de279fe..c725bf5 100644
> --- a/drivers/block/drbd/drbd_req.c
> +++ b/drivers/block/drbd/drbd_req.c
> @@ -1447,7 +1447,8 @@ static bool prepare_al_transaction_nonblock(struct
> drbd_device *device, return !list_empty(pending);
>  }
> 
> -void send_and_submit_pending(struct drbd_device *device, struct list_head
> *pending) +static void
> +send_and_submit_pending(struct drbd_device *device, struct list_head
> *pending) {
>  	struct drbd_request *req, *tmp;
> 
> diff --git a/drivers/block/drbd/drbd_worker.c
> b/drivers/block/drbd/drbd_worker.c index c6755c9..70f2706 100644
> --- a/drivers/block/drbd/drbd_worker.c
> +++ b/drivers/block/drbd/drbd_worker.c
> @@ -194,7 +194,8 @@ void drbd_peer_request_endio(struct bio *bio)
>  	}
>  }
> 
> -void drbd_panic_after_delayed_completion_of_aborted_request(struct
> drbd_device *device) +static void
> +drbd_panic_after_delayed_completion_of_aborted_request(struct drbd_device
> *device) {
>  	panic("drbd%u %s/%u potential random memory corruption caused by delayed
> completion of aborted local request\n", device->minor,
> device->resource->name, device->vnr);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] drbd: mark symbols static where possible
@ 2016-09-24  4:19 Baoyou Xie
  0 siblings, 0 replies; 3+ messages in thread
From: Baoyou Xie @ 2016-09-24  4:19 UTC (permalink / raw)
  To: philipp.reisner, lars.ellenberg
  Cc: drbd-dev, linux-kernel, arnd, baoyou.xie, xie.baoyou

We get 4 warnings when building kernel with W=1:
drivers/block/drbd/drbd_worker.c:197:6: warning: no previous prototype for 'drbd_panic_after_delayed_completion_of_aborted_request' [-Wmissing-prototypes]
drivers/block/drbd/drbd_receiver.c:1224:6: warning: no previous prototype for 'one_flush_endio' [-Wmissing-prototypes]
drivers/block/drbd/drbd_req.c:1450:6: warning: no previous prototype for 'send_and_submit_pending' [-Wmissing-prototypes]
drivers/block/drbd/drbd_main.c:924:6: warning: no previous prototype for 'assign_p_sizes_qlim' [-Wmissing-prototypes]

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
So this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
---
 drivers/block/drbd/drbd_main.c     | 3 ++-
 drivers/block/drbd/drbd_receiver.c | 2 +-
 drivers/block/drbd/drbd_req.c      | 3 ++-
 drivers/block/drbd/drbd_worker.c   | 3 ++-
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 100be55..c3133c5 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -921,7 +921,8 @@ void drbd_gen_and_send_sync_uuid(struct drbd_peer_device *peer_device)
 }
 
 /* communicated if (agreed_features & DRBD_FF_WSAME) */
-void assign_p_sizes_qlim(struct drbd_device *device, struct p_sizes *p, struct request_queue *q)
+static void assign_p_sizes_qlim(struct drbd_device *device, struct p_sizes *p,
+				struct request_queue *q)
 {
 	if (q) {
 		p->qlim->physical_block_size = cpu_to_be32(queue_physical_block_size(q));
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 942384f..432f39a 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1221,7 +1221,7 @@ struct one_flush_context {
 	struct issue_flush_context *ctx;
 };
 
-void one_flush_endio(struct bio *bio)
+static void one_flush_endio(struct bio *bio)
 {
 	struct one_flush_context *octx = bio->bi_private;
 	struct drbd_device *device = octx->device;
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index de279fe..c725bf5 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -1447,7 +1447,8 @@ static bool prepare_al_transaction_nonblock(struct drbd_device *device,
 	return !list_empty(pending);
 }
 
-void send_and_submit_pending(struct drbd_device *device, struct list_head *pending)
+static void
+send_and_submit_pending(struct drbd_device *device, struct list_head *pending)
 {
 	struct drbd_request *req, *tmp;
 
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index c6755c9..70f2706 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -194,7 +194,8 @@ void drbd_peer_request_endio(struct bio *bio)
 	}
 }
 
-void drbd_panic_after_delayed_completion_of_aborted_request(struct drbd_device *device)
+static void
+drbd_panic_after_delayed_completion_of_aborted_request(struct drbd_device *device)
 {
 	panic("drbd%u %s/%u potential random memory corruption caused by delayed completion of aborted local request\n",
 		device->minor, device->resource->name, device->vnr);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-24  4:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-01 10:57 [PATCH] drbd: mark symbols static where possible Baoyou Xie
2016-09-02  8:18 ` Philipp Reisner
2016-09-24  4:19 Baoyou Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®