Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spin_lock is used in wrong way #10

Closed
anton-bondarev opened this issue Mar 17, 2010 · 3 comments
Closed

spin_lock is used in wrong way #10

anton-bondarev opened this issue Mar 17, 2010 · 3 comments

Comments

@anton-bondarev
Copy link
Collaborator

functions 'spin_lock' and 'spin_unlock' in net_pack_manager.c are used with wrong interface

    unsigned long sp;
    spin_lock(sp);

must be

    unsigned long sp;
    spin_lock(&sp);
@anton-bondarev
Copy link
Collaborator Author

Closed in f8a9ae4

@abusalimov
Copy link
Member

No, the first case is true.
spin_xxx are defined as macros, you do not need referencing the lock variable to pass it. Furthermore, using plain spin_lock/spin_unlock does not make sense in uniprocessor systems, particularly in embox, these macros are defined as no-op
(src/linux-compat/include/linux/spinlock.h).
To protect data in interrupt context you should use spin_lock_irqsave(lock, flags) and spin_unlock_irqrestore(lock, flags).

Reopened, status set to Accepted

@anton-bondarev
Copy link
Collaborator Author

Closed in 847a75c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants