Skip to content

Commit

Permalink
[SCSI] aic7xxx: add const
Browse files Browse the repository at this point in the history
This patch adds more const keywords where appropriate.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Acked-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
  • Loading branch information
Denys Vlasenko authored and James Bottomley committed Apr 27, 2008
1 parent d1d7b19 commit 980b306
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 66 deletions.
6 changes: 3 additions & 3 deletions drivers/scsi/aic7xxx/aic79xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ struct ahd_tmode_tstate {
struct ahd_phase_table_entry {
uint8_t phase;
uint8_t mesg_out; /* Message response to parity errors */
char *phasemsg;
const char *phasemsg;
};

/************************** Serial EEPROM Format ******************************/
Expand Down Expand Up @@ -1335,9 +1335,9 @@ extern const int ahd_num_aic7770_devs;
/******************************************************************************/

/***************************** PCI Front End *********************************/
struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t);
const struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t);
int ahd_pci_config(struct ahd_softc *,
struct ahd_pci_identity *);
const struct ahd_pci_identity *);
int ahd_pci_test_register_access(struct ahd_softc *);
#ifdef CONFIG_PM
void ahd_pci_suspend(struct ahd_softc *);
Expand Down
28 changes: 14 additions & 14 deletions drivers/scsi/aic7xxx/aic79xx_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@


