[PARISC] Use kzalloc and other janitor-style cleanups

Helge,
  o Convert a bunch of kmalloc/memset uses to kzalloc.
  o pci.c: Add some __read_mostly annotations.
  o pci.c: Move constant pci_post_reset_delay to asm/pci.h
  o grfioctl.h: Add A4450A to comment of CRT_ID_VISUALIZE_EG.
  o Add some consts to perf.c/perf_images.h

Matthew,
  o sticore.c: Add some consts to suppress compile warnings.

Signed-off-by: Helge Deller <deller@parisc-linux.org>
Signed-off-by: Matthew Wilcox <willy@parisc-linux.org>
Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
This commit is contained in:
Helge Deller 2006-01-17 12:40:40 -07:00 committed by Kyle McMartin
parent a1c7444395
commit cb6fc18e9c
17 changed files with 73 additions and 82 deletions

View File

@ -408,11 +408,10 @@ static void setup_bus_id(struct parisc_device *padev)
struct parisc_device * create_tree_node(char id, struct device *parent) struct parisc_device * create_tree_node(char id, struct device *parent)
{ {
struct parisc_device *dev = kmalloc(sizeof(*dev), GFP_KERNEL); struct parisc_device *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) if (!dev)
return NULL; return NULL;
memset(dev, 0, sizeof(*dev));
dev->hw_path = id; dev->hw_path = id;
dev->id.hw_type = HPHW_FAULTY; dev->id.hw_type = HPHW_FAULTY;

View File

@ -47,18 +47,17 @@
* this makes the boot time much longer than necessary. * this makes the boot time much longer than necessary.
* 20ms seems to work for all the HP PCI implementations to date. * 20ms seems to work for all the HP PCI implementations to date.
* *
* XXX: turn into a #defined constant in <asm/pci.h> ? * #define pci_post_reset_delay 50
*/ */
int pci_post_reset_delay = 50;
struct pci_port_ops *pci_port; struct pci_port_ops *pci_port __read_mostly;
struct pci_bios_ops *pci_bios; struct pci_bios_ops *pci_bios __read_mostly;
int pci_hba_count = 0; static int pci_hba_count __read_mostly;
/* parisc_pci_hba used by pci_port->in/out() ops to lookup bus data. */ /* parisc_pci_hba used by pci_port->in/out() ops to lookup bus data. */
#define PCI_HBA_MAX 32 #define PCI_HBA_MAX 32
struct pci_hba_data *parisc_pci_hba[PCI_HBA_MAX]; struct pci_hba_data *parisc_pci_hba[PCI_HBA_MAX] __read_mostly;
/******************************************************************** /********************************************************************

View File

@ -68,20 +68,20 @@ struct rdr_tbl_ent {
}; };
static int perf_processor_interface __read_mostly = UNKNOWN_INTF; static int perf_processor_interface __read_mostly = UNKNOWN_INTF;
static int perf_enabled __read_mostly = 0; static int perf_enabled __read_mostly;
static spinlock_t perf_lock; static spinlock_t perf_lock;
struct parisc_device *cpu_device __read_mostly = NULL; struct parisc_device *cpu_device __read_mostly;
/* RDRs to write for PCX-W */ /* RDRs to write for PCX-W */
static int perf_rdrs_W[] = static const int perf_rdrs_W[] =
{ 0, 1, 4, 5, 6, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, -1 }; { 0, 1, 4, 5, 6, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, -1 };
/* RDRs to write for PCX-U */ /* RDRs to write for PCX-U */
static int perf_rdrs_U[] = static const int perf_rdrs_U[] =
{ 0, 1, 4, 5, 6, 7, 16, 17, 18, 20, 21, 22, 23, 24, 25, -1 }; { 0, 1, 4, 5, 6, 7, 16, 17, 18, 20, 21, 22, 23, 24, 25, -1 };
/* RDR register descriptions for PCX-W */ /* RDR register descriptions for PCX-W */
static struct rdr_tbl_ent perf_rdr_tbl_W[] = { static const struct rdr_tbl_ent perf_rdr_tbl_W[] = {
{ 19, 1, 8 }, /* RDR 0 */ { 19, 1, 8 }, /* RDR 0 */
{ 16, 1, 16 }, /* RDR 1 */ { 16, 1, 16 }, /* RDR 1 */
{ 72, 2, 0 }, /* RDR 2 */ { 72, 2, 0 }, /* RDR 2 */
@ -117,7 +117,7 @@ static struct rdr_tbl_ent perf_rdr_tbl_W[] = {
}; };
/* RDR register descriptions for PCX-U */ /* RDR register descriptions for PCX-U */
static struct rdr_tbl_ent perf_rdr_tbl_U[] = { static const struct rdr_tbl_ent perf_rdr_tbl_U[] = {
{ 19, 1, 8 }, /* RDR 0 */ { 19, 1, 8 }, /* RDR 0 */
{ 32, 1, 16 }, /* RDR 1 */ { 32, 1, 16 }, /* RDR 1 */
{ 20, 1, 0 }, /* RDR 2 */ { 20, 1, 0 }, /* RDR 2 */
@ -156,7 +156,7 @@ static struct rdr_tbl_ent perf_rdr_tbl_U[] = {
* A non-zero write_control in the above tables is a byte offset into * A non-zero write_control in the above tables is a byte offset into
* this array. * this array.
*/ */
static uint64_t perf_bitmasks[] = { static const uint64_t perf_bitmasks[] = {
0x0000000000000000ul, /* first dbl word must be zero */ 0x0000000000000000ul, /* first dbl word must be zero */
0xfdffe00000000000ul, /* RDR0 bitmask */ 0xfdffe00000000000ul, /* RDR0 bitmask */
0x003f000000000000ul, /* RDR1 bitmask */ 0x003f000000000000ul, /* RDR1 bitmask */
@ -173,7 +173,7 @@ static uint64_t perf_bitmasks[] = {
* Write control bitmasks for Pa-8700 processor given * Write control bitmasks for Pa-8700 processor given
* somethings have changed slightly. * somethings have changed slightly.
*/ */
static uint64_t perf_bitmasks_piranha[] = { static const uint64_t perf_bitmasks_piranha[] = {
0x0000000000000000ul, /* first dbl word must be zero */ 0x0000000000000000ul, /* first dbl word must be zero */
0xfdffe00000000000ul, /* RDR0 bitmask */ 0xfdffe00000000000ul, /* RDR0 bitmask */
0x003f000000000000ul, /* RDR1 bitmask */ 0x003f000000000000ul, /* RDR1 bitmask */
@ -186,7 +186,7 @@ static uint64_t perf_bitmasks_piranha[] = {
0xfffc000000000000ul 0xfffc000000000000ul
}; };
static uint64_t *bitmask_array; /* array of bitmasks to use */ static const uint64_t *bitmask_array; /* array of bitmasks to use */
/****************************************************************************** /******************************************************************************
* Function Prototypes * Function Prototypes
@ -200,7 +200,7 @@ static ssize_t perf_write(struct file *file, const char __user *buf, size_t coun
static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg); static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
static void perf_start_counters(void); static void perf_start_counters(void);
static int perf_stop_counters(uint32_t *raddr); static int perf_stop_counters(uint32_t *raddr);
static struct rdr_tbl_ent * perf_rdr_get_entry(uint32_t rdr_num); static const struct rdr_tbl_ent * perf_rdr_get_entry(uint32_t rdr_num);
static int perf_rdr_read_ubuf(uint32_t rdr_num, uint64_t *buffer); static int perf_rdr_read_ubuf(uint32_t rdr_num, uint64_t *buffer);
static int perf_rdr_clear(uint32_t rdr_num); static int perf_rdr_clear(uint32_t rdr_num);
static int perf_write_image(uint64_t *memaddr); static int perf_write_image(uint64_t *memaddr);
@ -655,7 +655,7 @@ static int perf_stop_counters(uint32_t *raddr)
* Retrieve a pointer to the description of what this * Retrieve a pointer to the description of what this
* RDR contains. * RDR contains.
*/ */
static struct rdr_tbl_ent * perf_rdr_get_entry(uint32_t rdr_num) static const struct rdr_tbl_ent * perf_rdr_get_entry(uint32_t rdr_num)
{ {
if (perf_processor_interface == ONYX_INTF) { if (perf_processor_interface == ONYX_INTF) {
return &perf_rdr_tbl_U[rdr_num]; return &perf_rdr_tbl_U[rdr_num];
@ -673,7 +673,7 @@ static int perf_rdr_read_ubuf(uint32_t rdr_num, uint64_t *buffer)
{ {
uint64_t data, data_mask = 0; uint64_t data, data_mask = 0;
uint32_t width, xbits, i; uint32_t width, xbits, i;
struct rdr_tbl_ent *tentry; const struct rdr_tbl_ent *tentry;
tentry = perf_rdr_get_entry(rdr_num); tentry = perf_rdr_get_entry(rdr_num);
if ((width = tentry->width) == 0) if ((width = tentry->width) == 0)
@ -721,7 +721,7 @@ static int perf_rdr_read_ubuf(uint32_t rdr_num, uint64_t *buffer)
*/ */
static int perf_rdr_clear(uint32_t rdr_num) static int perf_rdr_clear(uint32_t rdr_num)
{ {
struct rdr_tbl_ent *tentry; const struct rdr_tbl_ent *tentry;
int32_t i; int32_t i;
tentry = perf_rdr_get_entry(rdr_num); tentry = perf_rdr_get_entry(rdr_num);
@ -753,10 +753,11 @@ static int perf_write_image(uint64_t *memaddr)
uint64_t buffer[MAX_RDR_WORDS]; uint64_t buffer[MAX_RDR_WORDS];
uint64_t *bptr; uint64_t *bptr;
uint32_t dwords; uint32_t dwords;
uint32_t *intrigue_rdr; const uint32_t *intrigue_rdr;
uint64_t *intrigue_bitmask, tmp64; const uint64_t *intrigue_bitmask;
uint64_t tmp64;
void __iomem *runway; void __iomem *runway;
struct rdr_tbl_ent *tentry; const struct rdr_tbl_ent *tentry;
int i; int i;
/* Clear out counters */ /* Clear out counters */
@ -830,7 +831,7 @@ static int perf_write_image(uint64_t *memaddr)
*/ */
static void perf_rdr_write(uint32_t rdr_num, uint64_t *buffer) static void perf_rdr_write(uint32_t rdr_num, uint64_t *buffer)
{ {
struct rdr_tbl_ent *tentry; const struct rdr_tbl_ent *tentry;
int32_t i; int32_t i;
printk("perf_rdr_write\n"); printk("perf_rdr_write\n");

View File

@ -25,7 +25,7 @@
#define PCXU_IMAGE_SIZE 584 #define PCXU_IMAGE_SIZE 584
static uint32_t onyx_images[][PCXU_IMAGE_SIZE/sizeof(uint32_t)] = { static uint32_t onyx_images[][PCXU_IMAGE_SIZE/sizeof(uint32_t)] __read_mostly = {
/* /*
* CPI: * CPI:
* *
@ -2093,7 +2093,7 @@ static uint32_t onyx_images[][PCXU_IMAGE_SIZE/sizeof(uint32_t)] = {
}; };
#define PCXW_IMAGE_SIZE 576 #define PCXW_IMAGE_SIZE 576
static uint32_t cuda_images[][PCXW_IMAGE_SIZE/sizeof(uint32_t)] = { static uint32_t cuda_images[][PCXW_IMAGE_SIZE/sizeof(uint32_t)] __read_mostly = {
/* /*
* CPI: FROM CPI.IDF (Image 0) * CPI: FROM CPI.IDF (Image 0)
* *

View File

@ -193,10 +193,9 @@ void show_stack(struct task_struct *task, unsigned long *s)
HERE: HERE:
asm volatile ("copy %%r30, %0" : "=r"(sp)); asm volatile ("copy %%r30, %0" : "=r"(sp));
r = (struct pt_regs *)kmalloc(sizeof(struct pt_regs), GFP_KERNEL); r = kzalloc(sizeof(struct pt_regs), GFP_KERNEL);
if (!r) if (!r)
return; return;
memset(r, 0, sizeof(struct pt_regs));
r->iaoq[0] = (unsigned long)&&HERE; r->iaoq[0] = (unsigned long)&&HERE;
r->gr[2] = (unsigned long)__builtin_return_address(0); r->gr[2] = (unsigned long)__builtin_return_address(0);
r->gr[30] = sp; r->gr[30] = sp;

View File

@ -1423,7 +1423,7 @@ static void __init ccio_init_resources(struct ioc *ioc)
struct resource *res = ioc->mmio_region; struct resource *res = ioc->mmio_region;
char *name = kmalloc(14, GFP_KERNEL); char *name = kmalloc(14, GFP_KERNEL);
sprintf(name, "GSC Bus [%d/]", ioc->hw_path); snprintf(name, 14, "GSC Bus [%d/]", ioc->hw_path);
ccio_init_resource(res, name, &ioc->ioc_regs->io_io_low); ccio_init_resource(res, name, &ioc->ioc_regs->io_io_low);
ccio_init_resource(res + 1, name, &ioc->ioc_regs->io_io_low_hv); ccio_init_resource(res + 1, name, &ioc->ioc_regs->io_io_low_hv);
@ -1557,12 +1557,11 @@ static int ccio_probe(struct parisc_device *dev)
int i; int i;
struct ioc *ioc, **ioc_p = &ioc_list; struct ioc *ioc, **ioc_p = &ioc_list;
ioc = kmalloc(sizeof(struct ioc), GFP_KERNEL); ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL);
if (ioc == NULL) { if (ioc == NULL) {
printk(KERN_ERR MODULE_NAME ": memory allocation failure\n"); printk(KERN_ERR MODULE_NAME ": memory allocation failure\n");
return 1; return 1;
} }
memset(ioc, 0, sizeof(struct ioc));
ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn"; ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn";
@ -1578,7 +1577,7 @@ static int ccio_probe(struct parisc_device *dev)
ccio_ioc_init(ioc); ccio_ioc_init(ioc);
ccio_init_resources(ioc); ccio_init_resources(ioc);
hppa_dma_ops = &ccio_ops; hppa_dma_ops = &ccio_ops;
dev->dev.platform_data = kmalloc(sizeof(struct pci_hba_data), GFP_KERNEL); dev->dev.platform_data = kzalloc(sizeof(struct pci_hba_data), GFP_KERNEL);
/* if this fails, no I/O cards will work, so may as well bug */ /* if this fails, no I/O cards will work, so may as well bug */
BUG_ON(dev->dev.platform_data == NULL); BUG_ON(dev->dev.platform_data == NULL);

View File

@ -989,14 +989,12 @@ static int __init dino_probe(struct parisc_device *dev)
*/ */
} }
dino_dev = kmalloc(sizeof(struct dino_device), GFP_KERNEL); dino_dev = kzalloc(sizeof(struct dino_device), GFP_KERNEL);
if (!dino_dev) { if (!dino_dev) {
printk("dino_init_chip - couldn't alloc dino_device\n"); printk("dino_init_chip - couldn't alloc dino_device\n");
return 1; return 1;
} }
memset(dino_dev, 0, sizeof(struct dino_device));
dino_dev->hba.dev = dev; dino_dev->hba.dev = dev;
dino_dev->hba.base_addr = ioremap(hpa, 4096); dino_dev->hba.base_addr = ioremap(hpa, 4096);
dino_dev->hba.lmmio_space_offset = 0; /* CPU addrs == bus addrs */ dino_dev->hba.lmmio_space_offset = 0; /* CPU addrs == bus addrs */

View File

@ -60,12 +60,11 @@ static int hppb_probe(struct parisc_device *dev)
} }
if(card->hpa) { if(card->hpa) {
card->next = kmalloc(sizeof(struct hppb_card), GFP_KERNEL); card->next = kzalloc(sizeof(struct hppb_card), GFP_KERNEL);
if(!card->next) { if(!card->next) {
printk(KERN_ERR "HP-PB: Unable to allocate memory.\n"); printk(KERN_ERR "HP-PB: Unable to allocate memory.\n");
return 1; return 1;
} }
memset(card->next, '\0', sizeof(struct hppb_card));
card = card->next; card = card->next;
} }
printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa.start); printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa.start);

View File

@ -873,28 +873,24 @@ void *iosapic_register(unsigned long hpa)
return NULL; return NULL;
} }
isi = (struct iosapic_info *)kmalloc(sizeof(struct iosapic_info), GFP_KERNEL); isi = (struct iosapic_info *)kzalloc(sizeof(struct iosapic_info), GFP_KERNEL);
if (!isi) { if (!isi) {
BUG(); BUG();
return NULL; return NULL;
} }
memset(isi, 0, sizeof(struct iosapic_info));
isi->addr = ioremap(hpa, 4096); isi->addr = ioremap(hpa, 4096);
isi->isi_hpa = hpa; isi->isi_hpa = hpa;
isi->isi_version = iosapic_rd_version(isi); isi->isi_version = iosapic_rd_version(isi);
isi->isi_num_vectors = IOSAPIC_IRDT_MAX_ENTRY(isi->isi_version) + 1; isi->isi_num_vectors = IOSAPIC_IRDT_MAX_ENTRY(isi->isi_version) + 1;
vip = isi->isi_vector = (struct vector_info *) vip = isi->isi_vector = (struct vector_info *)
kmalloc(sizeof(struct vector_info) * isi->isi_num_vectors, GFP_KERNEL); kzalloc(sizeof(struct vector_info) * isi->isi_num_vectors, GFP_KERNEL);
if (vip == NULL) { if (vip == NULL) {
kfree(isi); kfree(isi);
return NULL; return NULL;
} }
memset(vip, 0, sizeof(struct vector_info) * isi->isi_num_vectors);
for (cnt=0; cnt < isi->isi_num_vectors; cnt++, vip++) { for (cnt=0; cnt < isi->isi_num_vectors; cnt++, vip++) {
vip->irqline = (unsigned char) cnt; vip->irqline = (unsigned char) cnt;
vip->iosapic = isi; vip->iosapic = isi;

View File

@ -170,7 +170,7 @@ lasi_init_chip(struct parisc_device *dev)
struct gsc_irq gsc_irq; struct gsc_irq gsc_irq;
int ret; int ret;
lasi = kmalloc(sizeof(*lasi), GFP_KERNEL); lasi = kzalloc(sizeof(*lasi), GFP_KERNEL);
if (!lasi) if (!lasi)
return -ENOMEM; return -ENOMEM;

View File

@ -1565,7 +1565,7 @@ lba_driver_probe(struct parisc_device *dev)
} else if (IS_MERCURY(dev) || IS_QUICKSILVER(dev)) { } else if (IS_MERCURY(dev) || IS_QUICKSILVER(dev)) {
func_class &= 0xff; func_class &= 0xff;
version = kmalloc(6, GFP_KERNEL); version = kmalloc(6, GFP_KERNEL);
sprintf(version,"TR%d.%d",(func_class >> 4),(func_class & 0xf)); snprintf(version, 6, "TR%d.%d",(func_class >> 4),(func_class & 0xf));
/* We could use one printk for both Elroy and Mercury, /* We could use one printk for both Elroy and Mercury,
* but for the mask for func_class. * but for the mask for func_class.
*/ */
@ -1586,14 +1586,12 @@ lba_driver_probe(struct parisc_device *dev)
** have an IRT entry will get NULL back from iosapic code. ** have an IRT entry will get NULL back from iosapic code.
*/ */
lba_dev = kmalloc(sizeof(struct lba_device), GFP_KERNEL); lba_dev = kzalloc(sizeof(struct lba_device), GFP_KERNEL);
if (!lba_dev) { if (!lba_dev) {
printk(KERN_ERR "lba_init_chip - couldn't alloc lba_device\n"); printk(KERN_ERR "lba_init_chip - couldn't alloc lba_device\n");
return(1); return(1);
} }
memset(lba_dev, 0, sizeof(struct lba_device));
/* ---------- First : initialize data we already have --------- */ /* ---------- First : initialize data we already have --------- */

View File

@ -2064,14 +2064,13 @@ sba_driver_callback(struct parisc_device *dev)
printk(KERN_INFO "%s found %s at 0x%lx\n", printk(KERN_INFO "%s found %s at 0x%lx\n",
MODULE_NAME, version, dev->hpa.start); MODULE_NAME, version, dev->hpa.start);
sba_dev = kmalloc(sizeof(struct sba_device), GFP_KERNEL); sba_dev = kzalloc(sizeof(struct sba_device), GFP_KERNEL);
if (!sba_dev) { if (!sba_dev) {
printk(KERN_ERR MODULE_NAME " - couldn't alloc sba_device\n"); printk(KERN_ERR MODULE_NAME " - couldn't alloc sba_device\n");
return -ENOMEM; return -ENOMEM;
} }
parisc_set_drvdata(dev, sba_dev); parisc_set_drvdata(dev, sba_dev);
memset(sba_dev, 0, sizeof(struct sba_device));
for(i=0; i<MAX_IOC; i++) for(i=0; i<MAX_IOC; i++)
spin_lock_init(&(sba_dev->ioc[i].res_lock)); spin_lock_init(&(sba_dev->ioc[i].res_lock));

View File

@ -76,7 +76,7 @@ wax_init_chip(struct parisc_device *dev)
struct gsc_irq gsc_irq; struct gsc_irq gsc_irq;
int ret; int ret;
wax = kmalloc(sizeof(*wax), GFP_KERNEL); wax = kzalloc(sizeof(*wax), GFP_KERNEL);
if (!wax) if (!wax)
return -ENOMEM; return -ENOMEM;

View File

@ -249,7 +249,7 @@ struct parport *__devinit parport_gsc_probe_port (unsigned long base,
struct parport tmp; struct parport tmp;
struct parport *p = &tmp; struct parport *p = &tmp;
priv = kmalloc (sizeof (struct parport_gsc_private), GFP_KERNEL); priv = kzalloc (sizeof (struct parport_gsc_private), GFP_KERNEL);
if (!priv) { if (!priv) {
printk (KERN_DEBUG "parport (0x%lx): no memory!\n", base); printk (KERN_DEBUG "parport (0x%lx): no memory!\n", base);
return NULL; return NULL;

View File

@ -30,10 +30,11 @@
#define STI_DRIVERVERSION "Version 0.9a" #define STI_DRIVERVERSION "Version 0.9a"
struct sti_struct *default_sti; struct sti_struct *default_sti __read_mostly;
static int num_sti_roms; /* # of STI ROMS found */ /* number of STI ROMS found and their ptrs to each struct */
static struct sti_struct *sti_roms[MAX_STI_ROMS]; /* ptr to each sti_struct */ static int num_sti_roms __read_mostly;
static struct sti_struct *sti_roms[MAX_STI_ROMS] __read_mostly;
/* The colour indices used by STI are /* The colour indices used by STI are
@ -266,7 +267,7 @@ sti_rom_copy(unsigned long base, unsigned long count, void *dest)
static char default_sti_path[21]; static char default_sti_path[21] __read_mostly;
#ifndef MODULE #ifndef MODULE
static int __init sti_setup(char *str) static int __init sti_setup(char *str)
@ -414,10 +415,10 @@ sti_init_glob_cfg(struct sti_struct *sti,
if (!sti->sti_mem_request) if (!sti->sti_mem_request)
sti->sti_mem_request = 256; /* STI default */ sti->sti_mem_request = 256; /* STI default */
glob_cfg = kmalloc(sizeof(*sti->glob_cfg), GFP_KERNEL); glob_cfg = kzalloc(sizeof(*sti->glob_cfg), GFP_KERNEL);
glob_cfg_ext = kmalloc(sizeof(*glob_cfg_ext), GFP_KERNEL); glob_cfg_ext = kzalloc(sizeof(*glob_cfg_ext), GFP_KERNEL);
save_addr = kmalloc(save_addr_size, GFP_KERNEL); save_addr = kzalloc(save_addr_size, GFP_KERNEL);
sti_mem_addr = kmalloc(sti->sti_mem_request, GFP_KERNEL); sti_mem_addr = kzalloc(sti->sti_mem_request, GFP_KERNEL);
if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) { if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) {
kfree(glob_cfg); kfree(glob_cfg);
@ -427,11 +428,6 @@ sti_init_glob_cfg(struct sti_struct *sti,
return -ENOMEM; return -ENOMEM;
} }
memset(glob_cfg, 0, sizeof(*glob_cfg));
memset(glob_cfg_ext, 0, sizeof(*glob_cfg_ext));
memset(save_addr, 0, save_addr_size);
memset(sti_mem_addr, 0, sti->sti_mem_request);
glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext); glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext);
glob_cfg->save_addr = STI_PTR(save_addr); glob_cfg->save_addr = STI_PTR(save_addr);
for (i=0; i<8; i++) { for (i=0; i<8; i++) {
@ -502,9 +498,9 @@ sti_init_glob_cfg(struct sti_struct *sti,
#ifdef CONFIG_FB #ifdef CONFIG_FB
struct sti_cooked_font * __init struct sti_cooked_font * __init
sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name ) sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
{ {
struct font_desc *fbfont; const struct font_desc *fbfont;
unsigned int size, bpc; unsigned int size, bpc;
void *dest; void *dest;
struct sti_rom_font *nf; struct sti_rom_font *nf;
@ -525,10 +521,9 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
size = bpc * 256; size = bpc * 256;
size += sizeof(struct sti_rom_font); size += sizeof(struct sti_rom_font);
nf = kmalloc(size, GFP_KERNEL); nf = kzalloc(size, GFP_KERNEL);
if (!nf) if (!nf)
return NULL; return NULL;
memset(nf, 0, size);
nf->first_char = 0; nf->first_char = 0;
nf->last_char = 255; nf->last_char = 255;
@ -544,7 +539,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
dest += sizeof(struct sti_rom_font); dest += sizeof(struct sti_rom_font);
memcpy(dest, fbfont->data, bpc*256); memcpy(dest, fbfont->data, bpc*256);
cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
if (!cooked_font) { if (!cooked_font) {
kfree(nf); kfree(nf);
return NULL; return NULL;
@ -559,7 +554,7 @@ sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
} }
#else #else
struct sti_cooked_font * __init struct sti_cooked_font * __init
sti_select_fbfont(struct sti_cooked_rom *cooked_rom, char *fbfont_name) sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
{ {
return NULL; return NULL;
} }
@ -617,7 +612,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
struct sti_rom_font *raw_font, *font_start; struct sti_rom_font *raw_font, *font_start;
struct sti_cooked_font *cooked_font; struct sti_cooked_font *cooked_font;
cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); cooked_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
if (!cooked_font) if (!cooked_font)
return 0; return 0;
@ -631,7 +626,7 @@ sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
while (raw_font->next_font) { while (raw_font->next_font) {
raw_font = ((void *)font_start) + (raw_font->next_font); raw_font = ((void *)font_start) + (raw_font->next_font);
cooked_font->next_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL); cooked_font->next_font = kzalloc(sizeof(*cooked_font), GFP_KERNEL);
if (!cooked_font->next_font) if (!cooked_font->next_font)
return 1; return 1;
@ -668,10 +663,9 @@ sti_bmode_font_raw(struct sti_cooked_font *f)
unsigned char *n, *p, *q; unsigned char *n, *p, *q;
int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font); int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font);
n = kmalloc (4*size, GFP_KERNEL); n = kzalloc (4*size, GFP_KERNEL);
if (!n) if (!n)
return NULL; return NULL;
memset (n, 0, 4*size);
p = n + 3; p = n + 3;
q = (unsigned char *)f->raw; q = (unsigned char *)f->raw;
while (size--) { while (size--) {
@ -816,13 +810,12 @@ sti_try_rom_generic(unsigned long address, unsigned long hpa, struct pci_dev *pd
return NULL; return NULL;
} }
sti = kmalloc(sizeof(*sti), GFP_KERNEL); sti = kzalloc(sizeof(*sti), GFP_KERNEL);
if (!sti) { if (!sti) {
printk(KERN_ERR "Not enough memory !\n"); printk(KERN_ERR "Not enough memory !\n");
return NULL; return NULL;
} }
memset(sti, 0, sizeof(*sti));
spin_lock_init(&sti->lock); spin_lock_init(&sti->lock);
test_rom: test_rom:
@ -1035,7 +1028,7 @@ static struct parisc_driver pa_sti_driver = {
* sti_init_roms() - detects all STI ROMs and stores them in sti_roms[] * sti_init_roms() - detects all STI ROMs and stores them in sti_roms[]
*/ */
static int sticore_initialized; static int sticore_initialized __read_mostly;
static void __init sti_init_roms(void) static void __init sti_init_roms(void)
{ {

View File

@ -58,7 +58,7 @@
#define CRT_ID_ELK_1024DB 0x27849CA5 /* Elk 1024x768 double buffer */ #define CRT_ID_ELK_1024DB 0x27849CA5 /* Elk 1024x768 double buffer */
#define CRT_ID_ELK_GS S9000_ID_A1924A /* Elk 1280x1024 GreyScale */ #define CRT_ID_ELK_GS S9000_ID_A1924A /* Elk 1280x1024 GreyScale */
#define CRT_ID_CRX24 S9000_ID_A1439A /* Piranha */ #define CRT_ID_CRX24 S9000_ID_A1439A /* Piranha */
#define CRT_ID_VISUALIZE_EG 0x2D08C0A7 /* Graffiti (built-in B132+/B160L) */ #define CRT_ID_VISUALIZE_EG 0x2D08C0A7 /* Graffiti, A4450A (built-in B132+/B160L) */
#define CRT_ID_THUNDER 0x2F23E5FC /* Thunder 1 VISUALIZE 48*/ #define CRT_ID_THUNDER 0x2F23E5FC /* Thunder 1 VISUALIZE 48*/
#define CRT_ID_THUNDER2 0x2F8D570E /* Thunder 2 VISUALIZE 48 XP*/ #define CRT_ID_THUNDER2 0x2F8D570E /* Thunder 2 VISUALIZE 48 XP*/
#define CRT_ID_HCRX S9000_ID_HCRX /* Hyperdrive HCRX */ #define CRT_ID_HCRX S9000_ID_HCRX /* Hyperdrive HCRX */

View File

@ -18,6 +18,18 @@
*/ */
#define PCI_MAX_BUSSES 256 #define PCI_MAX_BUSSES 256
/* To be used as: mdelay(pci_post_reset_delay);
*
* post_reset is the time the kernel should stall to prevent anyone from
* accessing the PCI bus once #RESET is de-asserted.
* PCI spec somewhere says 1 second but with multi-PCI bus systems,
* this makes the boot time much longer than necessary.
* 20ms seems to work for all the HP PCI implementations to date.
*/
#define pci_post_reset_delay 50
/* /*
** pci_hba_data (aka H2P_OBJECT in HP/UX) ** pci_hba_data (aka H2P_OBJECT in HP/UX)
** **
@ -83,7 +95,7 @@ static __inline__ int pci_is_lmmio(struct pci_hba_data *hba, unsigned long a)
/* /*
** Convert between PCI (IO_VIEW) addresses and processor (PA_VIEW) addresses. ** Convert between PCI (IO_VIEW) addresses and processor (PA_VIEW) addresses.
** See pcibios.c for more conversions used by Generic PCI code. ** See pci.c for more conversions used by Generic PCI code.
** **
** Platform characteristics/firmware guarantee that ** Platform characteristics/firmware guarantee that
** (1) PA_VIEW - IO_VIEW = lmmio_offset for both LMMIO and ELMMIO ** (1) PA_VIEW - IO_VIEW = lmmio_offset for both LMMIO and ELMMIO
@ -191,7 +203,6 @@ struct pci_bios_ops {
*/ */
extern struct pci_port_ops *pci_port; extern struct pci_port_ops *pci_port;
extern struct pci_bios_ops *pci_bios; extern struct pci_bios_ops *pci_bios;
extern int pci_post_reset_delay; /* delay after de-asserting #RESET */
extern int pci_hba_count; extern int pci_hba_count;
extern struct pci_hba_data *parisc_pci_hba[]; extern struct pci_hba_data *parisc_pci_hba[];