Skip to content

Commit

Permalink
Merge pull request #53 from cyberang3l/clang_compile_linux_6.4
Browse files Browse the repository at this point in the history
Fixes to compile with clang on linux 6.4
  • Loading branch information
cneely-amd authored Feb 26, 2024
2 parents 7f31637 + 664c6cb commit 2409a93
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 32 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ KDIR ?= /lib/modules/$(shell uname -r)/build

all:
make -C $(KDIR) M=$(PWD) modules

with-clang:
make CC=clang -C $(KDIR) M=$(PWD) modules

clean:
make -C $(KDIR) M=$(PWD) clean
Expand Down
25 changes: 13 additions & 12 deletions hwmon/xmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3413,18 +3413,17 @@ static ssize_t show_hwmon_name(struct device *dev, struct device_attribute *da,
struct xocl_xmc *xmc = dev_get_drvdata(dev);
#endif
char nm[150] = { 0 };
int n;

#ifdef XMC_XRT
xocl_get_raw_header(xdev_hdl, &rom);
n = snprintf(nm, sizeof(nm), "%s", rom.VBNVName);
snprintf(nm, sizeof(nm), "%s", rom.VBNVName);

#else

if(profile_name[0] == '\0')
n = snprintf(nm, sizeof(nm), "%s", "noname_onic"); // default
snprintf(nm, sizeof(nm), "%s", "noname_onic"); // default
else
n = snprintf(nm, sizeof(nm), "%s_onic", profile_name);
snprintf(nm, sizeof(nm), "%s_onic", profile_name);
#endif


Expand All @@ -3443,9 +3442,7 @@ static struct sensor_device_attribute name_attr =

static void mgmt_sysfs_destroy_xmc_mini(struct platform_device *pdev)
{
struct xocl_xmc *xmc;

xmc = platform_get_drvdata(pdev);
platform_get_drvdata(pdev);
sysfs_remove_group(&pdev->dev.kobj, &xmc_mini_attr_group);
}

Expand Down Expand Up @@ -3488,11 +3485,13 @@ static void mgmt_sysfs_destroy_xmc(struct platform_device *pdev)
static int mgmt_sysfs_create_xmc(struct platform_device *pdev)
{
struct xocl_xmc *xmc;
struct xocl_dev_core *core;
int err;
#ifdef XMC_XRT
struct xocl_dev_core *core;
core = XDEV(xocl_get_xdev(pdev));
#endif

xmc = platform_get_drvdata(pdev);
core = XDEV(xocl_get_xdev(pdev));

if (!xmc->enabled)
{
Expand Down Expand Up @@ -4393,7 +4392,9 @@ static void inline xmc_enable_sensor_heartbeat(struct xocl_xmc *xmc)
int xmc_probe(struct platform_device *pdev)
{
struct xocl_xmc *xmc=0;
#if defined(XMC_XRT) || defined(XMC_SCALE)
void *xdev_hdl;
#endif
#ifdef XMC_XRT
struct resource *res;
xdev_handle_t xdev = xocl_get_xdev(pdev);
Expand Down Expand Up @@ -4462,7 +4463,6 @@ int xmc_probe(struct platform_device *pdev)
}

xmc->priv_data = XOCL_GET_SUBDEV_PRIV(&pdev->dev);
xdev_hdl = xocl_get_xdev(pdev);

xmc->sc_presence = nosc_xmc(xmc->pdev) ? 0 : 1;

Expand All @@ -4476,6 +4476,7 @@ int xmc_probe(struct platform_device *pdev)
}

#ifdef XMC_SCALE
xdev_hdl = xocl_get_xdev(pdev);
if (xocl_clk_scale_on(xdev_hdl))
xmc->priv_data->flags |= XOCL_XMC_CLK_SCALING;
if (xocl_cmc_in_bitfile(xdev_hdl))
Expand All @@ -4502,8 +4503,9 @@ int xmc_probe(struct platform_device *pdev)
xmc_enable_mailbox(xmc);
#endif

}
#ifdef XMC_MAILBOX
} else if (!xmc->base_addrs[IO_GPIO]) {
else if (!xmc->base_addrs[IO_GPIO]) {
xocl_info(&pdev->dev, "minimum mode for SC upgrade");
/* CMC is always enabled on golden image. */
xmc->enabled = true;
Expand All @@ -4512,7 +4514,6 @@ int xmc_probe(struct platform_device *pdev)
return 0;
}
#endif
}

#ifdef XMC_XRT
xdev_hdl = xocl_get_xdev(pdev);
Expand Down
2 changes: 1 addition & 1 deletion hwmon/xocl_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ int xocl_drvinst_set_offline(void *data, bool offline)
failed:
mutex_unlock(&xocl_drvinst_lock);

return 0;
return ret;
}

int xocl_drvinst_get_offline(void *data, bool *offline)
Expand Down
24 changes: 5 additions & 19 deletions hwmon/xocl_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static struct xocl_debug xrt_debug = {

static unsigned long global_mod;

static int trace_open(struct inode *inode, struct file *file)
static inline int trace_open(struct inode *inode, struct file *file)
{
spin_lock(&xrt_debug.trace_lock);
xrt_debug.overrun = 0;
Expand All @@ -79,12 +79,12 @@ static int trace_open(struct inode *inode, struct file *file)
return 0;
}

static int trace_release(struct inode *inode, struct file *file)
static inline int trace_release(struct inode *inode, struct file *file)
{
return 0;
}

static ssize_t trace_read(struct file *file, char __user *buf,
static inline ssize_t trace_read(struct file *file, char __user *buf,
size_t sz, loff_t *ppos)
{
ssize_t count = 0;
Expand Down Expand Up @@ -140,15 +140,7 @@ static ssize_t trace_read(struct file *file, char __user *buf,
return count;
}

static const struct file_operations trace_fops = {
.owner = THIS_MODULE,
.open = trace_open,
.release = trace_release,
.read = trace_read,
.llseek = no_llseek,
};

static ssize_t trace_mod_read(struct file *file, char __user *buf,
static inline ssize_t trace_mod_read(struct file *file, char __user *buf,
size_t sz, loff_t *ppos)
{
struct xrt_debug_mod *mod;
Expand Down Expand Up @@ -194,7 +186,7 @@ static ssize_t trace_mod_read(struct file *file, char __user *buf,
}


static ssize_t trace_mod_write(struct file *filp, const char __user *data,
static inline ssize_t trace_mod_write(struct file *filp, const char __user *data,
size_t data_len, loff_t *ppos)
{
struct xrt_debug_mod *mod = NULL, *_mod;
Expand Down Expand Up @@ -240,12 +232,6 @@ static ssize_t trace_mod_write(struct file *filp, const char __user *data,
return -EINVAL;
}

static const struct file_operations trace_mod_fops = {
.owner = THIS_MODULE,
.read = trace_mod_read,
.write = trace_mod_write,
};

void xocl_debug_fini(void)
{
xocl_debug_unreg(global_mod);
Expand Down

0 comments on commit 2409a93

Please sign in to comment.