Commit c4717755 authored by Ben Collins's avatar Ben Collins Committed by Linus Torvalds

[PATCH] Update IEEE1394 (r931)

- Fix possible memory leak in iso.c
- Added handling for more than 1 Logical_Unit_Number entry in a unit
  directory for SBP-2. This allows for handling the second type of LUN
  that we didn't support yet.
parent f77fb2ba
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
printk(KERN_ERR fmt, ## args) printk(KERN_ERR fmt, ## args)
static char version[] __devinitdata = static char version[] __devinitdata =
"$Rev: 918 $ Ben Collins <bcollins@debian.org>"; "$Rev: 931 $ Ben Collins <bcollins@debian.org>";
/* Our ieee1394 highlevel driver */ /* Our ieee1394 highlevel driver */
#define ETHER1394_DRIVER_NAME "ether1394" #define ETHER1394_DRIVER_NAME "ether1394"
......
...@@ -32,7 +32,6 @@ void hpsb_iso_shutdown(struct hpsb_iso *iso) ...@@ -32,7 +32,6 @@ void hpsb_iso_shutdown(struct hpsb_iso *iso)
} }
dma_region_free(&iso->data_buf); dma_region_free(&iso->data_buf);
kfree(iso->infos);
kfree(iso); kfree(iso);
} }
...@@ -70,14 +69,11 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i ...@@ -70,14 +69,11 @@ static struct hpsb_iso* hpsb_iso_common_init(struct hpsb_host *host, enum hpsb_i
/* allocate and write the struct hpsb_iso */ /* allocate and write the struct hpsb_iso */
iso = kmalloc(sizeof(*iso), SLAB_KERNEL); iso = kmalloc(sizeof(*iso) + buf_packets * sizeof(struct hpsb_iso_packet_info), GFP_KERNEL);
if(!iso) if(!iso)
return NULL; return NULL;
/* allocate ringbuffer of packet descriptors */ iso->infos = (struct hpsb_iso_packet_info *)(iso + 1);
iso->infos = kmalloc(buf_packets * sizeof(struct hpsb_iso_packet_info), SLAB_KERNEL);
if(!iso->infos)
return NULL;
iso->type = type; iso->type = type;
iso->host = host; iso->host = host;
......
...@@ -79,9 +79,6 @@ struct hpsb_iso { ...@@ -79,9 +79,6 @@ struct hpsb_iso {
/* size of data_buf, in bytes (always a multiple of PAGE_SIZE) */ /* size of data_buf, in bytes (always a multiple of PAGE_SIZE) */
unsigned int buf_size; unsigned int buf_size;
/* ringbuffer of packet descriptors in regular kernel memory */
struct hpsb_iso_packet_info *infos;
/* # of packets in the ringbuffer */ /* # of packets in the ringbuffer */
unsigned int buf_packets; unsigned int buf_packets;
...@@ -118,6 +115,11 @@ struct hpsb_iso { ...@@ -118,6 +115,11 @@ struct hpsb_iso {
/* cycle at which next packet will be transmitted, /* cycle at which next packet will be transmitted,
-1 if not known */ -1 if not known */
int xmit_cycle; int xmit_cycle;
/* ringbuffer of packet descriptors in regular kernel memory
* XXX Keep this last, since we use over-allocated memory from
* this entry to fill this field. */
struct hpsb_iso_packet_info *infos;
}; };
/* functions available to high-level drivers (e.g. raw1394) */ /* functions available to high-level drivers (e.g. raw1394) */
......
...@@ -164,7 +164,7 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args) ...@@ -164,7 +164,7 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args)
printk(level "%s_%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args) printk(level "%s_%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args)
static char version[] __devinitdata = static char version[] __devinitdata =
"$Rev: 921 $ Ben Collins <bcollins@debian.org>"; "$Rev: 931 $ Ben Collins <bcollins@debian.org>";
/* Module Parameters */ /* Module Parameters */
static int phys_dma = 1; static int phys_dma = 1;
...@@ -2446,7 +2446,7 @@ static irqreturn_t ohci_irq_handler(int irq, void *dev_id, ...@@ -2446,7 +2446,7 @@ static irqreturn_t ohci_irq_handler(int irq, void *dev_id,
reg_write(ohci,OHCI1394_PhyReqFilterLoSet, 0x00000000); reg_write(ohci,OHCI1394_PhyReqFilterLoSet, 0x00000000);
} }
DBGMSG(ohci->id, "PhyReqFilter=%08x%08x\n", DBGMSG(ohci->id, "PhyReqFilter=%08x%08x",
reg_read(ohci,OHCI1394_PhyReqFilterHiSet), reg_read(ohci,OHCI1394_PhyReqFilterHiSet),
reg_read(ohci,OHCI1394_PhyReqFilterLoSet)); reg_read(ohci,OHCI1394_PhyReqFilterLoSet));
......
This diff is collapsed.
...@@ -384,7 +384,6 @@ struct scsi_id_instance_data { ...@@ -384,7 +384,6 @@ struct scsi_id_instance_data {
/* /*
* Values pulled from the device's unit directory * Values pulled from the device's unit directory
*/ */
struct unit_directory *ud;
u32 sbp2_command_set_spec_id; u32 sbp2_command_set_spec_id;
u32 sbp2_command_set; u32 sbp2_command_set;
u32 sbp2_unit_characteristics; u32 sbp2_unit_characteristics;
...@@ -403,6 +402,8 @@ struct scsi_id_instance_data { ...@@ -403,6 +402,8 @@ struct scsi_id_instance_data {
struct list_head sbp2_command_orb_inuse; struct list_head sbp2_command_orb_inuse;
struct list_head sbp2_command_orb_completed; struct list_head sbp2_command_orb_completed;
struct list_head list;
/* Node entry, as retrieved from NodeMgr entries */ /* Node entry, as retrieved from NodeMgr entries */
struct node_entry *ne; struct node_entry *ne;
...@@ -413,6 +414,13 @@ struct scsi_id_instance_data { ...@@ -413,6 +414,13 @@ struct scsi_id_instance_data {
u32 workarounds; u32 workarounds;
}; };
/* Describes a per-ud scsi_id group */
struct scsi_id_group {
struct list_head scsi_id_list;
};
/* /*
* Sbp2 host data structure (one per sbp2 host) * Sbp2 host data structure (one per sbp2 host)
*/ */
...@@ -464,8 +472,9 @@ static int sbp2_probe(struct device *dev); ...@@ -464,8 +472,9 @@ static int sbp2_probe(struct device *dev);
static int sbp2_remove(struct device *dev); static int sbp2_remove(struct device *dev);
static void sbp2_update(struct unit_directory *ud); static void sbp2_update(struct unit_directory *ud);
static int sbp2_start_device(struct sbp2scsi_host_info *hi, static int sbp2_start_ud(struct sbp2scsi_host_info *hi,
struct unit_directory *ud); struct unit_directory *ud);
static int sbp2_start_device(struct scsi_id_instance_data *scsi_id);
static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id); static void sbp2_remove_device(struct scsi_id_instance_data *scsi_id);
#ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA #ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA
...@@ -499,7 +508,8 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id, ...@@ -499,7 +508,8 @@ static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data); static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data);
static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd); static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd);
static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, Scsi_Cmnd *SCpnt); static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, Scsi_Cmnd *SCpnt);
static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id); static void sbp2_parse_unit_directory(struct scsi_id_group *scsi_group,
struct unit_directory *ud);
static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id); static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id);
static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id); static int sbp2_max_speed_and_size(struct scsi_id_instance_data *scsi_id);
......
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