mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 10:17:32 +00:00
crypto: hisilicon/qm - fix the coding specifications issue
Ensure that the inline function contains no more than 10 lines. move q_num_set() from hisi_acc_qm.h to qm.c. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
4fbc133891
commit
452c55dcef
@ -415,7 +415,7 @@ static int pf_q_num_set(const char *val, const struct kernel_param *kp)
|
||||
{
|
||||
pf_q_num_flag = true;
|
||||
|
||||
return q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_HPRE_PF);
|
||||
return hisi_qm_q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_HPRE_PF);
|
||||
}
|
||||
|
||||
static const struct kernel_param_ops hpre_pf_q_num_ops = {
|
||||
|
@ -451,6 +451,37 @@ static struct qm_typical_qos_table shaper_cbs_s[] = {
|
||||
|
||||
static void qm_irqs_unregister(struct hisi_qm *qm);
|
||||
static int qm_reset_device(struct hisi_qm *qm);
|
||||
int hisi_qm_q_num_set(const char *val, const struct kernel_param *kp,
|
||||
unsigned int device)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
u32 n, q_num;
|
||||
int ret;
|
||||
|
||||
if (!val)
|
||||
return -EINVAL;
|
||||
|
||||
pdev = pci_get_device(PCI_VENDOR_ID_HUAWEI, device, NULL);
|
||||
if (!pdev) {
|
||||
q_num = min_t(u32, QM_QNUM_V1, QM_QNUM_V2);
|
||||
pr_info("No device found currently, suppose queue number is %u\n",
|
||||
q_num);
|
||||
} else {
|
||||
if (pdev->revision == QM_HW_V1)
|
||||
q_num = QM_QNUM_V1;
|
||||
else
|
||||
q_num = QM_QNUM_V2;
|
||||
|
||||
pci_dev_put(pdev);
|
||||
}
|
||||
|
||||
ret = kstrtou32(val, 10, &n);
|
||||
if (ret || n < QM_MIN_QNUM || n > q_num)
|
||||
return -EINVAL;
|
||||
|
||||
return param_set_int(val, kp);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(hisi_qm_q_num_set);
|
||||
|
||||
static u32 qm_get_hw_error_status(struct hisi_qm *qm)
|
||||
{
|
||||
|
@ -322,7 +322,7 @@ static int sec_pf_q_num_set(const char *val, const struct kernel_param *kp)
|
||||
{
|
||||
pf_q_num_flag = true;
|
||||
|
||||
return q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_SEC_PF);
|
||||
return hisi_qm_q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_SEC_PF);
|
||||
}
|
||||
|
||||
static const struct kernel_param_ops sec_pf_q_num_ops = {
|
||||
|
@ -402,7 +402,7 @@ static int pf_q_num_set(const char *val, const struct kernel_param *kp)
|
||||
{
|
||||
pf_q_num_flag = true;
|
||||
|
||||
return q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_ZIP_PF);
|
||||
return hisi_qm_q_num_set(val, kp, PCI_DEVICE_ID_HUAWEI_ZIP_PF);
|
||||
}
|
||||
|
||||
static const struct kernel_param_ops pf_q_num_ops = {
|
||||
|
@ -436,37 +436,6 @@ struct hisi_qp {
|
||||
struct uacce_queue *uacce_q;
|
||||
};
|
||||
|
||||
static inline int q_num_set(const char *val, const struct kernel_param *kp,
|
||||
unsigned int device)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
u32 n, q_num;
|
||||
int ret;
|
||||
|
||||
if (!val)
|
||||
return -EINVAL;
|
||||
|
||||
pdev = pci_get_device(PCI_VENDOR_ID_HUAWEI, device, NULL);
|
||||
if (!pdev) {
|
||||
q_num = min_t(u32, QM_QNUM_V1, QM_QNUM_V2);
|
||||
pr_info("No device found currently, suppose queue number is %u\n",
|
||||
q_num);
|
||||
} else {
|
||||
if (pdev->revision == QM_HW_V1)
|
||||
q_num = QM_QNUM_V1;
|
||||
else
|
||||
q_num = QM_QNUM_V2;
|
||||
|
||||
pci_dev_put(pdev);
|
||||
}
|
||||
|
||||
ret = kstrtou32(val, 10, &n);
|
||||
if (ret || n < QM_MIN_QNUM || n > q_num)
|
||||
return -EINVAL;
|
||||
|
||||
return param_set_int(val, kp);
|
||||
}
|
||||
|
||||
static inline int vfs_num_set(const char *val, const struct kernel_param *kp)
|
||||
{
|
||||
u32 n;
|
||||
@ -526,6 +495,8 @@ static inline void hisi_qm_del_list(struct hisi_qm *qm, struct hisi_qm_list *qm_
|
||||
mutex_unlock(&qm_list->lock);
|
||||
}
|
||||
|
||||
int hisi_qm_q_num_set(const char *val, const struct kernel_param *kp,
|
||||
unsigned int device);
|
||||
int hisi_qm_init(struct hisi_qm *qm);
|
||||
void hisi_qm_uninit(struct hisi_qm *qm);
|
||||
int hisi_qm_start(struct hisi_qm *qm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user