utag: Fix utag build error on 8650

For kernel 6.1.0
1 bio_alloc modify
2 PDE_DATA do not export

../../motorola/kernel/modules/drivers/misc/utag/utags.c:179:34:
error: too few arguments to function call, expected 4, have 2
                bio = bio_alloc(GFP_KERNEL, num);
                      ~~~~~~~~~                ^
kernel_platform/msm-kernel/include/linux/bio.h:420:27:
note: 'bio_alloc' declared here
static inline struct bio *bio_alloc(struct block_device *bdev,
                          ^
../../motorola/kernel/modules/drivers/misc/utag/utags.c:1404:27:
error: call to undeclared function 'PDE_DATA';
        struct proc_node *proc = PDE_DATA(inode);

Change-Id: I4e8879eb4a495029d4759905e0c3dc44eca5b025
Signed-off-by: qianlong <qianl2@motorola.com>
Reviewed-on: https://gerrit.mot.com/2761422
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiaojun Ji <jixj@motorola.com>
Reviewed-by: Zhenxin Xi <xizx@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
qianlong 2023-10-09 16:08:54 +08:00 • committed by Long Qian
commit 668b7a9660

View file

@ -152,6 +152,10 @@ struct ctrl {
#include <linux/blkdev.h>
#include <linux/bio.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
#define PDE_DATA(x) pde_data(x)
#endif
static struct page *addr_to_page(void *addr)
{
if (is_vmalloc_addr(addr))
@ -176,13 +180,19 @@ static int utags_submit_bio(struct block_device *bdev, void *buf, int pages, int
while (left_pages > 0) {
num = (left_pages >= NR_BIO_MAX_PAGES) ? NR_BIO_MAX_PAGES : left_pages;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
bio = bio_alloc(bdev, num, 0, GFP_KERNEL);
#else
bio = bio_alloc(GFP_KERNEL, num);
#endif
if (!bio)
return -ENOMEM;
bio->bi_iter.bi_sector = (pages - left_pages) * (PAGE_SIZE >> 9);
bio->bi_opf = opf;
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
bio_set_dev(bio, bdev);
#endif
for (i = 0; i < num; i++) {
if (!bio_add_page(bio, addr_to_page(buf + (pages - left_pages + i) * PAGE_SIZE), PAGE_SIZE, 0)) {