From: Idan Mehalel Date: Tue, 24 Jul 2018 12:24:09 +0000 (+0300) Subject: mstflint: Fix coding style issues - left with LINUX_VERSION_CODE X-Git-Tag: v4.1.12-124.31.3~314 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6b4b373efedbd3f3a2b6dd52256f8823a3adc879;p=users%2Fjedix%2Flinux-maple.git mstflint: Fix coding style issues - left with LINUX_VERSION_CODE Description: Issue: 1471556 Orabug: 28878697 (cherry picked from commit 30e70911bcc22ac77b13d537225d7499261caac8) cherry-pick-repo=github.com/Mellanox/mstflint.git Signed-off-by: Brian Maly Conflicts: Files are relocated from 'kernel' directory to 'drivers/net/ethernet/mellanox/mstflint_access' Signed-off-by: Qing Huang Reviewed-by: Aron Silverton Signed-off-by: Brian Maly --- diff --git a/drivers/net/ethernet/mellanox/mstflint_access/mst.h b/drivers/net/ethernet/mellanox/mstflint_access/mst.h index 8e30bf49a6ca..84b3a393f972 100644 --- a/drivers/net/ethernet/mellanox/mstflint_access/mst.h +++ b/drivers/net/ethernet/mellanox/mstflint_access/mst.h @@ -1,33 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ /* - * Copyright (c) 2011-2014 Mellanox Technologies, Inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright (c) 2018 Mellanox Technologies. All rights reserved. */ #ifndef _MST_H_ diff --git a/drivers/net/ethernet/mellanox/mstflint_access/mst_kernel.h b/drivers/net/ethernet/mellanox/mstflint_access/mst_kernel.h index 080155aec87c..2902177a206d 100644 --- a/drivers/net/ethernet/mellanox/mstflint_access/mst_kernel.h +++ b/drivers/net/ethernet/mellanox/mstflint_access/mst_kernel.h @@ -1,36 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ /* - * Copyright (c) 2011-2014 Mellanox Technologies, Inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright (c) 2018 Mellanox Technologies. All rights reserved. */ - #ifndef _MST_KERNEL_H_ #define _MST_KERNEL_H_ @@ -72,9 +44,9 @@ #define MST_VPD_DEFAULT_TOUT 2000 /* milli seconds */ #define mst_err(format, arg...) \ - printk(KERN_ERR "%s: %s %d: " format, MST_PREFIX, __func__, __LINE__, ## arg) + pr_err("%s: %s %d: " format, MST_PREFIX, __func__, __LINE__, ## arg) #define mst_info(format, arg...) \ - printk(KERN_INFO "%s: %s %d: " format, MST_PREFIX, __func__, __LINE__, ## arg) + pr_info("%s: %s %d: " format, MST_PREFIX, __func__, __LINE__, ## arg) /****************************************************/ @@ -92,7 +64,7 @@ struct mst_dev_data { void *hw_addr; /* PCIMEM memory start */ char name[MST_NAME_SIZE]; /* name of character device */ enum dev_type type; /* type of device */ - struct pci_dev *pci_dev; /* device pci struct in kernel */ + struct pci_dev *pci_dev; /* device pci struct in kernel */ struct list_head list; /* list of mst_devices */ struct mutex lock; /* device lock */ int vpd_cap_addr; /* addr VPD capability */ diff --git a/drivers/net/ethernet/mellanox/mstflint_access/mst_main.c b/drivers/net/ethernet/mellanox/mstflint_access/mst_main.c index b811a53c4eb9..f27729a3654e 100644 --- a/drivers/net/ethernet/mellanox/mstflint_access/mst_main.c +++ b/drivers/net/ethernet/mellanox/mstflint_access/mst_main.c @@ -1,34 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* - * Copyright (c) 2011-2014 Mellanox Technologies, Inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. */ + #include #include #include @@ -167,7 +141,7 @@ static int _vendor_specific_sem(struct mst_dev_data *dev, int state) if (lock_val) { //semaphore is taken retries++; - msleep(1); // wait for current op to end + udelay(1000); // wait for current op to end continue; } //read ticket @@ -929,7 +903,7 @@ static int mst_ioctl(struct inode *inode, struct file *file, } if (dev->spaces_support_status != SS_ALL_SPACES_SUPPORTED) { - res = -ENOSYS; + res = -EOPNOTSUPP; goto fin; } @@ -968,7 +942,7 @@ static int mst_ioctl(struct inode *inode, struct file *file, } if (dev->spaces_support_status != SS_ALL_SPACES_SUPPORTED) { - res = -ENOSYS; + res = -EOPNOTSUPP; goto fin; } @@ -1209,7 +1183,7 @@ static int mst_ioctl(struct inode *inode, struct file *file, fin: if (IS_LOCK_NEEDED(dev)) - mutex_unlock(&dev->lock); + mutex_unlock(&dev->lock); fin_err: return res; } @@ -1277,12 +1251,8 @@ static struct mst_dev_data *mst_device_create(enum dev_type type, char dbdf[20]; dev = kzalloc(sizeof(struct mst_dev_data), GFP_KERNEL); - if (!dev) { - mst_err("failed allocating new %s device with id=0x%x\n", - dev_type_to_str(type), - pdev->device); + if (!dev) return NULL; - } sprintf(dbdf, "%4.4x:%2.2x:%2.2x.%1.1x", pci_domain_nr(pdev->bus), pdev->bus->number, PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn)); @@ -1326,13 +1296,13 @@ static struct mst_dev_data *mst_device_create(enum dev_type type, mst_err("failed to allocate chrdev_region\n"); dev->cl = class_create(THIS_MODULE, dev->name); if (dev->cl == NULL) { - printk(KERN_ALERT "Class creation failed\n"); + pr_alert("Class creation failed\n"); unregister_chrdev_region(dev->my_dev, 1); goto out; } if (device_create(dev->cl, NULL, dev->my_dev, NULL, dev->name) == NULL) { - printk(KERN_ALERT "Device creation failed\n"); + pr_alert("Device creation failed\n"); class_destroy(dev->cl); unregister_chrdev_region(dev->my_dev, 1); goto out; diff --git a/drivers/net/ethernet/mellanox/mstflint_access/mst_vpd.c b/drivers/net/ethernet/mellanox/mstflint_access/mst_vpd.c index f8ce128b90fe..ff5a5cae0664 100644 --- a/drivers/net/ethernet/mellanox/mstflint_access/mst_vpd.c +++ b/drivers/net/ethernet/mellanox/mstflint_access/mst_vpd.c @@ -1,33 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* - * Copyright (c) 2011-2014 Mellanox Technologies, Inc. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU - * General Public License (GPL) Version 2, available from the file - * COPYING in the main directory of this source tree, or the - * OpenIB.org BSD license below: - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * - Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved. */ #include