Evgeniy Polyakov wrote:
--- /tmp/empty/crypto_lb.c 1970-01-01 03:00:00.000000000 +0300
+++ ./acrypto/crypto_lb.c 2005-03-07 20:35:36.000000000 +0300
@@ -0,0 +1,634 @@
+/*
+ * crypto_lb.c
+ *
+ * Copyright (c) 2004 Evgeniy Polyakov <[EMAIL PROTECTED]>
+ */
+
+
+static LIST_HEAD(crypto_lb_list);
+static spinlock_t crypto_lb_lock = SPIN_LOCK_UNLOCKED;
use DEFINE_SPINLOCK()
+static int lb_num = 0;
statics don't need init to 0.
+static int lb_is_current(struct crypto_lb *l)
+{
+ return (l->crypto_device_list != NULL && l->crypto_device_lock != NULL);
+}
+
+static int lb_is_default(struct crypto_lb *l)
+{
+ return (l == default_lb);
+}
Is there a (or several) good reason(s) why several of these short
functions are not inline?
(unless some struct.fields need to point to them, of course)
+static void __lb_set_default(struct crypto_lb *l)
+{
+ default_lb = l;
+}
+
+static int crypto_lb_match(struct device *dev, struct device_driver *drv)
+{
+ return 1;
+}
+
+static int crypto_lb_probe(struct device *dev)
+{
+ return -ENODEV;
+}
+
+static int crypto_lb_remove(struct device *dev)
+{
+ return 0;
+}
+
+static void crypto_lb_release(struct device *dev)
+{
+ struct crypto_lb *d = container_of(dev, struct crypto_lb, device);
+
+ complete(&d->dev_released);
+}
+
+static void crypto_lb_class_release(struct class *class)
+{
+}
+
+static void crypto_lb_class_release_device(struct class_device *class_dev)
+{
+}
+static ssize_t current_show(struct class_device *dev, char *buf)
+{
+ struct crypto_lb *lb;
+ int off = 0;
+
+ spin_lock_irq(&crypto_lb_lock);
+
+ list_for_each_entry(lb, &crypto_lb_list, lb_entry) {
+ if (lb_is_current(lb))
+ off += sprintf(buf + off, "[");
+ if (lb_is_default(lb))
+ off += sprintf(buf + off, "(");
+ off += sprintf(buf + off, "%s", lb->name);
+ if (lb_is_default(lb))
+ off += sprintf(buf + off, ")");
+ if (lb_is_current(lb))
+ off += sprintf(buf + off, "]");
+ }
+
+ spin_unlock_irq(&crypto_lb_lock);
+
+ if (!off)
+ off = sprintf(buf, "No load balancers regitered yet.");
registered
+
+ off += sprintf(buf + off, "\n");
+
+ return off;
+}
+struct crypto_device *crypto_lb_find_device(struct crypto_session_initializer
*ci, struct crypto_data *data)
+{
+ struct crypto_device *dev;
+
+ if (!current_lb)
+ return NULL;
+
+ if (sci_binded(ci)) {
+ int found = 0;
+
+ spin_lock_irq(crypto_device_lock);
+
+ list_for_each_entry(dev, crypto_device_list, cdev_entry) {
+ if (dev->id == ci->bdev) {
+ found = 1;
+ break;
+ }
+ }
+
+ spin_unlock_irq(crypto_device_lock);
+
+ return (found) ? dev : NULL;
Don't need those parens.
--
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/