public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bernd Driegert <bd@cool.de>
To: linux-kernel@vger.kernel.org
Cc: linux-hams@vger.kernel.org
Subject: [RFC][PATCH] mkiss.[ch]
Date: Sun, 12 Jan 2003 15:26:42 +0100	[thread overview]
Message-ID: <3E217B22.7040309@cool.de> (raw)

The following patch does (hopefully):
1) change MOD_xxx_USE_COUNT to module calls
2) change cli() to use spin_lock

Can someone check:
a) ist it right in terms of usage (it's my first try for cleanup)
b) does it work with the appropriate HW, since im no ham-guy

Bernd

--- linux-2.5.56/drivers/net/hamradio/mkiss.h   Sun Jan 12 14:22:50 2003
+++ mkiss.h     Sun Jan 12 14:24:22 2003
@@ -55,6 +55,7 @@
  #define CRC_MODE_NONE   0
  #define CRC_MODE_FLEX   1
  #define CRC_MODE_SMACK  2
+       spinlock_t      driver_lock;
  };

  #define AX25_MAGIC             0x5316
--- linux-2.5.56/drivers/net/hamradio/mkiss.c   Mon Nov 18 05:29:57 2002
+++ mkiss.c     Sun Jan 12 15:55:06 2003
@@ -253,8 +253,7 @@
                 return;
         }

-       save_flags(flags);
-       cli();
+       spin_lock_irqsave(&ax->driver_lock, flags);

         oxbuff    = ax->xbuff;
         ax->xbuff = xbuff;
@@ -285,7 +284,7 @@
         ax->mtu      = dev->mtu + 73;
         ax->buffsize = len;

-       restore_flags(flags);
+       spin_unlock_irqrestore(&ax->driver_lock, flags);

         if (oxbuff != NULL)
                 kfree(oxbuff);
@@ -676,7 +675,7 @@
                 tmp_ax->mkiss = ax;
         }

-       MOD_INC_USE_COUNT;
+       try_module_get(THIS_MODULE);

         /* Done.  We have linked the TTY line to a channel. */
         return ax->dev->base_addr;
@@ -696,7 +695,7 @@
         ax->tty        = NULL;

         ax_free(ax);
-       MOD_DEC_USE_COUNT;
+       module_put(THIS_MODULE);
  }



             reply	other threads:[~2003-01-12 14:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-12 14:26 Bernd Driegert [this message]
2003-01-14 12:05 ` [RFC][PATCH] mkiss.[ch] Bernard Pidoux

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E217B22.7040309@cool.de \
    --to=bd@cool.de \
    --cc=linux-hams@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox