Commit 7ba50cea authored by Federico Vaga's avatar Federico Vaga

kernel: add lock command

I do not think that it is going to be really useful.
I added this, so that if the user unlocks the programming it can locks it back
immediately without re-programming the FPGA.
Signed-off-by: Federico Vaga's avatarFederico Vaga <>
parent e3345018
......@@ -542,19 +542,26 @@ static ssize_t svec_afpga_lock_show(struct device *dev,
* It unlocks the AFPGA programming when the user write "unlock"
* It unlocks the AFPGA programming when the user write "unlock" or "lock"
static ssize_t svec_afpga_lock_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
struct svec_dev *svec = to_svec_dev(dev);
unsigned int lock;
if (strncmp(buf, "unlock" , min(6, (int)count)) != 0)
if (strncmp(buf, "unlock" , min(6, (int)count)) != 0 &&
strncmp(buf, "lock" , min(4, (int)count)) != 0)
return -EINVAL;
lock = (strncmp(buf, "lock" , min(4, (int)count)) == 0);
clear_bit(SVEC_FLAG_LOCK, svec->flags);
if (lock)
set_bit(SVEC_FLAG_LOCK, svec->flags);
clear_bit(SVEC_FLAG_LOCK, svec->flags);
return count;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment