Skip to content

Commit

Permalink
minor code formatting
Browse files Browse the repository at this point in the history
- add new lines between function definitions
- use 4 instead of 8 spaces for indents
  • Loading branch information
slabasan committed Sep 23, 2024
1 parent 9b6bc71 commit ffd7036
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions msr_entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,22 @@ static struct notifier_block __refdata msr_class_cpu_notifier =
* now keying off of the change in the parameter types.*/

#define msr_devnode_selector _Generic(\
(((struct class *)0)->devnode),\
char * (*) (struct device *, mode_t *) : msr_devnode1,\
char * (*) (struct device *, umode_t *) : msr_devnode2,\
char * (*) (const struct device *, umode_t *) : msr_devnode3\
)
(((struct class *)0)->devnode),\
char * (*) (struct device *, mode_t *) : msr_devnode1,\
char * (*) (struct device *, umode_t *) : msr_devnode2,\
char * (*) (const struct device *, umode_t *) : msr_devnode3\
)

static char *msr_devnode1(struct device *dev, mode_t *mode)
{
return kasprintf(GFP_KERNEL, "cpu/%u/msr_safe", MINOR(dev->devt));
}

static char *msr_devnode2(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "cpu/%u/msr_safe", MINOR(dev->devt));
}

static char *msr_devnode3(const struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "cpu/%u/msr_safe", MINOR(dev->devt));
Expand Down
12 changes: 7 additions & 5 deletions msr_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ static const struct file_operations fops =
};

#define msr_version_nodename_selector _Generic(\
(((struct class *)0)->devnode),\
char * (*) ( struct device *, mode_t *) : msr_version_nodename1,\
char * (*) ( struct device *, umode_t *) : msr_version_nodename2,\
char * (*) (const struct device *, umode_t *) : msr_version_nodename3 \
)
(((struct class *)0)->devnode),\
char * (*) ( struct device *, mode_t *) : msr_version_nodename1,\
char * (*) ( struct device *, umode_t *) : msr_version_nodename2,\
char * (*) (const struct device *, umode_t *) : msr_version_nodename3 \
)

static char *msr_version_nodename1(struct device *dev, mode_t *mode)
{
Expand All @@ -65,6 +65,7 @@ static char *msr_version_nodename1(struct device *dev, mode_t *mode)
}
return kasprintf(GFP_KERNEL, "cpu/msr_safe_version");
}

static char *msr_version_nodename2(struct device *dev, umode_t *mode)
{
if (mode)
Expand All @@ -73,6 +74,7 @@ static char *msr_version_nodename2(struct device *dev, umode_t *mode)
}
return kasprintf(GFP_KERNEL, "cpu/msr_safe_version");
}

static char *msr_version_nodename3(const struct device *dev, umode_t *mode)
{
if (mode)
Expand Down

0 comments on commit ffd7036

Please sign in to comment.