public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sg: remove unnecessary function declarations
@ 2009-02-11 17:42 FUJITA Tomonori
  2009-02-11 17:42 ` [PATCH 2/2] sg: use ALIGN macro FUJITA Tomonori
  2009-02-15  0:16 ` [PATCH 1/2] sg: remove unnecessary function declarations Douglas Gilbert
  0 siblings, 2 replies; 4+ messages in thread
From: FUJITA Tomonori @ 2009-02-11 17:42 UTC (permalink / raw)
  To: linux-scsi; +Cc: James.Bottomley, dgilbert, fujita.tomonori

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 drivers/scsi/sg.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 912a9eb..d17d89b 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -101,7 +101,6 @@ static int scatter_elem_sz_prev = SG_SCATTER_SZ;
 #define SG_SECTOR_MSK (SG_SECTOR_SZ - 1)
 
 static int sg_add(struct device *, struct class_interface *);
-static void sg_device_destroy(struct kref *kref);
 static void sg_remove(struct device *, struct class_interface *);
 
 static DEFINE_IDR(sg_index_idr);
@@ -178,14 +177,11 @@ typedef struct sg_device { /* holds the state of each scsi generic device */
 	struct kref d_ref;
 } Sg_device;
 
-static int sg_fasync(int fd, struct file *filp, int mode);
 /* tasklet or soft irq callback */
 static void sg_rq_end_io(struct request *rq, int uptodate);
 static int sg_start_req(Sg_request *srp, unsigned char *cmd);
 static void sg_finish_rem_req(Sg_request * srp);
 static int sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size);
-static int sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp,
-			 int tablesize);
 static ssize_t sg_new_read(Sg_fd * sfp, char __user *buf, size_t count,
 			   Sg_request * srp);
 static ssize_t sg_new_write(Sg_fd *sfp, struct file *file,
@@ -204,12 +200,8 @@ static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id);
 static Sg_request *sg_add_request(Sg_fd * sfp);
 static int sg_remove_request(Sg_fd * sfp, Sg_request * srp);
 static int sg_res_in_use(Sg_fd * sfp);
-static Sg_device *sg_lookup_dev(int dev);
 static Sg_device *sg_get_dev(int dev);
 static void sg_put_dev(Sg_device *sdp);
-#ifdef CONFIG_SCSI_PROC_FS
-static int sg_last_dev(void);
-#endif
 
 #define SZ_SG_HEADER sizeof(struct sg_header)
 #define SZ_SG_IO_HDR sizeof(sg_io_hdr_t)
-- 
1.6.0.6


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

* [PATCH 2/2] sg: use ALIGN macro
  2009-02-11 17:42 [PATCH 1/2] sg: remove unnecessary function declarations FUJITA Tomonori
@ 2009-02-11 17:42 ` FUJITA Tomonori
  2009-02-15  0:17   ` Douglas Gilbert
  2009-02-15  0:16 ` [PATCH 1/2] sg: remove unnecessary function declarations Douglas Gilbert
  1 sibling, 1 reply; 4+ messages in thread
From: FUJITA Tomonori @ 2009-02-11 17:42 UTC (permalink / raw)
  To: linux-scsi; +Cc: James.Bottomley, dgilbert, fujita.tomonori

This changes sg_build_indirect() to use ALIGN macro instead of
calculating by hand.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 drivers/scsi/sg.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index d17d89b..b459864 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -98,7 +98,6 @@ static int scatter_elem_sz = SG_SCATTER_SZ;
 static int scatter_elem_sz_prev = SG_SCATTER_SZ;
 
 #define SG_SECTOR_SZ 512
-#define SG_SECTOR_MSK (SG_SECTOR_SZ - 1)
 
 static int sg_add(struct device *, struct class_interface *);
 static void sg_remove(struct device *, struct class_interface *);
@@ -1723,8 +1722,8 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
 		return -EFAULT;
 	if (0 == blk_size)
 		++blk_size;	/* don't know why */
-/* round request up to next highest SG_SECTOR_SZ byte boundary */
-	blk_size = (blk_size + SG_SECTOR_MSK) & (~SG_SECTOR_MSK);
+	/* round request up to next highest SG_SECTOR_SZ byte boundary */
+	blk_size = ALIGN(blk_size, SG_SECTOR_SZ);
 	SCSI_LOG_TIMEOUT(4, printk("sg_build_indirect: buff_size=%d, blk_size=%d\n",
 				   buff_size, blk_size));
 
-- 
1.6.0.6


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

* Re: [PATCH 1/2] sg: remove unnecessary function declarations
  2009-02-11 17:42 [PATCH 1/2] sg: remove unnecessary function declarations FUJITA Tomonori
  2009-02-11 17:42 ` [PATCH 2/2] sg: use ALIGN macro FUJITA Tomonori
@ 2009-02-15  0:16 ` Douglas Gilbert
  1 sibling, 0 replies; 4+ messages in thread
From: Douglas Gilbert @ 2009-02-15  0:16 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-scsi, James.Bottomley

FUJITA Tomonori wrote:
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> ---
>  drivers/scsi/sg.c |    8 --------
>  1 files changed, 0 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index 912a9eb..d17d89b 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -101,7 +101,6 @@ static int scatter_elem_sz_prev = SG_SCATTER_SZ;
>  #define SG_SECTOR_MSK (SG_SECTOR_SZ - 1)
>  
>  static int sg_add(struct device *, struct class_interface *);
> -static void sg_device_destroy(struct kref *kref);
>  static void sg_remove(struct device *, struct class_interface *);
>  
>  static DEFINE_IDR(sg_index_idr);
> @@ -178,14 +177,11 @@ typedef struct sg_device { /* holds the state of each scsi generic device */
>  	struct kref d_ref;
>  } Sg_device;
>  
> -static int sg_fasync(int fd, struct file *filp, int mode);
>  /* tasklet or soft irq callback */
>  static void sg_rq_end_io(struct request *rq, int uptodate);
>  static int sg_start_req(Sg_request *srp, unsigned char *cmd);
>  static void sg_finish_rem_req(Sg_request * srp);
>  static int sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size);
> -static int sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp,
> -			 int tablesize);
>  static ssize_t sg_new_read(Sg_fd * sfp, char __user *buf, size_t count,
>  			   Sg_request * srp);
>  static ssize_t sg_new_write(Sg_fd *sfp, struct file *file,
> @@ -204,12 +200,8 @@ static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id);
>  static Sg_request *sg_add_request(Sg_fd * sfp);
>  static int sg_remove_request(Sg_fd * sfp, Sg_request * srp);
>  static int sg_res_in_use(Sg_fd * sfp);
> -static Sg_device *sg_lookup_dev(int dev);
>  static Sg_device *sg_get_dev(int dev);
>  static void sg_put_dev(Sg_device *sdp);
> -#ifdef CONFIG_SCSI_PROC_FS
> -static int sg_last_dev(void);
> -#endif
>  
>  #define SZ_SG_HEADER sizeof(struct sg_header)
>  #define SZ_SG_IO_HDR sizeof(sg_io_hdr_t)

Tomo,
Thanks.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>


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

* Re: [PATCH 2/2] sg: use ALIGN macro
  2009-02-11 17:42 ` [PATCH 2/2] sg: use ALIGN macro FUJITA Tomonori
@ 2009-02-15  0:17   ` Douglas Gilbert
  0 siblings, 0 replies; 4+ messages in thread
From: Douglas Gilbert @ 2009-02-15  0:17 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linux-scsi, James.Bottomley

FUJITA Tomonori wrote:
> This changes sg_build_indirect() to use ALIGN macro instead of
> calculating by hand.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> ---
>  drivers/scsi/sg.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index d17d89b..b459864 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -98,7 +98,6 @@ static int scatter_elem_sz = SG_SCATTER_SZ;
>  static int scatter_elem_sz_prev = SG_SCATTER_SZ;
>  
>  #define SG_SECTOR_SZ 512
> -#define SG_SECTOR_MSK (SG_SECTOR_SZ - 1)
>  
>  static int sg_add(struct device *, struct class_interface *);
>  static void sg_remove(struct device *, struct class_interface *);
> @@ -1723,8 +1722,8 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
>  		return -EFAULT;
>  	if (0 == blk_size)
>  		++blk_size;	/* don't know why */
> -/* round request up to next highest SG_SECTOR_SZ byte boundary */
> -	blk_size = (blk_size + SG_SECTOR_MSK) & (~SG_SECTOR_MSK);
> +	/* round request up to next highest SG_SECTOR_SZ byte boundary */
> +	blk_size = ALIGN(blk_size, SG_SECTOR_SZ);
>  	SCSI_LOG_TIMEOUT(4, printk("sg_build_indirect: buff_size=%d, blk_size=%d\n",
>  				   buff_size, blk_size));
>  

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>


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

end of thread, other threads:[~2009-02-15  0:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-11 17:42 [PATCH 1/2] sg: remove unnecessary function declarations FUJITA Tomonori
2009-02-11 17:42 ` [PATCH 2/2] sg: use ALIGN macro FUJITA Tomonori
2009-02-15  0:17   ` Douglas Gilbert
2009-02-15  0:16 ` [PATCH 1/2] sg: remove unnecessary function declarations Douglas Gilbert

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