/***************************** Lookup Tables **********************************/
static char *ahd_chip_names[] =
static const char *const ahd_chip_names[] =
{
"NONE",
"aic7901",
Expand All @@ -66,10 +66,10 @@ static const u_int num_chip_names = ARRAY_SIZE(ahd_chip_names);
*/
struct ahd_hard_error_entry {
uint8_t errno;
char *errmesg;
const char *errmesg;
};

static struct ahd_hard_error_entry ahd_hard_errors[] = {
static const struct ahd_hard_error_entry ahd_hard_errors[] = {
{ DSCTMOUT, "Discard Timer has timed out" },
{ ILLOPCODE, "Illegal Opcode in sequencer program" },
{ SQPARERR, "Sequencer Parity Error" },
Expand All @@ -79,7 +79,7 @@ static struct ahd_hard_error_entry ahd_hard_errors[] = {
};
static const u_int num_errors = ARRAY_SIZE(ahd_hard_errors);

static struct ahd_phase_table_entry ahd_phase_table[] =
static const struct ahd_phase_table_entry ahd_phase_table[] =
{
{ P_DATAOUT, MSG_NOOP, "in Data-out phase" },
{ P_DATAIN, MSG_INITIATOR_DET_ERR, "in Data-in phase" },
Expand Down Expand Up @@ -213,7 +213,7 @@ static void ahd_dumpseq(struct ahd_softc *ahd);
#endif
static void ahd_loadseq(struct ahd_softc *ahd);
static int ahd_check_patch(struct ahd_softc *ahd,
struct patch **start_patch,
const struct patch **start_patch,
u_int start_instr, u_int *skip_addr);
static u_int ahd_resolve_seqaddr(struct ahd_softc *ahd,
u_int address);
Expand Down Expand Up @@ -254,7 +254,7 @@ static void ahd_freeze_devq(struct ahd_softc *ahd,
struct scb *scb);
static void ahd_handle_scb_status(struct ahd_softc *ahd,
struct scb *scb);
static struct ahd_phase_table_entry* ahd_lookup_phase_entry(int phase);
static const struct ahd_phase_table_entry* ahd_lookup_phase_entry(int phase);
static void ahd_shutdown(void *arg);
static void ahd_update_coalescing_values(struct ahd_softc *ahd,
u_int timer,
Expand Down Expand Up @@ -4337,11 +4337,11 @@ ahd_print_devinfo(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)
devinfo->target, devinfo->lun);
}

static struct ahd_phase_table_entry*
static const struct ahd_phase_table_entry*
ahd_lookup_phase_entry(int phase)
{
struct ahd_phase_table_entry *entry;
struct ahd_phase_table_entry *last_entry;
const struct ahd_phase_table_entry *entry;
const struct ahd_phase_table_entry *last_entry;

/*
* num_phases doesn't include the default entry which
Expand Down Expand Up @@ -9354,7 +9354,7 @@ ahd_loadseq(struct ahd_softc *ahd)
struct cs cs_table[num_critical_sections];
u_int begin_set[num_critical_sections];
u_int end_set[num_critical_sections];
struct patch *cur_patch;
const struct patch *cur_patch;
u_int cs_count;
u_int cur_cs;
u_int i;
Expand Down Expand Up @@ -9509,11 +9509,11 @@ ahd_loadseq(struct ahd_softc *ahd)
}

static int
ahd_check_patch(struct ahd_softc *ahd, struct patch **start_patch,
ahd_check_patch(struct ahd_softc *ahd, const struct patch **start_patch,
u_int start_instr, u_int *skip_addr)
{
struct patch *cur_patch;
struct patch *last_patch;
const struct patch *cur_patch;
const struct patch *last_patch;
u_int num_patches;

num_patches = ARRAY_SIZE(patches);
Expand Down Expand Up @@ -9547,7 +9547,7 @@ ahd_check_patch(struct ahd_softc *ahd, struct patch **start_patch,
static u_int
ahd_resolve_seqaddr(struct ahd_softc *ahd, u_int address)
{
struct patch *cur_patch;
const struct patch *cur_patch;
int address_offset;
u_int skip_addr;
u_int i;
Expand Down
18 changes: 8 additions & 10 deletions drivers/scsi/aic7xxx/aic79xx_osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ struct ahd_linux_iocell_opts
#define AIC79XX_PRECOMP_INDEX 0
#define AIC79XX_SLEWRATE_INDEX 1
#define AIC79XX_AMPLITUDE_INDEX 2
static struct ahd_linux_iocell_opts aic79xx_iocell_info[] =
static const struct ahd_linux_iocell_opts aic79xx_iocell_info[] =
{
AIC79XX_DEFAULT_IOOPTS,
AIC79XX_DEFAULT_IOOPTS,
Expand Down Expand Up @@ -557,13 +557,11 @@ ahd_linux_info(struct Scsi_Host *host)
bp = &buffer[0];
ahd = *(struct ahd_softc **)host->hostdata;
memset(bp, 0, sizeof(buffer));
strcpy(bp, "Adaptec AIC79XX PCI-X SCSI HBA DRIVER, Rev ");
strcat(bp, AIC79XX_DRIVER_VERSION);
strcat(bp, "\n");
strcat(bp, " <");
strcpy(bp, "Adaptec AIC79XX PCI-X SCSI HBA DRIVER, Rev " AIC79XX_DRIVER_VERSION "\n"
" <");
strcat(bp, ahd->description);
strcat(bp, ">\n");
strcat(bp, " ");
strcat(bp, ">\n"
" ");
ahd_controller_info(ahd, ahd_info);
strcat(bp, ahd_info);

Expand Down Expand Up @@ -1148,7 +1146,7 @@ aic79xx_setup(char *s)
char *p;
char *end;

static struct {
static const struct {
const char *name;
uint32_t *flag;
} options[] = {
Expand Down Expand Up @@ -1380,7 +1378,7 @@ ahd_platform_init(struct ahd_softc *ahd)
* Lookup and commit any modified IO Cell options.
*/
if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
struct ahd_linux_iocell_opts *iocell_opts;
const struct ahd_linux_iocell_opts *iocell_opts;

iocell_opts = &aic79xx_iocell_info[ahd->unit];
if (iocell_opts->precomp != AIC79XX_DEFAULT_PRECOMP)
Expand Down Expand Up @@ -2770,7 +2768,7 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp)
uint8_t precomp;

if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
struct ahd_linux_iocell_opts *iocell_opts;
const struct ahd_linux_iocell_opts *iocell_opts;

iocell_opts = &aic79xx_iocell_info[ahd->unit];
precomp = iocell_opts->precomp;
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/aic7xxx/aic79xx_osm_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
ID2C(x), \
ID2C(IDIROC(x))

static struct pci_device_id ahd_linux_pci_id_table[] = {
static const struct pci_device_id ahd_linux_pci_id_table[] = {
/* aic7901 based controllers */
ID(ID_AHA_29320A),
ID(ID_AHA_29320ALP),
Expand Down Expand Up @@ -159,7 +159,7 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
char buf[80];
struct ahd_softc *ahd;
ahd_dev_softc_t pci;
struct ahd_pci_identity *entry;
const struct ahd_pci_identity *entry;
char *name;
int error;
struct device *dev = &pdev->dev;
Expand Down
8 changes: 4 additions & 4 deletions drivers/scsi/aic7xxx/aic79xx_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static ahd_device_setup_t ahd_aic7901A_setup;
static ahd_device_setup_t ahd_aic7902_setup;
static ahd_device_setup_t ahd_aic790X_setup;

static struct ahd_pci_identity ahd_pci_ident_table[] =
static const struct ahd_pci_identity ahd_pci_ident_table[] =
{
/* aic7901 based controllers */
{
Expand Down Expand Up @@ -253,15 +253,15 @@ static void ahd_configure_termination(struct ahd_softc *ahd,
static void ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat);
static void ahd_pci_intr(struct ahd_softc *ahd);

struct ahd_pci_identity *
const struct ahd_pci_identity *
ahd_find_pci_device(ahd_dev_softc_t pci)
{
uint64_t full_id;
uint16_t device;
uint16_t vendor;
uint16_t subdevice;
uint16_t subvendor;
struct ahd_pci_identity *entry;
const struct ahd_pci_identity *entry;
u_int i;

vendor = ahd_pci_read_config(pci, PCIR_DEVVENDOR, /*bytes*/2);
Expand Down Expand Up @@ -292,7 +292,7 @@ ahd_find_pci_device(ahd_dev_softc_t pci)
}

int
ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry)
ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry)
{
struct scb_data *shared_scb_data;
u_int command;
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/aic7xxx/aic79xx_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int ahd_proc_write_seeprom(struct ahd_softc *ahd,
* Table of syncrates that don't follow the "divisible by 4"
* rule. This table will be expanded in future SCSI specs.
*/
static struct {
static const struct {
u_int period_factor;
u_int period; /* in 100ths of ns */
} scsi_syncrates[] = {
Expand Down
6 changes: 3 additions & 3 deletions drivers/scsi/aic7xxx/aic7xxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ typedef int (ahc_device_setup_t)(struct ahc_softc *);
struct ahc_pci_identity {
uint64_t full_id;
uint64_t id_mask;
char *name;
const char *name;
ahc_device_setup_t *setup;
};

Expand All @@ -1135,9 +1135,9 @@ extern const int ahc_num_aic7770_devs;
/******************************************************************************/

/***************************** PCI Front End *********************************/
struct ahc_pci_identity *ahc_find_pci_device(ahc_dev_softc_t);
const struct ahc_pci_identity *ahc_find_pci_device(ahc_dev_softc_t);
int ahc_pci_config(struct ahc_softc *,
struct ahc_pci_identity *);
const struct ahc_pci_identity *);
int ahc_pci_test_register_access(struct ahc_softc *);
#ifdef CONFIG_PM
void ahc_pci_resume(struct ahc_softc *ahc);
Expand Down
16 changes: 8 additions & 8 deletions drivers/scsi/aic7xxx/aic7xxx_93cx6.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ struct seeprom_cmd {
};

/* Short opcodes for the c46 */
static struct seeprom_cmd seeprom_ewen = {9, {1, 0, 0, 1, 1, 0, 0, 0, 0}};
static struct seeprom_cmd seeprom_ewds = {9, {1, 0, 0, 0, 0, 0, 0, 0, 0}};
static const struct seeprom_cmd seeprom_ewen = {9, {1, 0, 0, 1, 1, 0, 0, 0, 0}};
static const struct seeprom_cmd seeprom_ewds = {9, {1, 0, 0, 0, 0, 0, 0, 0, 0}};

/* Long opcodes for the C56/C66 */
static struct seeprom_cmd seeprom_long_ewen = {11, {1, 0, 0, 1, 1, 0, 0, 0, 0}};
static struct seeprom_cmd seeprom_long_ewds = {11, {1, 0, 0, 0, 0, 0, 0, 0, 0}};
static const struct seeprom_cmd seeprom_long_ewen = {11, {1, 0, 0, 1, 1, 0, 0, 0, 0}};
static const struct seeprom_cmd seeprom_long_ewds = {11, {1, 0, 0, 0, 0, 0, 0, 0, 0}};

/* Common opcodes */
static struct seeprom_cmd seeprom_write = {3, {1, 0, 1}};
static struct seeprom_cmd seeprom_read = {3, {1, 1, 0}};
static const struct seeprom_cmd seeprom_write = {3, {1, 0, 1}};
static const struct seeprom_cmd seeprom_read = {3, {1, 1, 0}};

/*
* Wait for the SEERDY to go high; about 800 ns.
Expand All @@ -108,7 +108,7 @@ static struct seeprom_cmd seeprom_read = {3, {1, 1, 0}};
* Send a START condition and the given command
*/
static void
send_seeprom_cmd(struct seeprom_descriptor *sd, struct seeprom_cmd *cmd)
send_seeprom_cmd(struct seeprom_descriptor *sd, const struct seeprom_cmd *cmd)
{
uint8_t temp;
int i = 0;
Expand Down Expand Up @@ -227,7 +227,7 @@ int
ahc_write_seeprom(struct seeprom_descriptor *sd, uint16_t *buf,
u_int start_addr, u_int count)
{
struct seeprom_cmd *ewen, *ewds;
const struct seeprom_cmd *ewen, *ewds;
uint16_t v;
uint8_t temp;
int i, k;
Expand Down
12 changes: 6 additions & 6 deletions drivers/scsi/aic7xxx/aic7xxx_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ static void ahc_dumpseq(struct ahc_softc *ahc);
#endif
static int ahc_loadseq(struct ahc_softc *ahc);
static int ahc_check_patch(struct ahc_softc *ahc,
struct patch **start_patch,
const struct patch **start_patch,
u_int start_instr, u_int *skip_addr);
static void ahc_download_instr(struct ahc_softc *ahc,
u_int instrptr, uint8_t *dconsts);
Expand Down Expand Up @@ -6851,7 +6851,7 @@ ahc_loadseq(struct ahc_softc *ahc)
struct cs cs_table[num_critical_sections];
u_int begin_set[num_critical_sections];
u_int end_set[num_critical_sections];
struct patch *cur_patch;
const struct patch *cur_patch;
u_int cs_count;
u_int cur_cs;
u_int i;
Expand Down Expand Up @@ -6956,11 +6956,11 @@ ahc_loadseq(struct ahc_softc *ahc)
}

static int
ahc_check_patch(struct ahc_softc *ahc, struct patch **start_patch,
ahc_check_patch(struct ahc_softc *ahc, const struct patch **start_patch,
u_int start_instr, u_int *skip_addr)
{
struct patch *cur_patch;
struct patch *last_patch;
const struct patch *cur_patch;
const struct patch *last_patch;
u_int num_patches;

num_patches = ARRAY_SIZE(patches);
Expand Down Expand Up @@ -7019,7 +7019,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
case AIC_OP_JE:
case AIC_OP_JZ:
{
struct patch *cur_patch;
const struct patch *cur_patch;
int address_offset;
u_int address;
u_int skip_addr;
Expand Down
12 changes: 5 additions & 7 deletions drivers/scsi/aic7xxx/aic7xxx_osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,11 @@ ahc_linux_info(struct Scsi_Host *host)
bp = &buffer[0];
ahc = *(struct ahc_softc **)host->hostdata;
memset(bp, 0, sizeof(buffer));
strcpy(bp, "Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev ");
strcat(bp, AIC7XXX_DRIVER_VERSION);
strcat(bp, "\n");
strcat(bp, " <");
strcpy(bp, "Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev " AIC7XXX_DRIVER_VERSION "\n"
" <");
strcat(bp, ahc->description);
strcat(bp, ">\n");
strcat(bp, " ");
strcat(bp, ">\n"
" ");
ahc_controller_info(ahc, ahc_info);
strcat(bp, ahc_info);
strcat(bp, "\n");
Expand Down Expand Up @@ -1033,7 +1031,7 @@ aic7xxx_setup(char *s)
char *p;
char *end;

static struct {
static const struct {
const char *name;
uint32_t *flag;
} options[] = {
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*/
#define ID(x) ID_C(x, PCI_CLASS_STORAGE_SCSI)

static struct pci_device_id ahc_linux_pci_id_table[] = {
static const struct pci_device_id ahc_linux_pci_id_table[] = {
/* aic7850 based controllers */
ID(ID_AHA_2902_04_10_15_20C_30C),
/* aic7860 based controllers */
Expand Down Expand Up @@ -206,7 +206,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
const uint64_t mask_39bit = 0x7FFFFFFFFFULL;
struct ahc_softc *ahc;
ahc_dev_softc_t pci;
struct ahc_pci_identity *entry;
const struct ahc_pci_identity *entry;
char *name;
int error;
struct device *dev = &pdev->dev;
Expand Down
Loading

0 comments on commit 980b306

Please sign in to comment.