int
mgt_init(islpci_private *priv)
{
	int i;

	priv->mib = kcalloc(OID_NUM_LAST, sizeof (void *), GFP_KERNEL);
	if (!priv->mib)
		return -ENOMEM;

	
	for (i = 0; i < OID_NUM_LAST; i++) {
		if (isl_oid[i].flags & OID_FLAG_CACHED) {
			priv->mib[i] = kzalloc(isl_oid[i].size *
					       (isl_oid[i].range + 1),
					       GFP_KERNEL);
			if (!priv->mib[i])
				return -ENOMEM;
		} else
			priv->mib[i] = NULL;
	}

	init_rwsem(&priv->mib_sem);
	prism54_mib_init(priv);

	return 0;
}
示例#2
0
文件: oid_mgt.c 项目: wxlong/Test
int
mgt_init(islpci_private *priv)
{
	int i;

	priv->mib = kmalloc(OID_NUM_LAST * sizeof (void *), GFP_KERNEL);
	if (!priv->mib)
		return -ENOMEM;

	memset(priv->mib, 0, OID_NUM_LAST * sizeof (void *));

	/* Alloc the cache */
	for (i = 0; i < OID_NUM_LAST; i++) {
		if (isl_oid[i].flags & OID_FLAG_CACHED) {
			priv->mib[i] = kmalloc(isl_oid[i].size *
					       (isl_oid[i].range + 1),
					       GFP_KERNEL);
			if (!priv->mib[i])
				return -ENOMEM;
			memset(priv->mib[i], 0,
			       isl_oid[i].size * (isl_oid[i].range + 1));
		} else
			priv->mib[i] = NULL;
	}

	init_rwsem(&priv->mib_sem);
	prism54_mib_init(priv);

	return 0;
}